dharr

Dr. David Harrington

7533 Reputation

21 Badges

20 years, 211 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 retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are replies submitted by dharr

@mz6687 You want to make assumptions on all variables that you want to be real:
simplify(conjugate(q)) assuming a::real, t::real etc. (or make all assumptions at the beginning of your worksheet)


evalc automatically assumes all variables are real, so another approach would be to separate lambda1 into real and imaginary parts and then use evalc, which is probably the approach I would take.

@nm Interesting. Note A.5 gives 5*A but 5.A gives "Error, missing operator or `;`", and A.B gives A.B (the matrix multiplication symbol).

@mz6687 OK, but without further information the question remains as to why they should both give zero for the same set of parameters - that seems to be your expectation and question.
 PS. I edited my above comment since I forgot evalc will also assume lambda1 real. Probably using conjugate with assumptions on variables is the way to go. 

Just a couple of comments, based on what I think you want to do. You manually do a complex conjugate by substituting I=-I, lambda1 = conjugate(lambda1), etc, but simplify(qb-conjugate(q)) does not give 0. Edit: removed incorrect solution to this.

You have two equations

eq1 := -2*q*diff(qb,t) - 2*(diff(q,t))*qb + diff(v,x) =0;
eq2 := 2*I*diff(q, x,t) + I*q*v + I*v*q + 2*diff(q,t)=0;

and substituting in some parameters you find eq2 gives 0=0 but eq1 does not. But they look very different to me. Are they supposed to be complex conjugates of each other?

You have many subscripted Energy variables so I can't really understand what you want to do, and some change of variables is mentioned but without being specific. It seems strange to differentiate and then integrate almost the same thing. It would be a lot easier to understand if you have variables instead of numbers (see my example below).

Perhaps you could just solve a differential equation. If you just want plots, something like the following implicitly dies a change of variables from t to E. Or you could use PDEtools:-dchange to get Maple to do the change of variables on the original ode. Perhaps the following does something that can be adapted to your situation.

Download DAE.mw

@mary120 You see at the end of the worksheet that the numerator has M^6 + const*M^4+const*M^2+const and the denominator has M^2*(M^6 +const*M^4+const*M^2+const)

@Johan159 Sorry, I misunterstood what you are trying to do, and I agree you want to solve for y_. Look at the implicitplot here - there are two branches - which do you want (or both)?.

