Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: mathematica & fortran ??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71479] Re: mathematica & fortran ??
  • From: "gkruger" <gkruger at nwz.uni-muenster.de>
  • Date: Mon, 20 Nov 2006 06:17:12 -0500 (EST)
  • References: <ejjvg3$l3f$1@smc.vnet.net><ejmkj9$gdp$1@smc.vnet.net>

Hello,

if you want to use mathematica inside fortran, using linux you can use
scripts to execute an notebook in command line.

this in fortran code:
call system("scriptname")

script:
run the notebook, saved in .m form, and produce output in file m2
$dir/MathKernel < $(where the .m file is)/math1.nb.m > m2

get output and just write the number in m3
grep 'Out' m2 | cut -f 2 -d' ' > m3

fortran code:
wait till the file m3 exists and read the number.

This is a little bit constructed but it works. You just have to test
wich outpur form is the best for importing in fortran with the high
precision you want.

Greetings

Guido


On 18 Nov., 10:43, "Beliavsky" <beliav... at aol.com> wrote:
> fish wrote:
> > I have been using the software of Mathematica for 2 years. It is a
> > good software.
>
> >    Those days, I meet a difficulty. I compile a program, which is
> > written in Fortran language. In it, there is a Bessel function. I want
> > to get the high precision value of the function. Unfortunately, I
> > failed.
>
> >    As we know, the software of Mathematica supplies the Bessel function
> > with high precision. So I want to ask whether we can run the two
> > softwares, Mathematica and Fortran language, simultaneously? Then I can
> > directly use the Bessel function in Mathematica for my Fortran program.A Fortran solution could be to find a compiler that supports quadruple
> precision (16 byte floating point variables) or 10-byte reals. Then you
> could either change the code to use quadruple precision or (depending
> on the compiler) invoke a compiler switch that automatically promotes
> double precision variables to quadruple precision. The Lahey/Fujitsu
> compiler has the -quad option. If you want to try this route, the best
> newsgroups for follow-up questions would be comp.lang.fortran and/or
> sci.math.num-analysis.


  • Prev by Date: Re: Summations in a Text Cell
  • Next by Date: Best practice for naming of options
  • Previous by thread: Re: mathematica & fortran ??
  • Next by thread: Rectangle with Scaled (a plot inside a plot)