Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

The removal of evalf in my previous comment could be replaced by the version below, which seems to take care of the title problem.

The first change to `plots/animate` is the same as before.

`plots/animate`:=subs(subs=((x,y)->eval(y,x)),eval(`plots/animate`)):
`plots/animate`:=subs(evalf=(proc(x::uneval) local a;a:=[eval(x)];if _npassed>1 then evalf(a[1],_rest) else op(a) end if;end proc), eval(`plots/animate`)):
`plots/animate`:=subs(numeric=realcons,eval(`plots/animate`)):


Preben Alsholm

The removal of evalf in my previous comment could be replaced by the version below, which seems to take care of the title problem.

The first change to `plots/animate` is the same as before.

`plots/animate`:=subs(subs=((x,y)->eval(y,x)),eval(`plots/animate`)):
`plots/animate`:=subs(evalf=(proc(x::uneval) local a;a:=[eval(x)];if _npassed>1 then evalf(a[1],_rest) else op(a) end if;end proc), eval(`plots/animate`)):
`plots/animate`:=subs(numeric=realcons,eval(`plots/animate`)):


Preben Alsholm

@Preben Alsholm 

Besides finding 'a' in Alec Mihailov's original post you can find the value of the sum b by using the exact values of sums that are related:

b:=Sum(ln(n)/n/(n-1),n=2..infinity);
                              infinity         
                               -----           
                                \              
                                 )      ln(n)  
                                /     ---------
                               -----  n (n - 1)
                               n = 2           
c2:=Sum(ln(n)/n^2,n=2..infinity);
                                infinity     
                                 -----       
                                  \          
                                   )    ln(n)
                                  /     -----
                                 -----    2  
                                 n = 2   n   
c3:=Sum(ln(n)/n^3,n=2..infinity);
                                infinity     
                                 -----       
                                  \          
                                   )    ln(n)
                                  /     -----
                                 -----    3  
                                 n = 2   n   
b0:=factor(combine(b-c2-c3));
                             infinity          
                              -----            
                               \               
                                )      ln(n)   
                               /     ----------
                              -----   3        
                              n = 2  n  (n - 1)
evalf(b0+value(c2+c3));
                                 1.257746887

Preben Alsholm

Yes, that bug is old. I told Maple about it a long time ago, on October 10 2007.

The answer I got was:

"We have entered this issue into our internal bug-tracker. Thank you for bringing this to our attention."

The Maple version then must have been Maple 11. But nothing changed in Maple 12 or 13.

I still (!) don't have Maple 14.

The remedy I use, and which I also suggested at the time, is to replace the occurrences of subs with eval.

I have used the following redefinition with success and seemingly with no bad side effects:

`plots/animate`:=subs(subs=((x,y)->eval(y,x)),eval(`plots/animate`)):

Preben Alsholm

Yes, that bug is old. I told Maple about it a long time ago, on October 10 2007.

The answer I got was:

"We have entered this issue into our internal bug-tracker. Thank you for bringing this to our attention."

The Maple version then must have been Maple 11. But nothing changed in Maple 12 or 13.

I still (!) don't have Maple 14.

The remedy I use, and which I also suggested at the time, is to replace the occurrences of subs with eval.

I have used the following redefinition with success and seemingly with no bad side effects:

`plots/animate`:=subs(subs=((x,y)->eval(y,x)),eval(`plots/animate`)):

Preben Alsholm

Sum(ln(1+1/n)/n,n=1..N) = Sum(ln(n)/n/(n-1),n=2..N+1)+ln(N+1)/(N+1);

so the two infinite series have the same sum. Convergence follows by comparison to Sum(ln(n)/n^2,n=2..infinity), which is seen to be convergent by using e.g. the integral test.

 

Preben Alsholm

I guess it is related to the fact that `evalf/Sum` (in Maple 13) cannot handle this simpler one either:

Sum(ln(n)/n^2,n=2..infinity);

In this case though, sum can find an expression for the sum,  -Zeta(1, 2) , and that is known to evalf.

Also evalf(Sum(ln(n)/n^3,n=2..infinity)) fails, but evalf(Sum(ln(n)/n^4,n=2..infinity)) is OK.

Preben Alsholm

 

Just to keep you updated:

Maple 14 has not yet arrived. I guess Denmark is far away, at least on the priority list. The company handling the distribution is called Adept Scientific. Maybe they should consider changing their name to, .. well, you guessed it.

Preben Alsholm

You may try these two approaches.

