djc

571 Reputation

12 Badges

17 years, 125 days
Technical professional in industry or government
Budapest, Hungary

MaplePrimes Activity


These are replies submitted by djc

 

Thanks for your comments, Axel and Acer.

It works good without abs:

piecewise(a<infinity,1,0);

 

 

Thanks for your comments, Axel and Acer.

It works good without abs:

piecewise(a<infinity,1,0);

 

 

Thanks for your help. 

I have checked the source of `&where` and I 'll check PDESolStruc.

 

 

Thanks for your help. 

I have checked the source of `&where` and I 'll check PDESolStruc.

 

Thank you for this nice solution.

It is bad that the Repeats command doesn't have an option to control the length or the minimum length of the repeating patterns to find and it would be also useful to have a Repeats command for searching repeating patterns in lists.

Thank you for this nice solution.

It is bad that the Repeats command doesn't have an option to control the length or the minimum length of the repeating patterns to find and it would be also useful to have a Repeats command for searching repeating patterns in lists.

Now, I am trying to find  repeating sequences with the maximum length in the first 10000 digits of Pi using the suggested StringTools package:
 

restart;

PiDigits:= StringTools[Delete](convert(evalf(Pi,10000),string),2..2): # this line is from Robert. 

reps:=StringTools[Repeats](PiDigits): # repeating sequences in the digits of Pi

lngth:=seq(op(3,A),A in [reps]):M:=max(lngth); # finding the max length of the repeating sequences.

# the result is: M := 7 the max. length of the repeating patterns.

ns:=ListTools[SearchAll](M,[lngth]);

p1p2len:=seq(reps[op(i,[ns])],i=1..nops([ns]));
# p1p2len := [3503, 6116, 7], [4168, 4602, 7]  There are two repeating patterns with the max. length of 7 in the first 10000 digits of PI.

seq(PiDigits[op(k,[p1p2len])[1]..op(k,[p1p2len])[1]+op(k,[p1p2len])[3]-1],k=1..nops([p1p2len]));

# it gives "7111369", "8530614"  just for checking: the first occurances of the patterns

seq(PiDigits[op(k,[p1p2len])[2]..op(k,[p1p2len])[2]+op(k,[p1p2len])[3]-1],k=1..nops([p1p2len]));

# "7111369", "8530614" the second occurances of the patterns
 

It seems to work, but I am not sure, it is working with much more digits of PI.

 

 

 

Now, I am trying to find  repeating sequences with the maximum length in the first 10000 digits of Pi using the suggested StringTools package:
 

restart;

PiDigits:= StringTools[Delete](convert(evalf(Pi,10000),string),2..2): # this line is from Robert. 

reps:=StringTools[Repeats](PiDigits): # repeating sequences in the digits of Pi

lngth:=seq(op(3,A),A in [reps]):M:=max(lngth); # finding the max length of the repeating sequences.

# the result is: M := 7 the max. length of the repeating patterns.

ns:=ListTools[SearchAll](M,[lngth]);

p1p2len:=seq(reps[op(i,[ns])],i=1..nops([ns]));
# p1p2len := [3503, 6116, 7], [4168, 4602, 7]  There are two repeating patterns with the max. length of 7 in the first 10000 digits of PI.

seq(PiDigits[op(k,[p1p2len])[1]..op(k,[p1p2len])[1]+op(k,[p1p2len])[3]-1],k=1..nops([p1p2len]));

# it gives "7111369", "8530614"  just for checking: the first occurances of the patterns

seq(PiDigits[op(k,[p1p2len])[2]..op(k,[p1p2len])[2]+op(k,[p1p2len])[3]-1],k=1..nops([p1p2len]));

# "7111369", "8530614" the second occurances of the patterns
 

It seems to work, but I am not sure, it is working with much more digits of PI.

 

 

 

 

Thank Joe and Robert.

I thought the solution was based on the pattern matching in strings. It can be useful if Maple can do pattern matching in sequence of digits directly.

Zsolt

 

 

 

Thank Joe and Robert.

I thought the solution was based on the pattern matching in strings. It can be useful if Maple can do pattern matching in sequence of digits directly.

Zsolt

 

 

 

Thank you and Doug for the information. I didn't know this way.

 

Thank you and Doug for the information. I didn't know this way.

 

I haven't reported any bugs.  I would like to report it directly to Maplesoft, but the support page says that I should contact the local Maplesoft partner (I am in Europe) This is not convient for me. There should be a simple way to report bugs.

 

 

I haven't reported any bugs.  I would like to report it directly to Maplesoft, but the support page says that I should contact the local Maplesoft partner (I am in Europe) This is not convient for me. There should be a simple way to report bugs.

 

 

You can use the CriticalPoints and the Roots commands of the Student package to solve your problem.

Try this:

restart;
with(plots):with(Student[Calculus1]):
a := 2; b := 1;
A := (a*b)^2/(8*cos(theta)*sin(theta)*(a*sin(theta)+b*cos(theta))^2);
Agraph:=plot(A,theta=-2..5,view=[-2..5,-15..15],numpoints=3000,color=red):
Ad:=diff(A,theta);
Adgraph:=plot(Ad,theta=-5..10,view=[-2..5,-15..15],numpoints=3000,color=blue):
cpoints:=CriticalPoints( A,theta=-2..5 );
rpoints:=Roots( Ad,theta=-2..5,numeric);
Adisconts:=pointplot(zip((x,y)->[x,y],cpoints, [],0),color=blue,symbol=circle):
Adzeros:=pointplot(zip((x,y)->[x,y],rpoints, [],0),color=green,symbol=circle):
display(Agraph,Adgraph,Adisconts,Adzeros);

4 5 6 7 8 Page 6 of 8