nm

11353 Reputation

20 Badges

13 years, 20 days

MaplePrimes Activity


These are questions asked by nm

This is may be a philosophical question. But sometimes Maple suprises me when telling it to "simplify" expression. As in this example.

expr:=1/(y^3+1)^(2/3);

1/(y^3+1)^(2/3)

int(expr,y)

y*hypergeom([1/3, 2/3], [4/3], -y^3)

simplify(%)

(2/9)*y*Pi*3^(1/2)*LegendreP(-1/3, -1/3, (-y^3+1)/(y^3+1))/((-y^3)^(1/6)*(y^3+1)^(1/3)*GAMMA(2/3))

 


For me, the original result is "simpler". (Not only smaller leaf count, but it has one special function, vs. two: Legendre and Gamma). But may be Maple considers hypergeom always more "complex" than any other?

That is why I use simplify(expr,size) because I am scared of simplify without any option, as I have little idea how it decides which is simpler.

Any thoughts from the experts on how Maple decided to simplify something when no option is used? What kinds of rules it uses to decide how to transform the expression?

Maple 2019.1

 

Download simplify.mw

I am not able to understand why this ODE is quadrature. It is first order ODE of second degree. Solving for y'(x) gives two ODE's. Only one of these two ODE's is quadrature and the second is Abel.

So  why and how did odesdvisor come to conclusion that it is  quadrature? Did it pick the first ODE that comes from solving for y'(x)?

Note that from help, quadrature is ODE (for first order) is one which
the ODE is of first order and the right hand sides below depend only on x or y(x)

And the above definition only applied here for one of the 2 ODE's embeded inside this first order ODE of second degree. So I am just trying to understand the logic behind this result of odeadvisor

ode:= (x^2-a*y(x))*diff(y(x),x)^2-2*x*y(x)*diff(y(x),x) = 0;

(x^2-a*y(x))*(diff(y(x), x))^2-2*x*y(x)*(diff(y(x), x)) = 0

DEtools:-odeadvisor(ode);

[_quadrature]

odes:=[solve(ode,diff(y(x),x))]; #solve for y' we get 2 first order ODE's

[0, -2*x*y(x)/(a*y(x)-x^2)]

DEtools:-odeadvisor(diff(y(x),x)=odes[1]); #find type of first one

[_quadrature]

DEtools:-odeadvisor(diff(y(x),x)=odes[2]); #find type of second one

[[_homogeneous, `class G`], _rational, [_Abel, `2nd type`, `class A`]]


Download why_only_quadrature.mw

btw, the above is just one example. I have many more. below show one more such example

#example 2

ode:=diff(y(x),x)^3-(2*x+y(x)^2)*diff(y(x),x)^2+(x^2-y(x)^2+2*x*y(x)^2)*diff(y(x),x)-(x^2-y(x)^2)*y(x)^2 = 0;

(diff(y(x), x))^3-(2*x+y(x)^2)*(diff(y(x), x))^2+(x^2-y(x)^2+2*x*y(x)^2)*(diff(y(x), x))-(x^2-y(x)^2)*y(x)^2 = 0

DEtools:-odeadvisor(ode);

[_quadrature]

odes:=[solve(ode,diff(y(x),x))]; #solve for y' we get 3 first order ODE's

[y(x)^2, x+y(x), x-y(x)]

DEtools:-odeadvisor(diff(y(x),x)=odes[1]); #find type of first one

[_quadrature]

DEtools:-odeadvisor(diff(y(x),x)=odes[2]); #find type of second one

[[_linear, `class A`]]

DEtools:-odeadvisor(diff(y(x),x)=odes[3]); #find type of third one

[[_linear, `class A`]]

 

 

Download why_only_quadrature_2.mw

Maple 2019.1

 

I gave up. Spend 40 minutes trying everything and can't figure the right syntax. 

I need to use indets to obtain all occurrences of specific function in expression. Such as sin() or cos() or ln(), etc...

The indets commands has the form indets(expression, type).

But what is the type of ln ? It is of function type. But this picks up all other functions in the expression. I tried specfun and could not make it work. For example

expr:=x+sin(x)+ln(y)+10+ln(x+y)^2;

I want  to obtain  {ln(y),ln(x+y)^2}

I tried

indets(expr,function); 
indets(expr,specfun(ln));

and many more. Since indets needs a name of a type in the second argument, then what is the type name for ln or sin or cos, etc... I can't use indential, it did not work, since it is not a symbol I am looking for. I could use patmatch, but I am trying to learn indets for all these things.

Do I need to use subsindets for this? I still do not know how to use subsindets.

Maple 2019.1

