-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling the DSolve function in Python #22
Comments
It's a bug in the WolframLanguage, not in the client library. See the difference between:
And the following that will display errors:
This is the same bug as in: #4 |
Let me add a few things about this issue.
This will not display any warning except if you
Instead, you can directly access the result field:
In general, I would not advise to proceed this way but in this case it can be convenient. |
Hey, thank you for your answer, it helped me a lot. |
Hello,
this is a problem regarding the DSolve function from Mathematica, called in Python.
When I try to call an integration statement
`from wolframclient.evaluation import WolframLanguageSession
from wolframclient.language import wl, wlexpr
session = WolframLanguageSession()
alpha = wlexpr("Integrate[1/(x^3 + 1), {x, 0, 1}]")
result = session.evaluate(alpha)
print(result," ",type(result))`
everything works fine in Mathematica and in Mathematica called by Python.
When I try to run this
`from wolframclient.evaluation import WolframLanguageSession
from wolframclient.language import wl, wlexpr
session = WolframLanguageSession()
diff_0 = "DSolve[y'[x] + y[x] == a Sin[x], y[x], x]"
diff_1 = "DSolve[{y'[x] + y[x] == a Sin[x], y[0] == 0}, y, x]"
diff_2 = "DSolve[y'[x] + y[x] == a Sin[x], y[x], x]"
alpha = wlexpr(diff_0)
result = session.evaluate(alpha)
print(result," ",result)`
I get the error
String expected at position 1 in StringForm[MessageName[General, pkspec1], Slot[1]]. The expression Slot[1] cannot be used as a part specification. String expected at position 1 in StringForm[MessageName[General, pkspec1], i]. The expression i cannot be used as a part specification. String expected at position 1 in StringForm[MessageName[General, pkspec1], Slot[1]]. The expression Slot[1] cannot be used as a part specification. String expected at position 1 in StringForm[MessageName[General, pkspec1], i]. The expression i cannot be used as a part specification.
in Python while it works in Mathematica and I don't understand, why.
The text was updated successfully, but these errors were encountered: