Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math.symbolic.independent

Topic: Ask for help: how to let mathematica output Fortran code with fewest
float operations?

Replies: 9   Last Post: Jan 13, 2013 7:27 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Richard Fateman

Posts: 1,398
Registered: 12/7/04
Re: Ask for help: how to let mathematica output Fortran code with
fewest float operations?

Posted: Jan 13, 2013 11:13 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 1/13/2013 12:32 AM, Tang Laoya wrote:
> When the test.f90 is outputted, the first solution of x is:
>>
>>x = a/3. + (-6 + 2*a**2)/(3.*2**0.6666666666666666*(-36*a + 20*a**3 +


Sqrt(4*(-6 + 2*a**2)**3 + (-36*a + 20*a**3 - 216*b)**2) -
216*b)**0.3333333333333333) -

(-36*a + 20*a**3 + Sqrt(4*(-6 + 2*a**2)**3 + (-36*a + 20*a**3 -
216*b)**2) -

216*b)**0.3333333333333333/(6.*2**0.3333333333333333)

..............
in maxima, optimize(%)

block([%1,%2,%3,%4,%5],
%1:2*a^2-6,
%2:-36*a,
%3:20*a^3,
%4:-216*b,
%5:(%4+sqrt((%4+%3+%2)^2+4*%1^3)+%3+%2)^0.33333333333333,

x = -0.13228342099735*%5+0.20998684164915*%1/%5+a/3)$

There is also a (separate) program to convert Maxima expressions
to something like looks like Fortran, with ** instead of ^,
and continuation lines.

Maxima can be downloaded from sourceforge, free.





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.