Subject: finding out if expr has the form F(y/x^a)
From: Richard Hennessy
Date: Sun, 16 Dec 2012 21:36:05 -0500
?Case u(x,y)=(y*(x^2*abs(y)-x^2*y))/x, y>0.?
Hi Aleksas and Barton:
You might find pw.mac useful in this case. It rarely is. I added some code to check2() to make it work for the abs() function and friends. I took the liberty of giving different names to the variables to avoid most collision errors where a user variable is already defined to a value that your function doesn?t need or desire. It can avoid a crash. You have to load abs_integrate.mac and pw.mac for it to work. You can also just use load(pw) since it loads abs_integrate.mac for you. pw.mac is available from sourceforge.net. You can Google ?pw.mac Maxima? and it will come up.
load(pw)$
load(pdiff)$
check3(__g,__x,__y):=block
(
[_eq,_sol,_a],
local(_sol,_eq),
_eq:_a*__y*diff(u(__x,__y),__y)+__x*diff(u(__x,__y),__x)=(_a-1)*u(__x,__y),
_eq:signum2abs(simpsignum(abs2signum(convert_to_diff(_eq)))),
subst(u(__x,__y)=__g,_eq),
ev(%%,nouns),
_sol:signum2abs(simpsignum(abs2signum(radcan(solve(%%,_a))))),
if _sol=all then _sol:[a=%r],
if not freeof (__x,__y, _sol) then
return(false),
['a=signum2abs(simpsignum(abs2signum(rhs(_sol[1])))),'f(x)=signum2abs(simpsignum(abs2signum(radcan(subst([__y=__x^(_a+1),_sol[1]],__g*__x/__y))))),
'u(__x,__y)=__y/__x*at(signum2abs(simpsignum(abs2signum(radcan(subst([__y=__x^(_a+1),_sol[1]],__g*__x/__y))))),__x=__y/__x^signum2abs(simpsignum(abs2signum(rhs(_sol[1])))))]
)$
(%i2) display2d:false;
(out2) false
(%i3) u(x,y)=(y*(x^2*abs(y)-x^2*y))/x;
(out3) u(x,y) = y*(x^2*abs(y)-x^2*y)/x
(%i4) check3(rhs(%),x,y);
(out4) [a = -2,'f(x) = abs(x)-x,'u(x,y) = y*(x^2*abs(y)-x^2*y)/x]
(%i5)
From: Aleksas Domarkas
Sent: Sunday, December 16, 2012 9:56 AM
To: maxima
Subject: finding out if expr has the form F(y/x^a)
Answer to Barton comment
http://www.math.utexas.edu/pipermail/maxima/2012/031150.html
Thank Barton for your comments.
I updated check1 to check2.
Now case u(x,y)=Q(y/x)*(y/x) included.
Maxima by default do not know chain rule for derivative of composite function y=f(g(x)):
(%i1) diff(f(g(x)),x);
(%o1) 'diff(f(g(x)),x,1)
For this we use package pdiff. In maxima help I did not find documentation for this package.
(%i2) load(pdiff)$
(%i3) diff(f(g(x)),x);
(%o3) g[(1)](x)*f[(1)](g(x))
(%i4) convert_to_diff(%);
(%o4) ('diff(g(x),x,1))*(at('diff(f(g34113),g34113,1),[g34113=g(x)]))
(%i5) check2(g,x,y):=block([eq,sol,_a],local(sol,eq),
eq:_a*y*diff(u(x,y),y)+x*diff(u(x,y),x)=(_a-1)*u(x,y),
eq:convert_to_diff(eq),
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))])$
(%i6) check2(Q(y/x)*(y/x),x,y);
(%o6) [(y*Q(y/x))/x=(y*f(y/x^a))/x,a=1,f(x)=Q(x)]
Case u(x,y)=(y*(x^2*abs(y)-x^2*y))/x, y>0.
(%i7) assume(y>0);
(%o7) [y>0]
(%i8) (y*(x^2*abs(y)-x^2*y))/x;
(%o8) 0
Then u(x,y)=0.
(%i9) check2((y*(x^2*abs(y)-x^2*y))/x,x,y);
(%o9) [0=(y*f(y/x^a))/x,a=%r,f(x)=0]
Case u(x,y)=(y*(x^2*abs(y)-x^2*y))/x, y<0.
(%i10) forget(y>0)$ assume(y<0)$
(%i12) (y*(x^2*abs(y)-x^2*y))/x;
(%o12) -2*x*y^2
Then u(x,y)=-2*x*y^2.
(%i13) check2((y*(x^2*abs(y)-x^2*y))/x,x,y);
(%o13) [-2*x*y^2=(y*f(y/x^a))/x,a=-2,f(x)=-2*x]
best
Aleksas
--------------------------------------------------------------------------------
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima