Maple 2020 Questions and Posts

These are Posts and Questions associated with the product, Maple 2020

Hi,

Is it possible to capture programatically the values of theta, phi and psi when you manually rotate a 3D plot?

Thanks in advance

PS: The target version is Maple 2020

sometimes I get equations where there is clearly more simplification on it. For an example

restart;
ode:=y(x)=diff(y(x),x)^3*y(x)^2+2*x*diff(y(x),x);
new_ode:=PDEtools:-dchange({y(x)=sqrt(u(x))},ode,{u});

Doing this by hand, I would now write the above as

by multiplying both sides by sqrt(u(x))

new_ode :=sqrt(u(x))*lhs(new_ode)=simplify(sqrt(u(x))*rhs(new_ode))

Since I am doing this in a program, without knowing what the expression is, I need to have this simplification done automatically, since I do not know before hand, if the resulting expression has this form or not. So I automatically call simplify on it.

I tried on a simpler example

expr:=sqrt(u)=1/sqrt(u)

And want to simplify this to u=1

I can't do  

new_expr :=sqrt(u)*lhs(expr)=sqrt(u)*rhs(expr)

Since this is done in a program, without the benefit of looking first and then deciding what to do. Everything needs to be automated since the expression can be anything.

So I need a generic operation to apply and have Maple simplify it, if this pattern exist.  I tried many things, but do far nothing is working:

restart;
expr:=sqrt(u)=1/sqrt(u);
expand(expr);
expand(expr) assuming real;
combine(expr);
combine(expr,sqrt);
combine(expr,radical);
combine(expr,power);
expand(expr);
collect(expr,sqrt(u));
collect(lhs(expr)-rhs(expr)=0,sqrt(u));
simplify(lhs(expr)-rhs(expr)=0) assuming u<>0; # I expected this to work
simplify(expr) assuming real;
simplify(expr,size=false);
simplify(expr,sqrt) assuming real;
simplify(expr,sqrt) assuming positive;
simplify(expr,sqrt,symbolic) assuming positive;
simplify(expr,sqrt,symbolic,size=false) assuming positive;
simplify(expr,symbolic,size=false);
simplify(expr) assuming u<>0;
rationalize(expr);

no change.

Please do not give me an answer that requires one to use specific solution assuming one can see the expression. The solution needs to be something generic and work on any such expression that I can apply to any expression and have Maple simplify the sqrts on both sides, if they are there, since this is done in a program.

From the above, this should have worked


expr:=sqrt(u)=1/sqrt(u);
simplify(lhs(expr)-rhs(expr)=0) assuming u<>0;
simplify(lhs(expr)-rhs(expr)=0,symbolic);

Using Mathematica

ClearAll[u];
expr = Sqrt[u] == 1/Sqrt[u]
Simplify[expr[[1]] - expr[[2]] == 0, Assumptions -> u != 0]

Any suggestions? I am sure there is a simple way to do this in Maple, I just have not found it yet.

Maple 2020.2

 

 

Why Maple can't simplify this expression to zero?

restart;
ode:=diff(y(x),x)-y(x) = x*y(x)^(1/2);
ic:=y(0)=4;
sol:=dsolve([ode, ic],y(x));
check:=odetest(sol,ode);

simplify(check) assuming x>0

In Mathematica:

ClearAll[x]
check = -2*x + 4*x*Exp[x/2] - x^2 -x*Sqrt[x^2 - 8*x*Exp[x/2] + 4*x + 16*Exp[x] - 16*Exp[x/2] + 4]
Simplify[check, Assumptions -> x > 0]

note that using x>=0 instead of x>0 does not change the above output.

Any work around in Maple?

 

I think this is also wrong ode type given by ode advisor.   The following clearly can't be _dAlembert ode. 

restart;
ode:=diff(y(x),x)*tan(diff(y(x),x))+ln(cos(diff(y(x),x))) = y(x);

It does not even have an explicit on its own, in the RHS. D'Alembert ode has the form

The ode above has the form   y=f(p)+g(p)  or one can argue the form y=F(p). Either way, there is no in the RHS.

For the first form above, f(p)=p*ln(p) and g(p)=ln(cos(p))

So why Maple says

DEtools:-odeadvisor(ode)

And Maple knows this. But for some reason, for the above ode, I think it made the wrong call.

restart;
ode:=y(x)=x*f(diff(y(x),x))+g(diff(y(x),x));
DEtools:-odeadvisor(ode);

ode:=y(x)=f(diff(y(x),x))+g(diff(y(x),x));   #no x
DEtools:-odeadvisor(ode)

 

Is there something I am overlooking here? 

Maple 2020.2 with Physics 908 on windows 10

 

I need to find and remove any abs that shows up only inside ln anywhere in an expression.

I used to do this in multiple steps before, by using loop and subs. But I am now learning evalindet which is powerful command. I should use it more. 

I wanted to see if it is possible to do this in one call to evalindent. Both finding and replacing.

