nm

11898 Reputation

20 Badges

13 years, 175 days

MaplePrimes Activity


These are replies submitted by nm

I think some of your result have wrong value at the end. You have extra entry at end of some of your lists.

Here is your code

And this is the output from the pdf:

Here is my implmenetation. No need to use explicit loop. This first gets all primes to the maximum number (in your example, you hade this hardcoded as 101, this takes it as argument), then using map to check if there is next prime in this list which is diff away from the current one.

restart;

ppair:=proc(the_diff::posint,max_number::posint)::list;
local len::posint;
local L::list; #list of primes

    L:=select(isprime,[$1..max_number]);
    print(L);
    len:=nops(L);
    map(N->`if`(N<len and member(L[N]+the_diff,L),L[N],NULL),[$1..len]);

end proc:    
        

ppair(2,101)

[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]

[3, 5, 11, 17, 29, 41, 59, 71]

ppair(4,101)

[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]

[3, 7, 13, 19, 37, 43, 67, 79, 97]

ppair(6,101)

[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]

[5, 7, 11, 13, 17, 23, 31, 37, 41, 47, 53, 61, 67, 73, 83]

ppair(8,101)

[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]

[3, 5, 11, 23, 29, 53, 59, 71, 89]

ppair(10,101)

[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]

[3, 7, 13, 19, 31, 37, 43, 61, 73, 79]

 

 

Download primes_jan_2_2026.mw

@janhardo 

Sure, This is how to check if anti-derivative is correct.  But see what happens if the anti-derivative is simplified first !

restart:
f := sqrt(1 + sin(x)^2):
F := int(f, x);
F:= simplify(F); #add this line
df := diff(F, x);
simplify(df - f); 

It now no longer gives zero automatically. 

However, now doing simplify(%,symbolic) on the above gives zero.

I do not like to use simpify with symbolic option as branch cuts and sign of things are ignored and sometimes wrong result can be generated.

For example 

e:=3*sqrt(x)*sqrt(y(x)) - 3*sqrt(x*y(x));
simplify(e);
simplify(e,'symbolic')

But the zero is correct only for reals and also when both x and y are nonnegative.

But isn't strange that simplifying the anti-derivative made it not give zero automatically? 

@sand15 

So what should one write in Maple, to get same exact output as Mathematica gives from its EllipticE[x, -1] ?

This is what I get

Table[EllipticE[x, -1], {x, -3, 3, .5}];
{-3.67814, -3.14006, -2.50798, -1.81002, -1.12389, -0.519174, 0., 
0.519174, 1.12389, 1.81002, 2.50798, 3.14006, 3.67814}

Not able to find what I need to do in Maple to get same numerical values as above.

If I do 

seq(EllipticE(x,I),x=-3..3,.5)

-EllipticE(3, I), -1.910098895 + 2.800167923*I, -1.910098895 + 2.187482903*I,
 -1.910098895 + 1.478001735*I, -1.910098895 + 0.*I, -0.5454514561 - 0.*I, 
0.*I, 0.5454514561 + 0.*I, 1.910098895 - 0.*I, 1.910098895 - 
1.478001735*I, 1.910098895 - 2.187482903*I, 1.910098895 -
 2.800167923*I, 1.910098895 - 3.372014175*I

Not same. And I do

seq(EllipticE(x,-1),x=-3..3,.5)

-3, -2.5, -2.0, -1.5, -1.0, -0.5, -0., 0.5, 1.0, 1.5, 2.0, 2.5, 3.0

Tried few other things, but can't get same numerical values as Mathematica.  Any idea what I need to change in Maple to get same output? I know this is related to different definitions. But what to change in Maple to make it produce same output?

May be the easiest thing is to make myEllipticE function in Maple and define it such that it is the same as sagemath and Mathematica are using, and use that instead of Maple's EllipticE if I want to get same exact output.

@dharr 

I also tried this using sagemath using the online version here https://sagecell.sagemath.org/

Ofcourse it is possible sagemath is also wrong? Or may be different CAS system are using different definitions of things.

