nm

11353 Reputation

20 Badges

13 years, 13 days

MaplePrimes Activity


These are replies submitted by nm

@Kitonum 

Yes it does simplify lhs, but FullSimplify is needed. Not Simplify.  So internally Simplify may be uses some of the code from FullSimplify to help it when presented with equation. I do not know, since I only used Simplify on the equation itself and it worked. But not when used on lhs alone. So Simplify may be internally rearranged the equation to be lhs(eq)-rhs(eq) automtiacally and that helped. 

ClearAll[x, a, C0]; 
f = (9*(x^((-2/3)*a))^2*Exp[(6/a)*(x^((-2/3)*a))^(1/2)]^2*C0^2 - 6*(x^((-2/3)*a))^(3/2)*Exp[(6/a)*(x^((-2/3)*a))^(1/2)]^2*C0^2*a + 
     (Exp[(6/a)*(x^((-2/3)*a))^(1/2)]^2*C0^2*a^2)/x^((2/3)*a) + 18*(x^((-2/3)*a))^2*Exp[(6/a)*(x^((-2/3)*a))^(1/2)]*C0 - 
     (2*Exp[(6/a)*(x^((-2/3)*a))^(1/2)]*C0*a^2)/x^((2/3)*a) + 6*(x^((-2/3)*a))^(3/2)*a + a^2/x^((2/3)*a) + 9*(x^((-2/3)*a))^2)/
    (3*C0*Exp[(6/a)*(x^((-2/3)*a))^(1/2)]*(x^((-2/3)*a))^(1/2) - Exp[(6/a)*(x^((-2/3)*a))^(1/2)]*C0*a + 3*(x^((-2/3)*a))^(1/2) + a)^2; 

FullSimplify[f]

                                                   x^((-2*a)/3)

@Kitonum 

Thanks. I know this. I was doing   

eq:= f=g;
res:= simplify(eq);
if evalb(res) then
    print("same");
else
   print("not the same");
fi;

and was expecting to see "same" printed.  It worked for many other equations but not for this one. So Maple could not simplify one side to the same as the other side. 

But when I did this

eq:= f=g;
res:= simplify( lhs(eq)-rhs(eq) );
if res=0 then
    print("same");
else
   print("not the same");
fi;

it worked. 

That is my point. Compare to Mathematica, it was able to simplify lhs of the equation to be the same the rhs of the equation and it returned True automatically.

No help or side substitutions was needed as you can see.

Simplify[f==g]  returned True. Which means it was able to determine that lhs of the equation is the same as rhs of the equation. May be Mathematica automatically does  Simplify[f-g] internally and checks for zero or does something more. I do not know. The point is that it worked as is.

But I am ok now. I am using the second method above and it is working better now. I have not used  "is" before but will also look at it to see if it does better.

ps. if you have Mathematica and like to try it, here is the plain text code.

ClearAll[x, a, C0]; 
f = (9*(x^((-2/3)*a))^2*Exp[(6/a)*(x^((-2/3)*a))^(1/2)]^2*C0^2 - 
     6*(x^((-2/3)*a))^(3/2)*Exp[(6/a)*(x^((-2/3)*a))^(1/2)]^2*C0^2*a + 
          (Exp[(6/a)*(x^((-2/3)*a))^(1/2)]^2*C0^2*a^2)/x^((2/3)*a) + 
     18*(x^((-2/3)*a))^2*Exp[(6/a)*(x^((-2/3)*a))^(1/2)]*C0 - 
          (2*Exp[(6/a)*(x^((-2/3)*a))^(1/2)]*C0*a^2)/x^((2/3)*a) + 
     6*(x^((-2/3)*a))^(3/2)*a + a^2/x^((2/3)*a) + 9*(x^((-2/3)*a))^2)/
       (3*C0*Exp[(6/a)*(x^((-2/3)*a))^(1/2)]*(x^((-2/3)*a))^(1/2) - 
      Exp[(6/a)*(x^((-2/3)*a))^(1/2)]*C0*a + 3*(x^((-2/3)*a))^(1/2) + 
      a)^2; 
g = x^((-2/3)*a); 
Simplify[f == g]

 

@Carl Love 

Well, this is what I really meant. I said

      "post an image of the problem from the textbook than posting incorrect Maple code."

I see many people here post asking to solve a problem and know little Maple.

So instead of people wasting their time guessing what the code they typed mean, which has errors and try to guess where the error is, it is better to post an image of the actual problem from the text book so it is at least the equation are clear and people do not have to sit and guess what they meant as the case here.

Ofcourse it is better to post correct Maple code that works in first place. But in reality in this forum, I see many who do not Maple much but want their problems solved.

So that is why I suggest to post the problem image. This does not mean OP should not also post their Maple code attempt as well and what they tried even if it is wrong. 

 