Here is an example. Given

expr:=sin(x)+ln(abs(x))+ln(x+abs(y)/sqrt(abs(x+3)))+ln(x^3)+cos(abs(x));

The goal is to change it to the following

This is what I ended up with

restart;
expr:=sin(x)+ln(abs(x))+ln(x+abs(y)/sqrt(abs(x+3)))+ln(x^3)+cos(abs(x));
expr:=evalindets(expr,
          'specfunc( satisfies(u->has(u,abs)),  ln)',
          f->evalindets(f,'specfunc(anything,abs)',f->op(1,f))
          )

My question is: Is there a more optimal or better way to do this? I had to use evalindets inside the transformer to remove the abs. At first I did not know if it will work, but it did work.

Any place for improvement?

Maple 2020.2

Knowing the realations between cartesian ans shperoidal coordinates (x,y,z and v,u,w respectively)

 

 

the goal is to take the following graph:

 

 

 

This graphic consists of three planes (One with v=const, let's say v=2, the other one with u=const, let's say u=π/4 and the last one with w=const let's say w=π/4), of three coordinate lines (line v with u=π/4 and w=π/4, line u with v=2 and w=π/4 and finally line w with v=2 and u=π/4). I wrote the following code but an error occurs...

restart;
with(plots);
with(LinearAlgebra);
F := <2*cosh(1)*cos(x), 2*sinh(1)*sin(x)*sin(t), 2*sinh(1)*sin(x)*cos(t)>;
S1 := plot3d(F, x = -Pi/2 .. Pi/2, t = 0 .. 2*Pi, color = "Green");
F, 1.5*Normalize(diff(F, x), 2);
eval(%, {t = Pi/4, x = Pi/4});
A1 := arrow(%, color = red);
V1 := textplot3d(<`+`(`%%`), v^`0`>, align = {'above', 'right'}, font = [Roman, bold, 14]);
F, 1.5*Normalize(diff(F, t), 2);
eval(%, {t = Pi/4, x = Pi/4});
A2 := arrow(%, color = red);
V2 := textplot3d(<`+`(`%%`), u^`0`>, align = {'below'}, font = [Roman, bold, 14]);
G := <2*cosh(x)*cos(Pi/4), 2*sinh(x)*sin(Pi/4)*sin(t), 2*sinh(x)*sin(Pi/4)*cos(t)>;
S2 := plot3d(G, x = 0 .. 100, t = 0 .. 2*Pi, color = "Cyan");
G, 1.5*Normalize(diff(G, x), 2);
eval(%, {t = Pi/4, x = Pi/4});
A3 := arrow(%, color = red);
V3 := textplot3d(<`+`(`%%`), w^`0`>, align = {'above', 'left'}, font = [Roman, bold, 14]);
display(S1, S2, A1, A2, A3, V1, V2, V3, scaling = constrained, axes = framed, labels = [x, y, z]);
 

 

Given an expression, I want to obtain list of all functions in it, that contains as argument, anywhere another function.  

I can do this now using 2 steps. I was wondering if there is a way to do it in one call.

Here is an example.

expr:=sin(x)+ln(abs(x))+ln(x+1/sqrt(abs(x+3)))+ln(x^3);

The goal is to find all ln functions, with abs inside them. Now, I do this

restart;
expr:=sin(x)+ln(abs(x))+ln(x+1/sqrt(abs(x+3)))+ln(x^3);
lis:=indets(expr,'specfunc(anything,ln)');
select(Z->has(Z,abs),lis)

I could not find a way to do it in one call, If I do this

indets(expr,'specfunc(abs(anything),ln)');

it only finds

Which overlooked the other one, since abs there is elsewhere in side ln.

I looked at help Definition of a Structured Type in Maple but do not know yet if there is an option there to do this. 

Is it possible to do this on one call?  Just wondering, that is all. The above works OK for me now.

 

Maple 2020.2

We have the equation of the following plane in the three-dimension space :

with m1=10, m2=2, C=20 and r1 and r2 given by the following expressions:

  

with d1=0.6 and d2=0.4. How can we get in Maple the graph of this equation on the x0y plane (z=0) ?

I'm having an issue with Maple 2020.2 classic interface being *very* slow on a new MacBook pro with Big Sur. It takes about 1 second between each keystroke and it appearing on the screen. 

Is this a known bug?

restart;
with(Syrup);
ckt := "*\n\
V1 1 0 -10*exp(-2*t)\n\
R1 1 2 2\n\
R2 2 3 2\n\
C1 3 0 0.5F\n\
R3 2 4 4\n\
L1 4 3 1H\n\
.end";
volts,others:=Solve(ckt,'tran', 'returnall'):


How do I get an expression for diff(i1(t),t)?    I tried

eval(diff(i[R1](t),t), volts union others);
But, this looks very strange

diff(i2(t),t)?  I tried a similar expression, but, it is ver different than the one by OP.

How do I set the initial conditions?  I can use init=1, on L1 for i2(0)=1.  But, how about i1(0)=1?

 

I was using the DirectSearch:-GlobalSearch function on a LaguerrelL for values of 4 and 5. At a value of 4 I get a solution, but at 5 I get an error message that the Kernel connection is lost. I ran this script on two different PCs using Maple 2019 and 2020 with WIN 10 and get the same results. Why does this happen?

 

Here is my worksheet. Thanks for looking.


mysearch2.mw


 

Is there one place which summarizes major difference between using solve vs. PDEtools:-Solve to solve equation? (ofcourse can one read help for both commands, and try to figure the differences this way, but this is not as easy as it sounds. I was looking more for a short basic summary type list. So I am making one myself in my maple cheat sheet).

I am trying to switch to PDEtools:-Solve from solve, but I keep noticing strange differences. Here is an example

example A

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x));
check:=odetest(sol,ode);
PDEtools:-Solve(check=0,x) assuming x>-1,x<6