I like using Record in Maple. It allows me to collect related variables to pass around inside one object. (Like with Pascal or Ada records or C struct).

But I find myself copying the record definition over and over everywhere I want to use the same specific record layout.

Is there a way to define specific record layout somewhere, may be as a type and give it a name, and then in each proc I want to make a variable of this record type, just tell Maple that this variable is a record of that type so I do not have to explicity define the record there each time? 

Here is a simple example to make it more clear

foo:=proc() #some proc that uses same Record layout
   local S;
   S:=Record('name','age');   
   S:-name:="joe doe 1";
   S:-age:=99;
   return S;
end proc:

boo:=proc() #another proc that wants to use same Record layout
   local S;
   S:=Record('name','age');   
   S:-name:="joe doe 2";
   S:-age:=80;
   return S;
end proc:

S1:=foo();
S2:=boo();

These proc's can be anywhere, such as inside package or module, either local or exported.

I just want to avoid having to type   S:=Record('name','age');   Each time. I want to tell Maple that a local variable is of this specific Record layout, without having to type the layout explicitly.

This way, when I add new field to this Record,  I just have to do it in one place and not in 10 places in the code. 

I think I need to add a new type? But do not know how to do this.  I hope the question is clear. If not, will add more information.

 

This ODE turns out to be a simple separable ODE. With one solution, if the ODE is rewritten.

But in its original form, Maple dsolve gives 6 complicated looking solutions with complex numbers in some of them. Even though all 6 solutions are valid.

Any one knows why Maple did that and not give the one simple solution instead? 

I used isolate to solve for y' from the original ODE. Verfiied that only one solution exist.  The ODE then became y'(x)= 3*y(x)/(2*x). Which by uniqueness theorem, should have one unique solution in some region in the RHS or in some region in the LHS that does not inculde x=0 ?

Just wondering what is going on, and why Maple did not give same simpler solution, so I can learn something new. That is all.

restart;

Typesetting:-Settings(typesetprime=true):

ode:= 1/2*(2*x^(5/2)-3*y(x)^(5/3))/x^(5/2)/y(x)^(2/3)+1/3*(-2*x^(5/2)+3*y(x)^(5/3))*diff(y(x),x)/x^(3/2)/y(x)^(5/3) = 0;

(1/2)*(2*x^(5/2)-3*y(x)^(5/3))/(x^(5/2)*y(x)^(2/3))+(1/3)*(-2*x^(5/2)+3*y(x)^(5/3))*(diff(y(x), x))/(x^(3/2)*y(x)^(5/3)) = 0

DEtools:-odeadvisor(ode);

[[_1st_order, _with_linear_symmetries], _exact, _rational]

maple_sol:=dsolve(ode);

y(x) = (1/3)*2^(3/5)*3^(2/5)*(x^(5/2))^(3/5), y(x) = (1/3)*(-(1/4)*5^(1/2)-1/4-((1/4)*I)*2^(1/2)*(5-5^(1/2))^(1/2))^3*2^(3/5)*3^(2/5)*(x^(5/2))^(3/5), y(x) = (1/3)*(-(1/4)*5^(1/2)-1/4+((1/4)*I)*2^(1/2)*(5-5^(1/2))^(1/2))^3*2^(3/5)*3^(2/5)*(x^(5/2))^(3/5), y(x) = (1/3)*((1/4)*5^(1/2)-1/4-((1/4)*I)*2^(1/2)*(5+5^(1/2))^(1/2))^3*2^(3/5)*3^(2/5)*(x^(5/2))^(3/5), y(x) = (1/3)*((1/4)*5^(1/2)-1/4+((1/4)*I)*2^(1/2)*(5+5^(1/2))^(1/2))^3*2^(3/5)*3^(2/5)*(x^(5/2))^(3/5), x/y(x)^(2/3)+y(x)/x^(3/2)+_C1 = 0

map(x->odetest(x,ode),[maple_sol])

[0, 0, 0, 0, 0, 0]

solve(ode,diff(y(x),x),AllSolutions)

(3/2)*y(x)/x

ode2:=isolate(ode,diff(y(x),x)); #solve for y' first

diff(y(x), x) = -(3/2)*(2*x^(5/2)-3*y(x)^(5/3))*y(x)/(x*(-2*x^(5/2)+3*y(x)^(5/3)))

ode2:=simplify(ode2)

diff(y(x), x) = (3/2)*y(x)/x

DEtools:-odeadvisor(ode2);

[_separable]

sol:=dsolve(ode2)

y(x) = _C1*x^(3/2)

odetest(sol,ode2)

0

 

Download strange_ode_answer.mw

Maple 2019.1

Physics 395

First 136 137 138 139 140 141 142 Last Page 138 of 199