slizovskiy

25 Reputation

8 Badges

12 years, 30 days

MaplePrimes Activity


These are replies submitted by slizovskiy

 

@Axel Vogt 

Dear Axel, thank you for trying to help.  I again posted an oversimplified problem. Here is a fuller version:

This works
> Compiler:-Compile(proc (U, kF1, kF2, m, k, omega, q) ((-1)*2.*I*omega*m+k^2+q^2+2.*q*k)/sqrt(6.*k^2*q^2+4.*q*k^3+4.*q^3*k+k^4+q^4+4.*omega^2*m^2) end proc, optimize = true);
 
This does not:
> prc := codegen[makeproc]((-(2.*I)*omega*m+k^2+q^2+2.*q*k)/sqrt(6.*k^2*q^2+4.*q*k^3+4.*q^3*k+k^4+q^4+4.*omega^2*m^2), [U, kF1, kF2, m, k, omega, q]);
> Compiler:-Compile(prc);
Error, (in Print) rational numbers and arithmetic are not yet supported
 
You see that any innocent shuffling of expression with sqrt  (like makeproc) automatically converts it to the form that is not accepted by Compile. 
I have reported a similar problem of this type  here  http://www.mapleprimes.com/questions/135011-Compiling-Errors
It seems like one needs some Wizard tricks to make Compile work!

Just a bit more complicated, and it fails.  I have a long expression, but here's an example:

sqr := proc (x) 1/x^(1/2) end proc

> cp := Compiler:-Compile(sqr);
Error, (in Print) rational numbers and arithmetic are not yet supported

Just a bit more complicated, and it fails.  I have a long expression, but here's an example:

sqr := proc (x) 1/x^(1/2) end proc

> cp := Compiler:-Compile(sqr);
Error, (in Print) rational numbers and arithmetic are not yet supported

thanks, that was very useful!

thanks, that was very useful!

Thanks!  I've tried  'f(x,y)'   while the correct way is 'f'(x,y)

Thanks!  I've tried  'f(x,y)'   while the correct way is 'f'(x,y)

the only workaround I see is to keep arguments in lists. But again I am unhappy with  3 [a,b] = [3 a, 3 b]  

I would like to prohibit such a behaviour.

1 2 Page 2 of 2