I think by default sagemath uses Maxima integration. Fricas could not do this integral.

@dharr 

I am almost sure this regression happened in 2025.2.

How do I know? I found this bug when I run my tests and found a problem failed when it passed before.

I said to myself, this is very strange, since I have not changed my code which affects this specific problem for years.

Only change I did since last result, was installing Maple 2025.2 on this new pc. The earlier test was done on Maple 2025.1 on Linux.

It took me a whole day of debugging to find why, which is that changes to a matrix did not take effect due to calling simplify in between.

Any one reading this: If you still have Maple 2025.1, would you be able to just run dharr worksheet posted above and see if you get the bug or not?

I find it very strange that such a very serious bug was not detected by Maple's internal tests before releasing new version of the software.

@dharr 

Would you happen to know why adding any one of these commands at the top of your worksheet has no effect?

forget(simplify, 'forgetpermanent'=true,'subfunctions'=true);
forget(simplify, 'forgetpermanent'=true);
forget(simplify);

I was trying to see if adding forget(simplify) at the top of my test worksheet will fix this, so I do not have to remember to call forget(simplify) each and everytime after calling simplify in the code.

But it had no effect. One has to call forget() each time after calling simplify().

Do you know if there is a different way to put simplify in "forget" mode permanently once and for all time?

I am using Maple 2025.2 on windows 10.

@dharr 

Thanks, Yes, this is it. good example of the problem.

But how could this be possibly be correct software behavior??  

If this is a known problem, then this will introduce so many bugs.

In Mathematica there is no such bug

Mathematica does not have remember tables.

Compare to Maple (your example)

I am now really scared to use Maple any more to program anything.

Thanks for submitting bug report on this also.

it is not duplicate.

Why not try to understand the question first?

This is asking how to obtain same display from _same_ input.

Question is _not_ asking how to _change_ the output as asked by the question referenced.

@aroche 

I do not know how to download the beta release and try it. But could you please check if your fix also fixes this crash, also in odetest? Or this could be new bug?

This happens only when adding IC to ode test

 

Will try now to upload worksheet. Not able to due to security wall. Here is the code

