Question: evaluating functions in fortran format

Hello,

I have a symbolic function, and I want to see its pointwise numerical evaluation in fortran format.

Basically, if I have a function like e^x, I want an array like:

  2.7183d+000
  7.3891d+000
  2.0086d+001
  5.4598d+001
  1.4841d+002
  4.0343d+002
  1.0966d+003
  2.9810d+003
  8.1031d+003
  2.2026d+004

What I tried doing was:

-----

for i from 1 by 1 to 10 do

evalf(sub(x=i,exponentialFunction));

od;

-----

But it gives me these numbers in a format that doesn't have the "d+0" inside there... it actually uses superscripts on base 10 to show the order of magnitude.

I am curious to see if there's a way to get the numbers in the above format (and also to see if there's a way to do this without using a for loop .... it would be very wierd if something that can be done in matlab by pressing 2 keys requires an entire for loop in maple.

 

Thanks for all the help in advance!

 

 

 

 

 

Please Wait...