@SUA 

it will make life much easier for yourself and others if you simply post an image of the problem from the textbook than posting incorrect Maple code.

How could this be BC possible:  D[1](C)(0, t) = VMK*D[1](C)(t)/ZRTWA;

Even after correcting the RHS to this (which may be what you meant)

                                             D[1](C)(0, t) = VMK*D[1](C)(t,0)/ZRTWA;

it makes no sense. You are say that   A =  VMK * A / ZRTWA; Where I used A for  D[1](C)(0, t).

This means A=0.   So D[1](C)(0, t)=0 ?

You are also using VMK as one variable, but then you say each letter is different variable. Also you are using Z and there is allready z in the pde. This can be confusing, as someone might think this is a typo.

           V, M ,K ,D Z, R, T, W, A are emprical constant of the equation.

In Maple you need to add * for multiplication.  VMK is not the same as V*M*K.

Again, posting an image of the actuall problem from the textbook will be much simpler than posting things that are wrong or makes no sense.

I am also wondering why do you care how Maple solves the PDE? Why does it have to be using Laplace transform? Maple do not show step-by-step solution. It shows only the final result. So if you obtain the final result, why is it important how it solved it?

As far as I know, pdfsolve does not support infinity as BC. So you might have to change that to L.

After reading all the above, may be this is what the PDE specs should be:

restart;
pde := W*diff(C(z, t), z$2) = diff(C(z, t), t);
IC  := C(Z,0) = 0;
bc  :=  D[1](C)(0, t) = V*M*K*D[1](C)(infinity,t)/(Z*R*T*W*A), C(infinity, t) = 0;
pdsolve([pde,bc,IC],C(z,t)) assuming t>0

But Maple can't solve it. It is possible there is a HINT which will make it solve it. But I could not find it myself.

 

 

@vv 

Thanks. I will add 

expand(rationalize(...

in case Q fail. 

It is no problem if Q does not work on all functions. I am also using solve and also adding other checks on my own. If all these fail, then it is more likely it is not isobaric. So your Q function is now one additional check I am using to help with this problem.   

@vv 

Thanks. I will try it now and see. I have to test it on many cases to see if it gives same result as solve and also when solve fail.

"You have changed the problem,"

As I mentioned in my post "edit. Simplified question is restated below" but you must have overlooked it. I did not want to delete the original top post.  

Thanks again for help.

edit 

Your new method does not find p for this one of the 5 examples I posted in my original question., where solve does. This has p=-2

restart;
f:=(x,y)-> (-(x*y)/2+sqrt(x^2*y^2-4*y)/2)*y;
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y))- alpha^(p-1)*f(x,y)=0;
PDEtools:-Solve(eq,p) assuming alpha>0;

   # p=-2

Q := (F,x,y) -> simplify( (F + diff(F,x)*x)/(F - diff(F,y)*y) ):
Q( f(x,y), x,y);

But your Q function found the correct P for the other 4 examples. Where solve finds the correct P also for 4 out these 5 examples.  What I will do, is first try solve() and if that do not find p, I will try your Q and if that also do not find P, then I will call the function as not isobaric. But so far, I have not found one method that always works and not give negative false.

@vv 

Thanks again. But I think there is some misunderstanding here or I did not explain things well. First for example 1, it is p=3 not p=2 which Maple gives. I must have copied it wrong. But this is the problem again

Since solve does not work for all cases (it gives false negative), I am asking if there is a better method to find such p without giving false negative. We can assume alpha>0 if needed, or use symbolic option for solve. Notice that many functions will fail to be isobaric, which is OK. But I'd like to avoid the false negative which happens as in example 5 above where solve failed to find p=2 as solution.

 

@vv 

thanks. But it does not give same answer as solve for examples 1 and 2 I posted above. Is your proc P meant to work for any f(x,y) or that one specific example you used it on?

#example 1
restart;
f:=(x,y)-> 3*sqrt(x*y);
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y))- alpha^(p-1)*f(x,y)=0;
PDEtools:-Solve(eq,p) assuming alpha>0;
    # p=3

P := (F,x,y)-> simplify(((-x*diff(F,x,x)-diff(F,x))*F+diff(F,x)^2*x)/(y*(F*diff(F,x,y)-(diff(F,x))*(diff(F,y))))):
P( f(x,y), x,y);
    #  -1  

it gives -1, but p=3 for this example.

#example 2
restart;
f:=(x,y)-> 4*(x*y)^(1/3);
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y))- alpha^(p-1)*f(x,y)=0;
PDEtools:-Solve(eq,p) assuming alpha>0;

   # p=2

P := (F,x,y)-> simplify(((-x*diff(F,x,x)-diff(F,x))*F+diff(F,x)^2*x)/(y*(F*diff(F,x,y)-(diff(F,x))*(diff(F,y))))):
P( f(x,y), x,y);

  #-1

