I am writing a Fortran code and I would like to use some special functions and methods from Python libraries. This is a Python code:
from mpmath import *
from scipy.optimize import *
def g(A,B,t):
return newton(lambda x: (x - A*polylog(1.5, B*exp(-t*x))), 0.0)
In fortran code I would like to pass real values A,B,t and get in return the value of g(A,B,t) (possibly complex). This can also be done in C.
I would like to mention that mixing Python with other languages is something new to me.
SOLUTION
In case someone is interested I have solved this problem. The following was of great help: stackoverflow and yolinux.
rootC.c
rootC.h
rootPY.py
rootF.F90
main.c
Makefile