restart;
eq:=diff(q(t), t) =piecewise(t<T,3-3*q(t)/10^4, -3*q(t)/10^4);
#Version 1
p1:=dsolve({eq, q(0)=0}, numeric, parameters=[T],range=0..2*T):
p1(parameters=[4380]):
plots[odeplot](p1,0..16000,refine=1);

#Version 2

EQ:=unapply(eq,T);
DEtools[DEplot](EQ(4380),q(t),t=0..16000,[q(0)=0],linecolor=blue,color=gray);

#Animations. The second first.
plots[animate](DEtools[DEplot],[EQ(T),q(t),t=0..16000,q=0..10000,[q(0)=0],linecolor=blue,color=gray,stepsize=50],T=2000..8000);

#Now the first version.
#Make a small procedure, so that the parameter can be set.
PP:=proc(T1) p1(parameters=[T1]); plots[odeplot](p1,0..16000,refine=1) end proc;
plots[animate](PP,[T1],T1=2000..8000);

As far as sliders etc, you may look into Components in the panel to the left in Standard Maple.

Preben Alsholm

You may try these two approaches.

restart;
eq:=diff(q(t), t) =piecewise(t<T,3-3*q(t)/10^4, -3*q(t)/10^4);
#Version 1
p1:=dsolve({eq, q(0)=0}, numeric, parameters=[T],range=0..2*T):
p1(parameters=[4380]):
plots[odeplot](p1,0..16000,refine=1);

#Version 2

EQ:=unapply(eq,T);
DEtools[DEplot](EQ(4380),q(t),t=0..16000,[q(0)=0],linecolor=blue,color=gray);

#Animations. The second first.
plots[animate](DEtools[DEplot],[EQ(T),q(t),t=0..16000,q=0..10000,[q(0)=0],linecolor=blue,color=gray,stepsize=50],T=2000..8000);

#Now the first version.
#Make a small procedure, so that the parameter can be set.
PP:=proc(T1) p1(parameters=[T1]); plots[odeplot](p1,0..16000,refine=1) end proc;
plots[animate](PP,[T1],T1=2000..8000);

As far as sliders etc, you may look into Components in the panel to the left in Standard Maple.

Preben Alsholm

The tilde is superfluous as it is designed for elementwise operations on containers, i.e. sets, lists Vectors, Matrices, Arrays, and tables, and has no effect on other types, in this case `+`.

Preben Alsholm

 

The tilde is superfluous as it is designed for elementwise operations on containers, i.e. sets, lists Vectors, Matrices, Arrays, and tables, and has no effect on other types, in this case `+`.

Preben Alsholm

 

Well, it seems to be correct in Maple 13.02.

Preben Alsholm

Since you don't have a more recent version of Maple (I guessed you use Maple 5.1 from your worksheet), allow me to reproduce from the help pages in Maple 13:

'range'= numeric...numeric
Values that specify the range of the independent variable over which solution values are desired.
For IVPs and DAEs this option is used only by the non-stiff and stiff default methods (rkf45, rosenbrock, rkf45_dae, rosenbrock_dae) and the taylorseries method. It has two purposes for procedure-type output. If 'range' is used, then the call to dsolve computes the solution over the desired range before returning, storing that solution for later calls to the returned procedure, which then compute the return values through interpolation.
 

and about maxfun (cut short)

The option maxfun=n in the call to dsolve,numeric gives an upper limit on the total number of function evaluations.
For the rkf45 and rosenbrock methods, the default setting is maxfun=30000, while for the classical methods, the default setting is maxfun=50000.
A setting of maxfun=0 disables the option.

Preben Alsholm

Since you don't have a more recent version of Maple (I guessed you use Maple 5.1 from your worksheet), allow me to reproduce from the help pages in Maple 13:

'range'= numeric...numeric
Values that specify the range of the independent variable over which solution values are desired.
For IVPs and DAEs this option is used only by the non-stiff and stiff default methods (rkf45, rosenbrock, rkf45_dae, rosenbrock_dae) and the taylorseries method. It has two purposes for procedure-type output. If 'range' is used, then the call to dsolve computes the solution over the desired range before returning, storing that solution for later calls to the returned procedure, which then compute the return values through interpolation.
 

and about maxfun (cut short)

The option maxfun=n in the call to dsolve,numeric gives an upper limit on the total number of function evaluations.
For the rkf45 and rosenbrock methods, the default setting is maxfun=30000, while for the classical methods, the default setting is maxfun=50000.
A setting of maxfun=0 disables the option.

Preben Alsholm

First 215 216 217 218 219 220 221 Page 217 of 223