chrisc

111 Reputation

5 Badges

17 years, 53 days

MaplePrimes Activity


These are questions asked by chrisc

I'm having an issue with Maple 2020.2 classic interface being *very* slow on a new MacBook pro with Big Sur. It takes about 1 second between each keystroke and it appearing on the screen. 

Is this a known bug?

Hi there

There seems to be a bug when evaluating elliptic integrals using assuming. Here's an example:

 

INT:=Int(1/sqrt(a*x^3+1),x=0..X);

is our integral for some a. Now evaluate the integral using assuming on X in different ways:

 

INT2:=simplify(value(INT)) assuming X>0, a>0, a<1;

INT3:=simplify(value(INT)) assuming X<0, a>0, a<1;

 

These give analytic solutions which are different. Now plot them both and compare to the numeric solution

 

plot([subs(a=0.1,INT2),subs(a=0.1,INT3),subs(a=0.1,INT)],X=-1..1,colour=[red,green,blue]);

 

I'm finding that the red curve which should work for X>0 is wrong, while the green one which is for X<0 is ok for X either sign. [blue is the correct answer - numerically!]

 

Any ideas?

I'm having a weird memory leak problem when I use Compiler, and numerical NAG routines for integration - at least I think it's that combination that's causing it. To see it run this:

First define the functions to use:

F_:=Compiler:-Compile(codegen[prep2trans](codegen[optimize](codegen[makeproc](convert(sinh(x)*sin(x),float),[x]))),optimize=true);

F:=proc(k)
if not (k::numeric) then return 'procname'(args) fi;
F_(k);
end proc;

INT:=proc(X) if not X::numeric then return 'procname'(x) fi; int(F(x),x=0..X,numeric,method=_d01ajc); end proc;

 

Then evaluate lots of times:

for i to 10^6 do a:=rand()/1e12; INT(a);  od:

 

And watch your computer memory go wild. I'm using Maple 17 on a new mac with 8Gig RAM, using Mavericks. It doesn't take more than a few minutes to grind the system to a halt. A restart command does not release the memory in the mserver process. [I've noticed similar problems in the past, so it's not locallised to this OS I think.]

 

On a related note, there's a problem with nested NAG integrals - in the do loop try this:

 

int('INT'(XX),XX=0..a,numeric,method=_d01akc)-int('INT'(XX),XX=0..a,numeric,method=_d01ajc);

 

it never gives zero! The problem lies in using the same NAG routine twice [here _d01ajc] for a nested integral. I've never found a way around this bug!

 

Any help would be much appreciated!

 

I was wondering if there's a simple way to add something like an interpolation loop to a procedure. For example, say I have a function of 2 vars which is expensive to compute, f(x,y). I can use option cache to speed up points which are already computed, but is there an easy way to interpolate between them using ArrayInterpolation? That is, if f varies on scales of order 1, if I have calculated it at 0.1, 0.2, then It can be guessed with a spline at 0.15 accurately enough. What...

Define a slightly messy function - in this case a sum of random Gaussians:

spikes:=sort([seq(RandomTools[Generate](distribution(Uniform(0,5))),i=1..300)]):
Spikes:=add(rand()/1e12*exp(-(Z-spikes[i])^2/2/.001^2)/(1+Z)^(5/2),i=1..nops(spikes)):

Takes no time at all to plot, or evaluate 10^3 times:

time(plot(Spikes,Z=0..5,numpoints=1000,adaptive=0));


Now put the whole thing in a procedure A(z), so that we can use A(z) as a function unless...

1 2 Page 2 of 2