Error, (in assuming) when calling 'PDEtools:-Solve'. Received: 'not a system with respect to the unknowns {x}'

Compare to 

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x));
check:=odetest(sol,ode);
solve(check=0,x) assuming x>-1,x<6;

                               x

Now, back to first example above using Solve. I moved the assuming inside, and now the error went away

Example B

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x));
check:=odetest(sol,ode);
PDEtools:-Solve(check=0,x,assume=[x>-1,x<6]);

But I noticed I can not do the same with solve. i.e. move the assuming inside solve, it now gives an error

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x));
check:=odetest(sol,ode);
solve(check=0,x,assume=[x>-1,x<6]);

Error, invalid input: too many and/or wrong type of arguments passed to solve; first unused argument is assume = [-1 < x, x < 6]

So first difference is that one can use assume= inside Solve, but not inside solve. Which is fine.

But I still not sure why first example A above gives error with Solve but not with solve. Any idea why that is?  Notice that example A gives an error with Solve, only when adding x<6 to the assumption. So this works

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x));
check:=odetest(sol,ode);
PDEtools:-Solve(check=0,x) assuming x>-1

No error, and now it gives

But was trying to find why it failed when adding x<6

Maple 2020.2 on windows 10.


 

This ode

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x))

Direct use of odetest does not give zero.

res:=odetest(sol,ode)

When asking Solve for possible values of x which makes the above zero, it only gave the upper bound

PDEtools:-Solve(res=0,x)

The actual range which makes res=0 is actually -1<x<exp(2)-1

res:=odetest(sol,ode) assuming -1<x,x<exp(2)-1

How could one using Maple obtain this range -1<x<exp(2)-1? 

Mathematica gives the answer using Reduce:

res=Log[Sqrt[x+1]]-1+Sign[Log[(x+1)]-2]*Log[Sqrt[x+1]]-Sign[Log[x+1]-2];
Reduce[res==0,x,Reals]

Is it possible to obtain such result in Maple, since Solve did not give complete answer.

Maple 2020.2

I do not underand why these two gives different results

restart;
mysol:= exp(sqrt( y(x)^2/x^2+1)) = _C1*x;
ode:=diff(y(x),x) = (y(x)^2+(x^2+y(x)^2)^(1/2)*x)/x/y(x);

And now case A:

simplify(odetest(mysol,ode)) assuming x>0;

                  0

But case B

res:=odetest(mysol,ode):
simplify(res) assuming x>0;

      #does not give zero

 

Why is putting the result in a variable first makes it give a different result?

What should one do so both case A and B give 0 ?

It looks like scoping issue of assuming. But this is really confusing, I did not expect that putting an intermediate result in a variable first will make a difference.

Maple 2020.2, Physis 897

A torus can be defined parametrically by:

{\displaystyle {\begin{aligned}x(\theta ,\varphi )&=(R+r\cos \theta )\cos {\varphi }\\y(\theta ,\varphi )&=(R+r\cos \theta )\sin {\varphi }\\z(\theta ,\varphi )&=r\sin \theta \end{aligned}}}

where θ, φ are angles which make a full circle, so that their values start and end at the same point, R is the distance from the center of the tube to the center of the torus, r  is the radius of the tube.

R:=10:
r:=5:
plot3d( [ ( R+r(u,v)*cos(v))*sin(u),
          ( R+r(u,v)*cos(v))*cos(u),
            r*sin(v)
        ],
            u=0..2*Pi,
            v=0..2*Pi,style=patchnogrid,
            scaling=constrained,
          scaling=constrained,
coordinateview=[-15..15, -15..15,-5..5],
lightmodel=light3, viewpoint = circleleft);

I set range [-5..5] of the Z axis,but  the range of  Z axis tickmarks  in the above image maybe in [-4.5..4.5] .

How to have tickmarks included at -5 and 5 on the Z axis?

First 19 20 21 22 23 24 25 Last Page 21 of 55