Search All of the Math Forum:

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

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

 Messages: [ Previous | Next ]
 Tang Laoya Posts: 23 Registered: 11/21/12
Re: Ask for help: how to let mathematica output Fortran code with
fewest float operations?

Posted: Jan 13, 2013 1:13 PM

On Monday, January 14, 2013 12:13:06 AM UTC+8, Richard Fateman wrote:
> 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.
>
>
>

Dear Prof. Fateman,

Thank you very very much for your so kindly suggestions and help.

Thanks,
Tang Laoya

Date Subject Author
1/13/13 Tang Laoya
1/13/13 Tang Laoya
1/13/13 Richard Fateman
1/13/13 Tang Laoya
1/13/13 Nasser Abbasi
1/13/13 Tang Laoya
1/13/13 Axel Vogt
1/13/13 Tang Laoya
1/13/13 Axel Vogt
1/13/13 Tang Laoya