it gives -1, but p=2 for this example.

But for example 3,4,5 I posted, it does give correct p.

May be I am not using your P function correctly, as I do not understand how you came up with it now. I just copied it as is and used it.

How does it tell if the function is not isobaric?  Since not all functions are ofcourse. 

 

@Kitonum 

thanks. will look at  SolveTools:-SemiAlgebraic. Never used it before.

 

@Carl Love 

Are A and B always polynomials? 

No, not necessarly. For example, 

But for now, we can assume they are polynomials as a starter. That would be OK. I just wanted to see if Maple have some hidden command to do this. 

 

@Kitonum 

thanks. This looks better. I need to test it more. But it works on the few ODE's I tried it on now with with initial conditions that odetest did not verify.

If I find any problem, will add a new note here.

@Kitonum 

Thank you. This looks promissing. I am studying and testing it. But on some ode's where odetest do not give zero it gives an error. 

Here is an example

restart;
ode:=diff(y(x),x)-y(x) = x*y(x)^(1/2):
ic:=y(0)=4;

#this below code from https://www.mapleprimes.com/questions/231328-How-To-Make-Solve-Obtain-All-Values

sol:=dsolve([ode,ic],y(x));
res:=odetest(sol,ode);
F:=indets(res, function);
R:=[solve(`and`(seq(`or`(F[i]>0, F[i]<0, F[i]=0), i=1..nops(F))))]; # The domain of res
solve(res) assuming `or`(seq(x in R[i],i=1..nops(R)));

 

 

@Kitonum 

Yes I know. But you are assuming one is sitting on the screen and looking at the output and seeing the expression. This is all done in code. The function gets an expression in x, and wants to know domain of x which makes it zero. assumption is only that x is real.

I could add code to check for ln, but again, this goes down in spiral very quickly where now it has to check for all sort of differenent functions and cases. Which is what I do now.  Sometimes it works on one expression and sometimes not work on another, since the result of odetest, when it is not zero, could be anything.

I should make a call to Mathematica's Reduce from Maple. I actually wrote a function to do that. It can call Mathematica from Maple and gets back the result, translates it to Maple syntax using Maple's FromMma and use the result.  Only problem is that it is a little slow since it has to call system(), starts a Mathematica process, each time for each one call. The expression from Maple to Mathematica is send as Latex. Since Mathematica can convert Latex to Mathematica expression and use it. It works, but not very reliable method of communication. One day I should wrote a note about this showing how it works.

 

 

@Kitonum 

But I do not know before hand for what possible values of x the result is zero.  That is the whole point of my question. 

I need Maple to tell me that. The assumption x>0 worked in this example. But might not work for other cases. Below is an example where it does not work

Currently actually I try this also myself, but it is a hit and miss.  I trt x>0 and x<0 and so on, until I get solution.

I need Maple to tell me the domain of x which an expression is zero. The only assumption is that x is real.

Example where x>0 assumption do not work

restart;
ode :=diff(y(x),x)=2*(x*sqrt(y(x))-1)*y(x):
ic  :=y(0)=1:
sol :=dsolve([ode,ic]):
res :=odetest(sol,ode);
solve(simplify(res)) assuming x>0

No solution.

But solve(simplify(res)) assuming real works here.

That is what I mean by hit and miss. 

@Kitonum 

"The output of the second example seems to me incorrect:"

I do not see anything wrong with the answer given by Maple. The ode is y(x)+y'(x)=0 and solving for y(x) gives y(x)=-y'(x). Why is this wrong? 

I do not understand at all what is the point of applying the  solve  command to a differential equation

Ok, this is a separate issue really. But I will happy to try to explain why the program does this.

Some ode's have the form of y(x)=f(x,y'(x)).  For example, the Clairaut or d’Alembert (Lagrange) ODE's can be recognized when in this form. An example of  the Clairaut ODE is x*y'(x)-y(x)*y'(x)=1 but to detect if it is Clairaut, the program solves for y(x) and checks if the solution is of the form x*y'(x)+f(y'(x)).  If it is, then it calls the Clairaut ode solver.

https://en.wikipedia.org/wiki/D%27Alembert%27s_equation

An example of d’Alembert ode is (y'(x))^2-1-x-y(x)=0 . To detect it is d’Alembert the program solves for y(x) and checks if the solution of the form x*g(y'(x))+f(y'(x)) where f,g are functions of y'(x). If it is, it calls the d’Alembert ode solver.

This is the reason why the program needs to solve for y(x), as part of determining the type of ODE. 

So it first converts the ODE to D, using the convert() command, before calling solve(), since solve does not work on equation that has both diff(y(x),x) and y(x) in it, but it works after conversion to D.

 

 

First 42 43 44 45 46 47 48 Last Page 44 of 91