Preben Alsholm

13728 Reputation

22 Badges

20 years, 251 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

Thanks!
After I posted the answer I got to think (my usual order of doing things). Why 10 when 1*3 + 3*2 = 9?

@Markiyan Hirnyk Yes I see that my integrand f was wrong.

Now the question is which was intended:

f:=1/sqrt(x^2+1)*ln(x^2+sqrt(x^2+1));

or

f:=1/sqrt(x^2+1)/ln(x^2+sqrt(x^2+1));

In the first case the same change of variables works. In the second it doesn't.
Unfortunately, I guess he meant the second.

@Markiyan Hirnyk Yes I see that my integrand f was wrong.

Now the question is which was intended:

f:=1/sqrt(x^2+1)*ln(x^2+sqrt(x^2+1));

or

f:=1/sqrt(x^2+1)/ln(x^2+sqrt(x^2+1));

In the first case the same change of variables works. In the second it doesn't.
Unfortunately, I guess he meant the second.

@adel-00 The problem of 3 real solutions for u as well as for v in a certain a-range must be dealt with.

Actually I think it is better to revert to using solve. So here is the whole thing from the start:

restart;
eq1:=(alpha+(l+alpha)*u+alpha*k*u^2)*a=
u*(alpha+(l+alpha)*u+alpha*k*u^2)*(1+l*alpha*b/((alpha+(l+alpha)*u+alpha*k*u^2)));
eq2:=a=(u*(1+l*v/(1+u+k*u^2)));
factor((rhs-lhs)(eq1));
eq1:=collect(%,u);
params:={l=1,alpha=1,b=100,k=50};
U:=[solve(eval(eq1,params),u)]: #3 solutions for u
plots:-complexplot(U,a=0..20,style=point); #plot in the complex u-plane
vua:=eval(solve(eq2,v),params); #v expressed in terms of u and a
V:=eval~(vua,u=~U): #the 3 solutions for v in terms of a
plots:-complexplot(V,a=0..20,style=point); #plot in the complex v-plane
#plot skips imaginary values of u, but notice 3 colors.
plot(U,a=0..20,labels=[a,u]);
## I'm assuming that this is what you were really after:
plot(V,a=0..20,labels=[a,v]);

There was a plotting problem in Maple 16.02, which may affect the plots above.
See the correction at
http://www.mapleprimes.com/questions/143131-DEPlot-Error-When-Plotting-Solution-Curve?submit=143189#comment143189

@adel-00 The problem of 3 real solutions for u as well as for v in a certain a-range must be dealt with.

Actually I think it is better to revert to using solve. So here is the whole thing from the start:

restart;
eq1:=(alpha+(l+alpha)*u+alpha*k*u^2)*a=
u*(alpha+(l+alpha)*u+alpha*k*u^2)*(1+l*alpha*b/((alpha+(l+alpha)*u+alpha*k*u^2)));
eq2:=a=(u*(1+l*v/(1+u+k*u^2)));
factor((rhs-lhs)(eq1));
eq1:=collect(%,u);
params:={l=1,alpha=1,b=100,k=50};
U:=[solve(eval(eq1,params),u)]: #3 solutions for u
plots:-complexplot(U,a=0..20,style=point); #plot in the complex u-plane
vua:=eval(solve(eq2,v),params); #v expressed in terms of u and a
V:=eval~(vua,u=~U): #the 3 solutions for v in terms of a
plots:-complexplot(V,a=0..20,style=point); #plot in the complex v-plane
#plot skips imaginary values of u, but notice 3 colors.
plot(U,a=0..20,labels=[a,u]);
## I'm assuming that this is what you were really after:
plot(V,a=0..20,labels=[a,v]);

There was a plotting problem in Maple 16.02, which may affect the plots above.
See the correction at
http://www.mapleprimes.com/questions/143131-DEPlot-Error-When-Plotting-Solution-Curve?submit=143189#comment143189

@adel-00 eq1 is a polynomial equation of degree 3. Maple gives 3 solutions when it realizes that fact and when they are real. That can complicate matters.
Here I find all three (complex) solutions for u and after that for v.

restart;
eq1:=(alpha+(l+alpha)*u+alpha*k*u^2)*a=
u*(alpha+(l+alpha)*u+alpha*k*u^2)*(1+l*alpha*b/((alpha+(l+alpha)*u+alpha*k*u^2)));
eq2:=a=(u*(1+l*v/(1+u+k*u^2)));
factor((rhs-lhs)(eq1));
eq1:=collect(%,u); #Now obiously a polynomial
params:={l=1,alpha=1,b=100,k=50};
#Finding 3 solutions for each a. I have made the increment in a 0.1 to see the changes more clearly.
cupoints:=[seq(fsolve(eval(eq1,params),u,complex),a=0..20,.1)]:
plots:-complexplot(cupoints,style=point);
#Making an animation:
Su:=seq(plots:-complexplot(cupoints[1..n],style=point,symbolsize=15),n=1..nops(cupoints)):
plots:-display(Su,insequence=true);
#Turning to the v-values (slightly repetitive):
cpoints:=[seq([[a,a,a],[fsolve(eval(eq1,params),u,complex)]],a=0..20,.1)]:
Vp:=eval(solve(eq2,v),params);
Sau:=[seq( zip~( (x,y)->[a=x,u=y],op(cpoints[i])),i=1..nops(cpoints))]:
cvpointsTemp:=ListTools:-Flatten([seq(eval~(Vp,Sau[i]),i=1..nops(cpoints))]):
#Removing disturbing Float(undefined):
cvpoints:=remove(type,cvpointsTemp,undefined):
plots:-complexplot(cvpoints,style=point);
#Animating the v-points
Sv:=seq(plots:-complexplot(cvpoints[1..n],style=point,symbolsize=15),n=1..nops(cvpoints)):
plots:-display(Sv,insequence=true);

