Subject: finding out if expr has the form F(y/x^a)
From: Richard Hennessy
Date: Sun, 16 Dec 2012 17:25:36 -0500
Hi Barton,
I think this is too hard to fix programmatically, so I figured out the answer by using pw.mac and it?s functions using inspection of several cases. Some of the output is suppressed since it is too complex and looking at it does not add value. I did not have to change pdecheck1() and I already posted it. This is just an interesting way to do it, maybe it is wrong. I think a is suppose to be a constant, not a function of y. Anyway here goes.
load(pw)$
load(pdiff);
(%i28) display2d:false;
(out28) false
(%i29) pdecheck1(simp_given( (y*(x^2*abs(y)-x^2*y))/x, y>0),x,y);
(out29) [a = %r,'f(x) = 0,'u(x,y) = 0]
(%i30) pdecheck1(simp_given( (y*(x^2*abs(y)-x^2*y))/x, y<0),x,y);
(out30) [a = -2,'f(x) = -2*x,'u(x,y) = -2*x*y^2]
(%i31) pdecheck1(simp_given( (y*(x^2*abs(y)-x^2*y))/x, equal(y,0)),x,y);
(out31) [a = -2,'f(x) = -x,'u(x,y) = -x*y^2]
(%i32) f(x):=iif(y>0,0,iif(y<0,-2*x,-x)); /* by inspection */
(out32) f(x):=iif(y > 0,0,iif(y < 0,(-2)*x,-x))
(%i33) f(x):=''(iif2sum(f(x)))$
(%i34) u(x,y):=iif(y>0,0,iif(y<0,-2*x*y^2,-x*y^2)); /* by inspection */
(out34) u(x,y):=iif(y > 0,0,iif(y < 0,(-2)*x*y^2,(-x)*y^2))
(%i35) u(x,y):=''(iif2sum(u(x,y)))$
(%i36) a:iif(y>0,%r,-2); /* by inspection */
(out36) iif(y > 0,%r,-2)
(%i37) a:iif2sum(a)$
(%i38) pde:a*y*diff(u(x,y),y)+x*diff(u(x,y),x)=(a-1)*u(x,y)$
(%i39) pwsimp(pwsimp(lhs(%)-rhs(%),x),y);
(out39) 0
Rich (author of pw)
From: Barton Willis
Sent: Sunday, December 16, 2012 7:51 AM
To: Aleksas Domarkas ; maxima
Subject: Re: [Maxima] finding out if expr has the form F(y/x^a)
> (%i1) check1(g,x,y):=block([eq,sol,_a],
> eq:_a*y*diff(u(x,y),y)+x*diff(u(x,y),x)=(_a-1)*u(x,y),
> subst(u(x,y)=g,eq), ev(%%,nouns),
> sol:radcan(solve(%%,_a)),
> if sol=all then sol:[a=%r],
> if not freeof (x,y, sol) then return(false),
>[g='f(y/x^a)*y/x,a=rhs(sol[1]),f(x)=radcan(subst([y=x^(_a+1),sol[1]],g*x/y))])$
If u is defined to be a global function, this code will misbehave. Also, if the input g involves a
symbolic function, I think this code will also fail; for example
(%i3) check1(Q(y/x)*(y/x),x,y);
(%o3) false
The code posted a few days ago by Daniel Rupistraliz Avez handled this case OK. And a minor quibble: you need
to declare sol to be local, otherwise sol[1] will first check if sol is a global array. All you need to do is
block([eq,sol,_a], local(sol), ...)
Finally, you might enjoy testing your code on
(%i16) subst(z = y*x^2, (y/x) * (abs(z)-z));
(%o16) (y*(x^2*abs(y)-x^2*y))/x
and determine why check1 fails. Fixing this (and related problems isn't easy, I think).
--Barton
--------------------------------------------------------------------------------
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima