Preben Alsholm

13728 Reputation

22 Badges

20 years, 247 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

You are right. One of my equations was wrong.

My system should have been

sys:={diff(y(t),t)=a*y(t)*x(t)^(3/2)-b*y(t)^(3/4),diff(x(t),t)=x(t)^2*(c*y(t)^(7/4)-d*sqrt(x(t)))};

The rewriting as a system is of course not uniquely given from dy/dx = g(x,y)/f(x,y) since we also have

dy/dx = g(x,y)*h(x,y)/(f(x,y)*h(x,y)).

 

You are right. One of my equations was wrong.

My system should have been

sys:={diff(y(t),t)=a*y(t)*x(t)^(3/2)-b*y(t)^(3/4),diff(x(t),t)=x(t)^2*(c*y(t)^(7/4)-d*sqrt(x(t)))};

The rewriting as a system is of course not uniquely given from dy/dx = g(x,y)/f(x,y) since we also have

dy/dx = g(x,y)*h(x,y)/(f(x,y)*h(x,y)).

 

Your problem is that x in F and G is not seen by the procedures f and g till it is too late.

A minimal change scenario:

F := sin(x);

G := cos(x);

f := proc (x1) options operator, arrow; eval(F,x=x1) end proc;

g := proc (x1) options operator, arrow; eval(G,x=x1) end proc;

h := proc (x) options operator, arrow; f(g(x)) end proc;

h(x);

@kms

Something like this:
eqn1 := u = V*cos(a)*cos(b);
eqn2 := v = V*sin(b);
eqn3 := w = V*sin(a)*cos(b);
res:=solve({eqn1,eqn2,eqn3},{V,a,b});
map(tan,res[2]);
map(x->x^2,res[1]);
simplify(%);
map(sin,res[3]);
simplify(%);

@kms

Something like this:
eqn1 := u = V*cos(a)*cos(b);
eqn2 := v = V*sin(b);
eqn3 := w = V*sin(a)*cos(b);
res:=solve({eqn1,eqn2,eqn3},{V,a,b});
map(tan,res[2]);
map(x->x^2,res[1]);
simplify(%);
map(sin,res[3]);
simplify(%);

@mois Acer's second objection seems relevant especially when using procedures not made by the user as in the following simple example,

Search(sin,[y>=1,y<=2]);
Search(sin,[x>=1,x<=2]);

The reason the latter works and not the former is because x is the name of the formal parameter used by Maple's sin procedure according to

op(1,eval(sin));

I have made a habit of telling my students that the function x - > x^2 is exactly the same as the function y - > y^2.

The variables option is a solution:

Search(sin,[y>=1,y<=2],variables=[y]);

But obviously in this case you could just do

Search(sin(y),[y>=1,y<=2]);

@Wang Gaoteng I think Robert means 4*arctan(x) - 4*x/(1+x^2) (the original expression), when he talks of the numerical difficulties.

To find the order of the zero at x = 0 you can use taylor:

taylor(4*arctan(x) - 4*x/(1+x^2),x=0);

which results in (8/3)*x^3-(16/5)*x^5+O(x^6).

NextZero has problems in this case, fsolve does not.

That x = 0 is the only zero follows from the result of an integration by parts using that arctan(x) = Int(1/(1+t^2),t=0..x):

IntegrationTools:-Parts(Int(1/(1+t^2),t=0..x),1/(1+t^2)):  
map(simplify,%);

with result x/(1+x^2)+2*(Int(t^2/(1+t^2)^2, t = 0 .. x))

The last term is positive for x > 0. Thus u(x) = 4*arctan(x) - 4*x/(1+x^2) > 0 for x > 0.

Since u is odd, we get u(x) < 0 for x <0.

@Wang Gaoteng I think Robert means 4*arctan(x) - 4*x/(1+x^2) (the original expression), when he talks of the numerical difficulties.

To find the order of the zero at x = 0 you can use taylor:

taylor(4*arctan(x) - 4*x/(1+x^2),x=0);

which results in (8/3)*x^3-(16/5)*x^5+O(x^6).

NextZero has problems in this case, fsolve does not.

That x = 0 is the only zero follows from the result of an integration by parts using that arctan(x) = Int(1/(1+t^2),t=0..x):

IntegrationTools:-Parts(Int(1/(1+t^2),t=0..x),1/(1+t^2)):  
map(simplify,%);

with result x/(1+x^2)+2*(Int(t^2/(1+t^2)^2, t = 0 .. x))

The last term is positive for x > 0. Thus u(x) = 4*arctan(x) - 4*x/(1+x^2) > 0 for x > 0.

Since u is odd, we get u(x) < 0 for x <0.

Thank you Robert, for catching my mistake of equating points computed with points plotted in DEplot.

Thank you Robert, for catching my mistake of equating points computed with points plotted in DEplot.

As always it is best to present the actual problem concretely. If necessary (because of size) by uploading a worksheet.

Your huge example about radnormal (bug 3) can be reduced quite a lot in size:

Z:=-(2*(-4*q23^2*v*q12+4*q23^2*v^3*q12-8*q13^2*q12*v+8*q13^2*v^3*q12+4*q23^2*v*q12*lambda^2-4*q23^2*v^3*q12*lambda^2+8*q13^2*q12*v*lambda^2-8*q13^2*v^3*q12*lambda^2+4*sqrt(1-lambda^2)*q13*q12^2*v^2*lambda^2-2*sqrt(1-lambda^2)*q13*q12^2*v^4*lambda^2+8*q13^3*v^2*sqrt(1-lambda^2)+2*sqrt(1-lambda^2)*q13*q12^2-4*sqrt(1-lambda^2)*q13*q12^2*v^2+2*sqrt(1-lambda^2)*q13*q12^2*v^4+8*q23^2*v^2*q13*sqrt(1-lambda^2)-2*sqrt(1-lambda^2)*q13*q12^2*lambda^2))/((q12-q12*lambda^2-q12*v^2+q12*v^2*lambda^2-2*sqrt(1-lambda^2)*q13*v)*(sqrt(1-lambda^2)*q12-sqrt(1-lambda^2)*q12*v^2-2*q13*v));

radnormal(Z);
Error, (in F) invalid subscript selector

 

Added comment: I don't know what is going on, but the following (strange) workaround works on your example as well as on my short one:

radnormal(eval(Z,3=t)):
Z3:=radnormal(eval(%,t=3)):

#4 is OK too:

radnormal(eval(Z,4=t)):
Z4:=radnormal(eval(%,t=4)):
evalb(Z3=Z4);
                              true

@hirnyk There were spaces after `if` and after seq. In 2d-input they were interpreted as multiplication. In 1d-input they are ignored.

I always use worksheet interface with 1d-input, so don't have a problem. But I suppose that if you create a regular input line in document mode (e.g. by doing crtl j) and make sure you use 1d-input (crtl m) on that line then hopefully everything should be OK. 

@hirnyk There were spaces after `if` and after seq. In 2d-input they were interpreted as multiplication. In 1d-input they are ignored.

I always use worksheet interface with 1d-input, so don't have a problem. But I suppose that if you create a regular input line in document mode (e.g. by doing crtl j) and make sure you use 1d-input (crtl m) on that line then hopefully everything should be OK. 

@hirnyk Notice the * after `if` ( `if`*) and after seq (seq*).

If you just copy from Jean-Jacques' posting they ought not appear (and didn't in my case).

Ceterum censeo 2d-input esse delendam 

First 210 211 212 213 214 215 216 Last Page 212 of 230