Preben Alsholm

13100 Reputation

22 Badges

18 years, 302 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

A minor modification (admittedly making the technique more complicated)  makes it possible to avoid determining the points of intersection:

plottools[transform]((x,y) -> [x,y + x + 5])(plot(min(x^2-x-5,0),x=-3..4,filled=true));

Your integrand is not only oscillating, it is oscillating wildly.

Even on a much smaller interval you will have problems.

This works though:

evalf(Int(sin(x^19),x=0..2,method = _d01akc,maxintervals=10000));
                         0.08028631940

See ?evalf,Int

Preben Alsholm

I don't know what you are trying to do, but I would start like this:

restart;
C:=Vector(3):
A := evalf(Matrix([[2, -1, sqrt(2)], [3, 2, -3], [3, sqrt(2), -15/7]]));
B := evalf(<5+7*sqrt(2), -24, -12-3*sqrt(2)>);
N := 3: t := 1e-6:
P := evalf((1/2)*sqrt(t*N)):

You don't need the packages linalg and student, and they are superseded anyway by the LinearAlgebra and the Student packages.

Preben Alsholm

I don't know what you are trying to do, but I would start like this:

restart;
C:=Vector(3):
A := evalf(Matrix([[2, -1, sqrt(2)], [3, 2, -3], [3, sqrt(2), -15/7]]));
B := evalf(<5+7*sqrt(2), -24, -12-3*sqrt(2)>);
N := 3: t := 1e-6:
P := evalf((1/2)*sqrt(t*N)):

You don't need the packages linalg and student, and they are superseded anyway by the LinearAlgebra and the Student packages.

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

 

First 211 212 213 214 215 216 217 Page 213 of 219