sol:=y(x) = sqrt(6)*sqrt((48*x^3 + (108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(2/3) - 240)/(108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(1/3))/12 + sqrt(6)*sqrt((12*x^2*sqrt(6)*(108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(1/3) - 48*sqrt((48*x^3 + (108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(2/3) - 240)/(108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(1/3))*x^3 - sqrt((48*x^3 + (108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(2/3) - 240)/(108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(1/3))*(108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(2/3) + 240*sqrt((48*x^3 + (108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(2/3) - 240)/(108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(1/3)))/((108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(1/3)*sqrt((48*x^3 + (108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(2/3) - 240)/(108*x^4 + 12*sqrt(-768*x^9 + 81*x^8 + 11520*x^6 - 57600*x^3 + 96000))^(1/3))))/12:
ode:=(3*x^2-2*x*y(x))+(4*y(x)^3-x^2)*diff(y(x),x)=0;
IC:=y(2)=1;
odetest(sol,[ode,IC])

 

Using V 2025.2 and latest Physics update.

Strange thing is that infolevel[odetest]:=5; shows nothing. But infolevel[solve]:=5; shows it crash after 

Recurse: recursively solving 6 equations and 2 inequations in 7 variables
Dispatch: handling polynomials of the form a*x^n-b
Dispatch: dispatching to PolynomialSystem handler
Main: polynomial system split into 1 parts under preprocessing
Main: using groebner basis methods over the real numbers
Main: unable to use Real methods, reverting to default
Main: using Groebner based methods
SolverVariableOrder: using the variable order  _S000032 > _S000030 > _S000031 > _S000027 > _S000028 > limit/T
GroebnerBasis: computing a tdeg Groebner basis
GroebnerBasis: system has a low, positive Hilbert dimension
GroebnerBasis: computing a factored plex basis using Groebner[Solve]
GroebnerBasis: constructing solutions

 

@Ronan 

But this is not what the input is. It is not 

(x - 1)^2 + (y + 4)^2 + (z - 3)^2 - 56 = 0

But 

   (z-3)^2 + (y+4)^2 + (x-1)^2 - 56  =  0

If you try your sort command on the actual input, you will see it does not work.

Did you see my post on similar issue with this firewall?

Unable-To-Upload-Worksheet-To-MaplePrimes

For me I get this security error when trying to upload worksheet. Same software you show. Sucuri. So it must be same source of problem, with help or file upload.

Started to happen about 2-3 weeks ago. Someone at Mapleprimes support should know. But no answer. They must have made changes to Mapleprimes or maplesoft web site or the firewall settings these site use.

No one seems to know what it is going on. It seems to affect some and not others.

@acer 

thanks. obsrange=false worked well. No need to adjust y range any more. I did not know about it.  As for plots:-odeplot help says it is used to plot solution from dsolve with numeric option. Which I do not use.

I can't find example now where DEtools:-DEplot was giving warnings when no y-range is used. If I find one will update.

As for rangesonly  I used it before, but for some reason I replaced it sometime ago. I do not know why. May be later was better. I have no comment to say why

   try 
        #T:=plottools:-getdata(p,'rangesonly');
        T:=rhs~(indets(p, identical("originalview")=anything))[];      
    catch:
     ....

It could be that originalview gave "better" values. I do not remember. It was few years ago.

Update

Found an example where using rhs~(indets(p, identical("originalview")=anything)) works better than plottools:-getdata(p,'rangesonly'); and this is probably why I changed to it.

In this example, using getdata(p,'rangesonly'); gives much larger y range than "originalview".

interface(version);

`Standard Worksheet Interface, Maple 2025.2, Windows 10, November 11 2025 Build ID 1971053`

ode:=diff(y(x),x) = 1/x^2;
IC:=y(1) = 5;
sol:=dsolve([ode,IC]);
p:=plot(rhs(sol),'axes'='boxed','labels'=[x,y(x)],'axis'=['gridlines'=['color'='lightblue']],'color' = 'red');

diff(y(x), x) = 1/x^2

y(1) = 5

y(x) = -1/x+6

 

 

T:=rhs~(indets(p, identical("originalview")=anything))[];     
from_x := op(1,T[1]);
to_x   := op(2,T[1]);
from_y := op(1,T[2]);        
to_y   := op(2,T[2]);

[-.1000000000 .. .2500000000, -30. .. 40.]

-.1000000000

.2500000000

-30.

40.

T:=plottools:-getdata(p,'rangesonly');    
from_x := op(1,T[1]);
to_x   := op(2,T[1]);
from_y := op(1,T[2]);        
to_y   := op(2,T[2]);  

[-0.991250000006402843e-1 .. .249125000002095476, -496789.511752721155 .. 711542.165524577722]

-0.991250000006402843e-1

.249125000002095476

-496789.511752721155

711542.165524577722

 

 

Download difference_in_plottools_getdate.mw

@acer 

I am using https. 

I have not changed anything on my end. Using same link and same steps I always did. Only now can't upload worksheet anymore.

@janhardo 

Sorry, I do not understand what you mean by the solution is to use https://www.mapleprimes.com  ?

I was on https://www.mapleprimes.com and opened new question and when I click the green arrow, not able to upload worksheet. Once I click the "upload" button, it gives this error security message and kicks me out.

What exactly should I change in these steps?

@FDS 

Try this. Use worksheet mode (not document mode) and remove all the libs you have in your libname, keeping only Physics, Support and Maple main library.

i,e, do this in new worksheet (based on what you showed, only the first 3 libs)

restart;

#new cell

libname:=libname[1],libname[2],libname[3];
ode:=x*y(x)*diff(y(x),x)^2+(a+x^2-y(x))*diff(y(x),x)-y(x)*x=0;

And see if this makes any difference.  If not, then I do not know why you are getting these errors. Maybe support could help.

1 2 3 4 5 6 7 Last Page 1 of 92