dharr

Dr. David Harrington

2403 Reputation

15 Badges

17 years, 146 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a professor of chemistry at the University of Victoria, BC, Canada, where my research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are answers submitted by dharr

If you last line is assigned to qq, then after choosing a value of H, you can get a numerical value. For example,

evalf(eval(qq,H=1.2));

gives .147305967157494

or you can plot vs H:

plot(qq, H=0..1);

 

In the Startup Code Edit Region (from the edit menu) there is indentation, bracket matching, and color coding for keywords, comments, etc. It also has continuous syntax checking and approximate location of the syntax error (red wiggly underline), but not the explanation of the error.

I frequently use this to program most of the procedures I'm going to use in a worksheet.

Code Edit Regions are similar regions embedded in the worksheet, with full error messages (but not error location).

More for procedure analysis is the maplemint command used within a worksheet, or the standalone mint.

For this simple case the default is sufficient:

plot(ln(h), h=1..10, labels=[h, ln(h)]);

since variables are italic by default and functions such as ln, cos etc are upright.

You can just add style=surfacecontour to your plot3d command (or style=contour for the contour lines without the surface as in @tomleslie's last plot).

As @Carl Love pointed out, parametric plots usually use lists, but the vector you used does give the same plot.

This is not an error in my version of Maple (2017). But using the element of a 1D Vector just for the purposes of a subscript seems strange, if you just want the "r" to display as a subscript use eval(H,Pr=P[r])

As for regular expressions it is often more successful to see if the simplified difference is zero, and here simplify(v1-v2) does return the zero vector. So you could use LinearAlgebra:-Equal(simplify(v1-v2), Vector(3, 0)).

I think for efficiency reasons, Maple doesn't want to try too hard, unless requested, say by various types of simplify.

To have f(t) as a known but unspecified function, use

dsolve(dsys,{x(t),y(t)});

This gives a DESol structure, which is a placeholder for a solution, which says in some sense what Maple would do if it knew f(t). In this case I do not think there is much else to do without specifying f(t).

interface(version); will do this.

The "a" is the real part of a root, and not the root itself. Not sure if only the second root is of interest, but if you want to track things down more, you can put the option "useassumptions" in solve. In the attached the substitution u=k*(t-a) makes the solution depend only on two parameters, so the essential information is available in a 3d plot.

restart

version(); interface(version)

 User Interface: 1265877
         Kernel: 1265877
        Library: 1265877

1265877

`Standard Worksheet Interface, Maple 2017.3, Windows 8.1, September 27 2017 Build ID 1265877`

f := c/(1+exp(k*(t-a)))-c*(t-a)*k*exp(k*(t-a))/(1+exp(k*(t-a)))^2+d/(1+exp(-k*(t-a)))+d*(t-a)*k*exp(-k*(t-a))/(1+exp(-k*(t-a)))^2

c/(1+exp(k*(t-a)))-c*(t-a)*k*exp(k*(t-a))/(1+exp(k*(t-a)))^2+d/(1+exp(-k*(t-a)))+d*(t-a)*k*exp(-k*(t-a))/(1+exp(-k*(t-a)))^2

It looks as if the following substitution will help - then the u value that makes f = 0 depends only on c and d

itr := u = k*(t-a); tr := t = solve(itr, t); f2 := PDEtools:-dchange(tr, f, [u])

u = k*(t-a)

t = (a*k+u)/k

c/(1+exp(k*((a*k+u)/k-a)))-c*((a*k+u)/k-a)*k*exp(k*((a*k+u)/k-a))/(1+exp(k*((a*k+u)/k-a)))^2+d/(1+exp(-k*((a*k+u)/k-a)))+d*((a*k+u)/k-a)*k*exp(-k*((a*k+u)/k-a))/(1+exp(-k*((a*k+u)/k-a)))^2

denominator is never zero, so we can solve for the numerator being zero.

simplify(f2); f3 := numer(%)

(d*exp(2*u)+((-u+1)*c+d*(u+1))*exp(u)+c)/(1+exp(u))^2

d*exp(2*u)-c*u*exp(u)+d*u*exp(u)+c*exp(u)+d*exp(u)+c

u0 := solve(f3, u)

RootOf(-d*(exp(_Z))^2+_Z*exp(_Z)*c-_Z*exp(_Z)*d-c*exp(_Z)-d*exp(_Z)-c)

plot3d(u0, c = 0 .. 3, d = -3 .. 0, view = [default, default, -1 .. 1])

RootOf expressions can be differentiated

diff(u0, c)

(-RootOf(-d*(exp(_Z))^2+_Z*exp(_Z)*c-_Z*exp(_Z)*d-c*exp(_Z)-d*exp(_Z)-c)*exp(RootOf(-d*(exp(_Z))^2+_Z*exp(_Z)*c-_Z*exp(_Z)*d-c*exp(_Z)-d*exp(_Z)-c))+exp(RootOf(-d*(exp(_Z))^2+_Z*exp(_Z)*c-_Z*exp(_Z)*d-c*exp(_Z)-d*exp(_Z)-c))+1)/(-2*d*(exp(RootOf(-d*(exp(_Z))^2+_Z*exp(_Z)*c-_Z*exp(_Z)*d-c*exp(_Z)-d*exp(_Z)-c)))^2+RootOf(-d*(exp(_Z))^2+_Z*exp(_Z)*c-_Z*exp(_Z)*d-c*exp(_Z)-d*exp(_Z)-c)*exp(RootOf(-d*(exp(_Z))^2+_Z*exp(_Z)*c-_Z*exp(_Z)*d-c*exp(_Z)-d*exp(_Z)-c))*c-2*d*exp(RootOf(-d*(exp(_Z))^2+_Z*exp(_Z)*c-_Z*exp(_Z)*d-c*exp(_Z)-d*exp(_Z)-c))-RootOf(-d*(exp(_Z))^2+_Z*exp(_Z)*c-_Z*exp(_Z)*d-c*exp(_Z)-d*exp(_Z)-c)*exp(RootOf(-d*(exp(_Z))^2+_Z*exp(_Z)*c-_Z*exp(_Z)*d-c*exp(_Z)-d*exp(_Z)-c))*d)

The sinh/cosh form may also be of interest

f4 := factor(simplify(numer(normal(convert(f2, trig)))))

2*(cosh(u)+1)*(cosh(u)*c+cosh(u)*d-sinh(u)*c+sinh(u)*d-c*u+d*u+c+d)

``


 

Please_NO_RootOf3.mw

 

You want arctan_expression2 := arctan(L*omega,R);

It is arctan(y,x) not arctan(x,y)

You gave h in terms of a in the line before the plot, so now f is an expression in x and a, and you need a range for a. So change h to a in implicitplot and you get a plot. 

In general to diagnose these sorts of errors, just change the command to an invalid one (I changed implicitplot to iimplicitplot) and you can see what the command actually received.

Well, my answer is more in the context of fitting data to equations, but it could be used here. Notice that the distance between two points z1=x1+I*y1 and z2=x2+I*y2  in the conmplex plane is abs(z1-z2) = sqrt((x1-x2)^2+(y1-y2)^2) so the square of this is abs(z1-z2)^2 = (x1-x2)^2+(y1-y2)^2. So if you add these for all your data point pairs you get an overall sum of squares of the real and imaginary deviations, which is a measure of the overall agreement. (This is what you would minimize in a comnplex least squares fit)

As @mmcdara has shown, MathML is how to do it. But to find the MathML , you can create what you want in 2D math and then convert to 1D math. For example, in 2D math use w^2 to create a superscripted w. Then select the w^2 and use the right-click menu (ctrl-click on Mac) to do 2-D math -> convert to -> atomic variable. Now use 2-D math -> convert to -> 1-D math input, and you hve your variable:

`#msup(mi("w"),mn("2"))`

For combined sub and superscript, use the Layout palette to generate it in 2D,

The SparseIterative method requres shape = symmetric, storage = sparse, datatype = float[8] and is for real symmetric or complex Hermitian Matrix (so the Matrix you enetred was changed to be symmetric)

Sparse.mw

Edit: methodoptions = [itermethod = CG, precon = false]  leads to the symmetric requirement (error message without) - in fact CG is for positive definite.

Your immediate problem is the Q's in the denominator. If you take the numerator and set it to zero, then you can almost get the answers you want PROVIDED P=1, which didn't seem to be in the problem statement. And why is there a d_1?

coeffs.mw

4 5 6 7 8 9 10 Last Page 6 of 35