nm

8552 Reputation

19 Badges

12 years, 355 days

MaplePrimes Activity


These are questions asked by nm

 

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

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

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.


 

First 58 59 60 61 62 63 64 Last Page 60 of 164