微分
本来は C API を利用して直接データをやり取りできるはずですが・・・
無料 Wolframscript だけでは C のヘッダーファイルとか関連ファイルが無い?
コマンドライン引数で命令を与える方式では 出力 Form をうまく変えられない・・・いったんテンポラリファイルを経由しないといけない。また DOS 窓では、空白を区切りに解釈するので、引用符 " " でくくらないと駄目だが、そうなると文字列とかで困る。
ソース・プログラム
program Console2 implicit none character(256) :: text open(9, file= 'tmp.m') write(9, *) 'Export["out.m", D[Sin[x^2],x]//FortranForm]' close(9) call execute_command_line('wolframscript -f tmp.m') open(10, file = 'out.m') read(10, *) read(10, '(a)') text print *, trim(text) end program Console2
結果
2*x*Cos(x**2)
ファイル out.m
(* Created with the Wolfram Language : www.wolfram.com *) 2*x*Cos(x**2)