dharr

Dr. David Harrington

8977 Reputation

22 Badges

21 years, 177 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

@salim-barzani My answer above is for the syntax error in your post above. There was no indication of any other questions you had. You separately posted about the xt problem, but that post is now gone, and @janhardo's answers are about that. @Kitonum gave an answer for that, that is more general and someone suggested algsubs.

Your problem in the replacing worksheet is that in eq6 you have x*t (as @janhardo pointed out), but in your eval you have xt=Y and not x*t=Y. But here if you are going to collect x and t and solve their coefficients you don't need this substitution at all. If you really want to substitute x*t here, you need to first substitute x^2 and t^2, then (now that there are no x^2 left) substitute x=Y/t and simplify (@Kitonum's solution IIRC). In general, eval (and subs) do not work well with expressions on the left-hand side (I managed to get away with it on your earlier examples). Algsubs only works for simple cases. In the general case where you want to do substitution in the arguments of trig function you may have more difficulty.

restart

L := ((2*k[1]*n[1]+2*k[2]*n[2])*(k[1]^2+k[2]^2)-(2*k[1]^2+2*k[2]^2)*(2*k[1]*n[1]+2*k[2]*n[2]))*x^2-(2*k[1]^2+2*k[2]^2)*(2*n[1]^2+2*n[2]^2)*x*t+((2*k[1]*n[1]+2*k[2]*n[2])*(n[1]^2+n[2]^2)-(2*k[1]*n[1]+2*k[2]*n[2])*(2*n[1]^2+2*n[2]^2))*t^2+(2*k[1]*n[1]+2*k[2]*n[2])*a[0]+3*(2*k[1]^2+2*k[2]^2)^2 = 0