Added: A simple graphical illustration showing when there are 1, 2, or 3 real solutions:

plots:-animate(plot,[(eval(eq1,params)),u=-1..7,-20..20],a=2.7..6.5);

@adel-00 eq1 is a polynomial equation of degree 3. Maple gives 3 solutions when it realizes that fact and when they are real. That can complicate matters.
Here I find all three (complex) solutions for u and after that for v.

restart;
eq1:=(alpha+(l+alpha)*u+alpha*k*u^2)*a=
u*(alpha+(l+alpha)*u+alpha*k*u^2)*(1+l*alpha*b/((alpha+(l+alpha)*u+alpha*k*u^2)));
eq2:=a=(u*(1+l*v/(1+u+k*u^2)));
factor((rhs-lhs)(eq1));
eq1:=collect(%,u); #Now obiously a polynomial
params:={l=1,alpha=1,b=100,k=50};
#Finding 3 solutions for each a. I have made the increment in a 0.1 to see the changes more clearly.
cupoints:=[seq(fsolve(eval(eq1,params),u,complex),a=0..20,.1)]:
plots:-complexplot(cupoints,style=point);
#Making an animation:
Su:=seq(plots:-complexplot(cupoints[1..n],style=point,symbolsize=15),n=1..nops(cupoints)):
plots:-display(Su,insequence=true);
#Turning to the v-values (slightly repetitive):
cpoints:=[seq([[a,a,a],[fsolve(eval(eq1,params),u,complex)]],a=0..20,.1)]:
Vp:=eval(solve(eq2,v),params);
Sau:=[seq( zip~( (x,y)->[a=x,u=y],op(cpoints[i])),i=1..nops(cpoints))]:
cvpointsTemp:=ListTools:-Flatten([seq(eval~(Vp,Sau[i]),i=1..nops(cpoints))]):
#Removing disturbing Float(undefined):
cvpoints:=remove(type,cvpointsTemp,undefined):
plots:-complexplot(cvpoints,style=point);
#Animating the v-points
Sv:=seq(plots:-complexplot(cvpoints[1..n],style=point,symbolsize=15),n=1..nops(cvpoints)):
plots:-display(Sv,insequence=true);

Added: A simple graphical illustration showing when there are 1, 2, or 3 real solutions:

plots:-animate(plot,[(eval(eq1,params)),u=-1..7,-20..20],a=2.7..6.5);

@adel-00 a=0 is a little special, so I left that out:

vpoints:=seq([a,subs(fsolve(eval({eq1,eq2},params),{u,v}),v)],a=1..20);
plot([vpoints]);
plot([vpoints],style=point);

# a = 0 is special because then the equations are satisfied if u = 0 and v is any number:

eval({eq1,eq2},params union {a=0,u=0});

#A slightly different approach:

V:=aa->subs(fsolve(eval({eq1,eq2},params union {a=aa}),{u,v}),v);
plot(V,0..20);

@adel-00 a=0 is a little special, so I left that out:

vpoints:=seq([a,subs(fsolve(eval({eq1,eq2},params),{u,v}),v)],a=1..20);
plot([vpoints]);
plot([vpoints],style=point);

# a = 0 is special because then the equations are satisfied if u = 0 and v is any number:

eval({eq1,eq2},params union {a=0,u=0});

#A slightly different approach:

V:=aa->subs(fsolve(eval({eq1,eq2},params union {a=aa}),{u,v}),v);
plot(V,0..20);

I tried this before I saw yours, but my version fails:

f:=proc(x,y) if not type([x,y],list(numeric)) then return 'procname(_passed)' end if;
      `if`(y>0,[x,4*y],[x,y])
end proc;

Edited: In the initial version of this comment I forgot 'return' . But the edited is the one intended and it doesn't work.

Edited once again: The version works if  _passed is replaced by x,y. Probably because _passed will be arguments passed to another procedure.

I tried this before I saw yours, but my version fails:

f:=proc(x,y) if not type([x,y],list(numeric)) then return 'procname(_passed)' end if;
      `if`(y>0,[x,4*y],[x,y])
end proc;

Edited: In the initial version of this comment I forgot 'return' . But the edited is the one intended and it doesn't work.

Edited once again: The version works if  _passed is replaced by x,y. Probably because _passed will be arguments passed to another procedure.

You say that you would like to find the analytic expression for that sum.

It may be that none such exists!

I haven't looked at this version, but have just answered your additional question in your previous posting. Please take a look at that.

@felixiao I made some changes. There were still some instances of F(tau), P(tau), Q(tau)  which needed to be replaced with F, P, Q, respectively. I replaced 'matrix' with 'Matrix' and `&*` with `.`. Also 'Inverse' was replaced with `^(-1)`.

MaplePrimes13-03-08.mw

@felixiao I made some changes. There were still some instances of F(tau), P(tau), Q(tau)  which needed to be replaced with F, P, Q, respectively. I replaced 'matrix' with 'Matrix' and `&*` with `.`. Also 'Inverse' was replaced with `^(-1)`.

MaplePrimes13-03-08.mw

First 177 178 179 180 181 182 183 Last Page 179 of 230