Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'FortranForm[sqrt[5]] returns sqrt(5) instead of...' topicStudent Support Forum > General > "FortranForm[sqrt[5]] returns sqrt(5) instead of..."

Next Comment >Help | Reply To Topic
Author Comment/Response
feng
09/05/07 01:26am

I have some expressions like “rho[1,2]*Sqrt[5]”
I want to output it into a txt file in the format of fortran.
I just use “FortranForm[rho[1,2]*Sqrt[5]”, it returns “rho(1,2)*Sqrt(5)”
Here “Sqrt(5)” in fortran returns an erro, it should be “Sqrt(5.0)” , but mathematica just gives “Sqrt(5)”
I don’t want to use “N[ ]”, because I have the index 1 and 2 which should be remains integer, just as follows
N[rho[1,2]*Sqrt[5]]
=>rho(1.,2.)*Sqrt(5.)

How should I do?

Many thanks


URL: ,

Subject (listing for 'FortranForm[sqrt[5]] returns sqrt(5) instead of...')
Author Date Posted
FortranForm[sqrt[5]] returns sqrt(5) instead of... feng 09/05/07 01:26am
Re: FortranForm[sqrt[5]] returns sqrt(5) instea... yehuda ben-s... 09/06/07 07:21am
Re: Re: FortranForm[sqrt[5]] returns sqrt(5) in... feng 09/06/07 9:40pm
Next Comment >Help | Reply To Topic