((2*k[1]*n[1]+2*k[2]*n[2])*(k[1]^2+k[2]^2)-(2*k[1]^2+2*k[2]^2)*(2*k[1]*n[1]+2*k[2]*n[2]))*x^2-(2*k[1]^2+2*k[2]^2)*(2*n[1]^2+2*n[2]^2)*x*t+((2*k[1]*n[1]+2*k[2]*n[2])*(n[1]^2+n[2]^2)-(2*k[1]*n[1]+2*k[2]*n[2])*(2*n[1]^2+2*n[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]^2*k[2]^2+12*k[2]^4+2*a[0]*k[1]*n[1]+2*a[0]*k[2]*n[2] = 0

{X, Y, Z, a[0], k[1], k[2], n[1], n[2]}

 

NULL

Download replacing.mw

@salim-barzani Many commands, such as simplify, work with equations, but some do not (like coeffs here). For this reason, I usually do not have the =0 at the end of everything; then I don't get stuck like this.  Almost all Maple commands, such as solve, dsolve etc interpret an expression without =0 as though the =0 was present. Learn from this.

N-soliton1.mw

@salim-barzani Well, that is what the solve(identity,...) would have given for that set of equations and unknowns if it had worked, so it is the direct answer to your question. It also has nothing to do with the fact that there are two parameters x and t. If it doesn't work for you then you should reformulate the problem into the correct form first.

@janhardo Yikes! DEtools seems to be an old-style table-based package; I thought they had all been upgraded. The workaround would be to use DEtools[DEplot] on the two occasions you need DEtools.

@Hamza Rafiq I think your approach is correct, but I don't know how to complete it.

restart

with(PDEtools); with(plots)

alias(u = u(x, y, t), f = f(x, y, t), g = g(x, y, t), h = h(x, y, t), q = q(x, y, t))

u, f, g, h, q

Eq := diff(u, [y, t])+diff(u, [`$`(x, 3), y])-3*(diff(u, `$`(x, 2)))*(diff(u, y))-3*(diff(u, [x, y]))*(diff(u, x))

diff(diff(u, t), y)+diff(diff(diff(diff(u, x), x), x), y)-3*(diff(diff(u, x), x))*(diff(u, y))-3*(diff(diff(u, x), y))*(diff(u, x))

rf1 := f+g*phi(q)

f+g*phi(q)

rf2 := combine(expand(dsubs(u = rf1, Eq)))

rf3 := dsubs((D(phi))(q) = sigma*phi(q)+phi(q)^2, ((D@@2)(phi))(q) = sigma*(sigma*phi(q)+phi(q)^2)+2*phi(q)*(sigma*phi(q)+phi(q)^2), ((D@@3)(phi))(q) = sigma*(sigma*(sigma*phi(q)+phi(q)^2)+2*phi(q)*(sigma*phi(q)+phi(q)^2))+2*(sigma*phi(q)+phi(q)^2)^2+2*phi(q)*(sigma*(sigma*phi(q)+phi(q)^2)+2*phi(q)*(sigma*phi(q)+phi(q)^2)), ((D@@4)(phi))(q) = sigma*(sigma*(sigma*(sigma*phi(q)+phi(q)^2)+2*phi(q)*(sigma*phi(q)+phi(q)^2))+2*(sigma*phi(q)+phi(q)^2)^2+2*phi(q)*(sigma*(sigma*phi(q)+phi(q)^2)+2*phi(q)*(sigma*phi(q)+phi(q)^2)))+(6*(sigma*phi(q)+phi(q)^2))*(sigma*(sigma*phi(q)+phi(q)^2)+2*phi(q)*(sigma*phi(q)+phi(q)^2))+2*phi(q)*(sigma*(sigma*(sigma*phi(q)+phi(q)^2)+2*phi(q)*(sigma*phi(q)+phi(q)^2))+2*(sigma*phi(q)+phi(q)^2)^2+2*phi(q)*(sigma*(sigma*phi(q)+phi(q)^2)+2*phi(q)*(sigma*phi(q)+phi(q)^2))), rf2)

rf4 := collect(rf3, phi(q))

eqns := [seq(coeff(rf4, phi(q), i), i = 0 .. 5)]

pdsolve(eqns, {f, g, q}, HINT = `+`)

{f = f__1(x)+c__1+f__3(t), g = f__4(x)+c__2+f__6(t), q = f__7(x)+c__3+f__9(t)}

Last equation can be solved directly for f.

eqns[1]; pdsolve(eqns[1], f)

-3*(diff(diff(f, x), y))*(diff(f, x))-3*(diff(diff(f, x), x))*(diff(f, y))+diff(diff(f, t), y)+diff(diff(diff(diff(f, x), x), x), y)

f = -2*tanh(-4*c__2^3*t+c__2*x+c__3*y+c__1)*c__2+_C5

Try g=2*q_x as in Eq (7) - last two are satisfied

eqnsg := eval(eqns, g = 2*(diff(q, x))); eqnsg[5]; eqnsg[6]

0

0

So to get these we solve as the last two equations and take the last solution

pdsolve({eqns[5], eqns[6]}, {g, q})

{g = g, q = f__1(t)}, {g = (2/3)*(diff(f__1(x, t), x)), q = f__1(x, t)}, {g = f__10(x, t), q = f__1(x, t)}, {g = g, q = f__1(y, t)}, {g = 0, q = q}, {g = 2*(diff(q, x)), q = q}

NULL

``

NULL

Download Find_Solution.mw

I see this behaviour on Maple 2024.2 on Windows 11. In fact, after ctrl-alt-delete would get me to the task manager, clicking on java to select it to kill just sent me back to the frozen Maple screen - I had to do a hardware stop of my computer. 

Since I usually start Maple by double-clicking on a preexisting workheet or using recent documents, it's hard for me so say when this started, by 2-3 weeks ago seems about right.

Great detective work on the left panel!

intersectcurves from the algcurves package can do this. In this simple case one doesn't learn much more than directly using solve, but for more complicated cases it may be useful.

restart;

with(algcurves):

f := X^2 + Y^2 - 1:
g := X - Y:

sol:=intersectcurves(f,g,X,Y);

[[1, [X-Y, Y^2-1/2, 1]]]

First value 1 is the multiplicity - curves cross and are not tangent. Call the inner values a,b,c. For the usual case of c=1, solve b to get all y values, then for these solve a to get the x values (same as Y in this case).

yvals:=Y=~[solve(sol[1][2][2],Y)];
xvals:=map2(eval,sol[1][2][1],yvals);
zip((x,y)->{solve(x,{X})[],y},xvals,yvals); # single x solution assumed

[Y = (1/2)*2^(1/2), Y = -(1/2)*2^(1/2)]

[X-(1/2)*2^(1/2), X+(1/2)*2^(1/2)]

[{X = (1/2)*2^(1/2), Y = (1/2)*2^(1/2)}, {X = -(1/2)*2^(1/2), Y = -(1/2)*2^(1/2)}]

NULL

Download intersectcurves.mw

I don't have MapleFlow, but frequently have the same problem in Maple. The only solution I know of is to attempt to exit the program via the window's X button. Then you are given the option to save (yes/no/cancel). Sometimes cancel will get you back to a working state, but saving and then restarting from the OS will work.

This actually finds the solution.

Download solution.mw

@vv I was careful to say "that the elimination process does not lead to any valid solutions", not that there are no solutions. Is there another way to get such a solution or did I (or Maple) make a mistake in the step-by-step elimination? 

Edit: I see it is among the solutions to 

SolveTools:-PolynomialSystem(expr2)

 

@selaf @Preben Alsholm's answer works also for this case:

f ≔ x -> local j; seq(x, j=1..5);

As Preben said, this only works for 1-D input. If you try this with 2D input, you get an "invalid arrow procedure" error.

@Saalehorizontale So in terms of your concerns, I guess the conclusion is RegularChains (and Groebner) are reliable in terms of finding all solutions. RegularChains is the modern way to do it, but is hard to understand. Notice that engine = triade in PolynomialSysyems uses RegularChains but then does the work of outputting the solutions in nice form. @John May suggested earlier SolveTools:-SemiAlgebraic but it was too slow. It also uses RegularChains, but returns an easier-to-understand format. The secret may be to find a good variable ordering.

So using RegularChains to find the variable order, and then SolveTools:-SemiAlgebraic to express the solution in a nice form is a possibilty. Trying this worked and gave one solution. (I reversed the variable order in case an elimination order was required.) So I'm worried that it missed some solutions. I would suggest trying some much smaller systems where you know the exact number of solutions to make sure it is working the way you expect.

RegularChains.mw

@philroe Yes, sort should work on anything; try it on your examples or upload your worksheet if it doesn't seem to be working.

@C_R Nice.

The large y values that don't give reality seem to correspond to the same values of m and m2, but these are supposed to be in different ranges, so something not quite right there. I'm not sure about how those ranges were chosen; I do not fully understand the physics.

I agree with your approach with x as a parameter (or we could try z). The exponents are no longer integers, which makes it a much harder problem than before. It think we are close to a phase transition (at d=3?), in which by definition (in an infinite system) the solution is non-analytic/has a singularity. So we expect it to be numerically very difficult. Perhap your sequence of x values found the phase transition, Perhaps it can be approached from the other side and goes crazy at the same point.

First 23 24 25 26 27 28 29 Last Page 25 of 97