Tworzę aplikację kalkulatora. Używam Javy i Jythona. Chciałam użyć modułu SymPy, ale po wywołaniu poniższego kodu pojawia się błąd, że nie ma takiego modułu. Jakieś rady?
try (PythonInterpreter interpreter = new PythonInterpreter()) {
interpreter.exec("""
from sympy import cos, sin, pi
def f(x):
\treturn\040""" + wartoscCalki.getText() +
"""
\ndef simpson(a, b, n):
\tx1=0.0
\tx2=0.0
\tx0=f(a)+f(b)
\th=(b-a)/n
\twynik=0.0
\tfor i in range(1,n):
\t\tx=(a+(i*h))
\t\tif i%2==0:
\t\t\tx2+=f(x)
\t\telse:
\t\t\tx1+=f(x)
\twynik=h*(x0+2*x2+4*x1)/3
\treturn wynik
c=float(simpson(""" + granicaDolna.getText() + """
,""" + granicaGorna.getText() + """
,""" + liczbaPodprzedzialow.getText() + """
))"""
);
}
Caused by: Traceback (most recent call last): File "", line 2, in module ImportError: No module named sympy