The problem is too hard with the double piecewise, since for a given y, the answer for y_ can be in any of three regions, so there are 9 possibilities overall that Maple needs to consider. I suggest you have separate equations for each y region,  then solve for y_ (perhaps still piecewise, but better not). Even then, there might not be an analytical solution from solve and you then have to use fsolve (and make a function that takes uses fsolve to output y_ given y.. I suugest as a starting point you look closely at the implicitplot for one of the regions you are interested in - choose a region for y that has y_ in only one region and try to solve that first (no piecewise). The you will know whether you can use solve. 

I would say in general solutions with piecewise are difficult to solve, but easier with fsolve.

M_V_as_function_of_hight_cc_temporary_dharr.mw

@Aixleft math A quick way is 

pcube := draw(poly(color = black, cutout = 0.98));

though cutouts don't really leave lines (try a smaller number to see).

Alternatively you could just find the edges and plot them as lines. Strangely, geom3d doesn't have a way to find edges directly; you have to do it via faces. See attached.

Download cube.mw

@Carl Love That's an interesting assumption about how is works. Since evalb doesn't want to work with sqrt(3) and other algebraic numbers, and is will, I assumed that is is purely symbolic, and evaluates is(sqrt(3)<3)by squaring both sides or similar, so floats are never required (and hence takes much longer). I like to think there is never any doubt when Maple works symbolically, and it is probably possible to always find an example where float numerics fail.

If I change the 2D math to 1D math and execute with the ! icon it works.

@Hullzie16 OK, solve,identity seems to work only up to about -5, and as you say doesn't take into account the fact that you can solve them sequentially. So your method seems OK to me; a slight improvement might be

for i to 10 do b[i]:=factor(solve(coeff(E2-Q/r,r,-i),b[i])) end do;

 

@GFY A variation of  @C_R 's changes. Not exactly sure what you want to do with the eigenvalues. Changes in red.

equation915_debug.mw

@sursumCorda Yes, thanks for pointing that out; I missed the distnctness aspect. You could separately do the cases of 1, 2 and 3 distinct roots, but I suppose postprocessing is required.

dec1 := RealRootClassification([f], [], [x], [p, q, r], 3, 1, R);
dec2 := RealRootClassification([f], [], [x], [p, q, r], 3, 2, R);
dec3 := RealRootClassification([f], [], [x], [p, q, r], 3, 3, R);

The [p,q,r] was to look only for cases where these are non-zero, but seems to make no difference here over []. However, when I was playing with RealTrangularize there was a difference between [p,q,r] and [], so I'm confused about this. 

discrim(f,x) is zero iff there exist multiple roots, so that may also help. Here it is just the now familiar

 -4*p^3*r + p^2*q^2 + 18*p*q*r - 4*q^3 - 27*r^2

and Descarte's rule of signs is useful in this case, though you did want it without polynomials theory.

@dharr This is very close, but has the condition p^2*q + 3*p*r - 4*q^2>0 instead of q<0 - perhaps they are equivalent but that wasn't immediately obvious to me.

restart

with(RegularChains); with(ParametricSystemTools)

f := p*x^2+x^3+q*x+r

p*x^2+x^3+q*x+r

R := PolynomialRing([x, p, q, r])

polynomial_ring

Solve f for solutions with x>0 and p,q,r non-zero and 3 real roots.
We find the correct main condition and  r<0, p<0, but the condition on q is more complicated

dec := RealRootClassification([f], [], [x], [p, q, r], 3, 3, R)

Display(dec, R)

[[Typesetting:-mrow(Typesetting:-mi("r"), Typesetting:-mo("&lt;"), Typesetting:-mn("0")) and Typesetting:-mrow(Typesetting:-mi("p"), Typesetting:-mo("&lt;"), Typesetting:-mn("0")) and Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msup(Typesetting:-mi("p"), Typesetting:-mn("2")), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-mi("q")), Typesetting:-mo("&plus;"), Typesetting:-mrow(Typesetting:-mn("3"), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-mi("r"), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-mi("p")), Typesetting:-mo("&minus;"), Typesetting:-mrow(Typesetting:-mn("4"), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-msup(Typesetting:-mi("q"), Typesetting:-mn("2")))), Typesetting:-mo("&gt;"), Typesetting:-mn("0")) and Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mn("4"), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-msup(Typesetting:-mi("p"), Typesetting:-mn("3")), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-mi("r")), Typesetting:-mo("&minus;"), Typesetting:-mrow(Typesetting:-msup(Typesetting:-mi("p"), Typesetting:-mn("2")), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-msup(Typesetting:-mi("q"), Typesetting:-mn("2"))), Typesetting:-mo("&minus;"), Typesetting:-mrow(Typesetting:-mn("18"), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-mi("q"), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-mi("r"), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-mi("p")), Typesetting:-mo("&plus;"), Typesetting:-mrow(Typesetting:-mn("4"), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-msup(Typesetting:-mi("q"), Typesetting:-mn("3"))), Typesetting:-mo("&plus;"), Typesetting:-mrow(Typesetting:-mn("27"), Typesetting:-mo("&InvisibleTimes;"), Typesetting:-msup(Typesetting:-mi("r"), Typesetting:-mn("2")))), Typesetting:-mo("&lt;"), Typesetting:-mn("0"))], [p, r, p^2*q+3*p*r-4*q^2, -4*p^3*r+p^2*q^2+18*p*q*r-4*q^3-27*r^2]]

NULL

Download cubic2.mw

First 9 10 11 12 13 14 15 Last Page 11 of 77