dharr

Dr. David Harrington

8355 Reputation

22 Badges

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

The notation doesn't make much sense. I can't think of any interpretation that would bring B12 outside the exp. If you understand that, please give a few more examples of expected output.

Emding with ":" will remove this message, and does for the cases in your worksheet. (I didn't wait for the last solve to complete.)

limit.mw

@acer I had a copy in my downloads folder that I have uploaded. (I didn't remove it.)

@FZ The one with the ic works if you remove the hint.

@studentX369 Sorry, you're right; I always use the startup code region and assumed the regular code edit regions can be expanded to work the same way. I use the startup region to define all my procedures, and it has the features I was listing. (I'm using 2024).

For programming, the startup region uses enter for a new line (with automatic indenting) and has other nice features for programming.

Edit: my earlier recollection that the regular code edit regions can work the same way is incorrect.

@paulmcquad To get a line segment you can use the line command in the plottools package. If you also want the endpoints, you can add pointplot commands for them. You are, however, moving away from the simplifying features of Student:-Precalculus, which means you will have to learn many of the other commands if you want things in a very specific way. For example if you want labels for the points you will need the textplot command.

How-to-plot-distance-midpoint.mw

@nilswe 

restart

Paste as 2-D

`&||` := proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, R)))) end procNULL

proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, R)))) end proc

Doesn't work, even in 1-D

R1 &|| R2;
lprint(%);

R1*R2

R1*R2

Paste as 1-D

`&||`:= (R::seq(algebraic))-> `if`(nargs=0, infinity, 1/`+`(1/~R))

proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, ` $`, R)))) end proc

Works in 1-D

R1 &|| R2

1/(1/R1+1/R2)

Doesn't work in 2-D

"R1&||R2;"

Error, mismatched or missing bracket/operator

"R1&||R2;"

Solution 1 - rename to &p

`&p`:= (R::seq(algebraic))-> `if`(nargs=0, infinity, 1/`+`(1/~R))

proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, ` $`, R)))) end proc

`&p`(R1, R2)NULL

1/(1/R1+1/R2)

Solution 2 - if you want to use a symbol from the Operators palette, e.g., (ironically the not-parallel symbol, but some others will work)

`∦`:= (R::seq(algebraic))-> `if`(nargs=0, infinity, 1/`+`(1/~R))

proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, ` $`, R)))) end proc

`∦`(R1, R2)

1/(1/R1+1/R2)

`†`:= (R::seq(algebraic))-> `if`(nargs=0, infinity, 1/`+`(1/~R))

proc (R::(seq(algebraic))) options operator, arrow; `if`(nargs = 0, infinity, 1/(`+`(`~`[`/`](1, ` $`, R)))) end proc

`†`(R1, R2)

1/(1/R1+1/R2)

NULL

Download resistor.mw

 

@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)-(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2+2*k[2]^2)^2 = 0

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

eq7 := algsubs(x*t = Y, eq6); indets(eq7)

-2*X*k[1]^3*n[1]-2*X*k[1]^2*k[2]*n[2]-2*X*k[1]*k[2]^2*n[1]-2*X*k[2]^3*n[2]-4*Y*k[1]^2*n[1]^2-4*Y*k[1]^2*n[2]^2-4*Y*k[2]^2*n[1]^2-4*Y*k[2]^2*n[2]^2-2*Z*k[1]*n[1]^3-2*Z*k[1]*n[1]*n[2]^2-2*Z*k[2]*n[1]^2*n[2]-2*Z*k[2]*n[2]^3+12*k[1]^4+24*k[1]^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

First 13 14 15 16 17 18 19 Last Page 15 of 87