We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
When I tried the following code in order to solve a linear recurrence, I got an error (as shown below).
julia> using SymPy julia> @syms n (n,) julia> y = sympy.Function("y") y julia> f = y(n+2)-y(n+1)-y(n) ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/xing/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'> TypeError("Expr.__sub__() missing 1 required positional argument: 'other'") Stacktrace: [1] pyerr_check @ ~/.julia/packages/PyCall/1gn3u/src/exception.jl:75 [inlined] [2] pyerr_check @ ~/.julia/packages/PyCall/1gn3u/src/exception.jl:79 [inlined] [3] _handle_error(msg::String) @ PyCall ~/.julia/packages/PyCall/1gn3u/src/exception.jl:96 [4] macro expansion @ ~/.julia/packages/PyCall/1gn3u/src/exception.jl:110 [inlined] [5] #107 @ ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:43 [inlined] [6] disable_sigint @ ./c.jl:473 [inlined] [7] __pycall! @ ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:42 [inlined] [8] _pycall!(ret::PyCall.PyObject, o::PyCall.PyObject, args::Tuple{PyCall.PyObject}, nargs::Int64, kw::Ptr{Nothing}) @ PyCall ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:29 [9] _pycall! @ ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:11 [inlined] [10] (::PyCall.PyObject)(args::PyCall.PyObject) @ PyCall ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:86 [11] -(x::Sym{PyCall.PyObject}, y::Sym{PyCall.PyObject}) @ SymPyCore ~/.julia/packages/SymPyCore/yYiXE/src/mathops.jl:16 [12] top-level scope @ REPL[4]:1
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered:
Use SymFunction: https://jverzani.github.io/SymPyCore.jl/dev/reference/#SymPyCore.SymFunction
SymFunction
using SymPy @syms n y = SymFunction("y") f = y(n+2)-y(n+1)-y(n)
Sorry, something went wrong.
Just to add, the function can also be defined through
@syms n y()
I see. Thanks. Hope solving linear recurrence can be added to the documentations!
Successfully merging a pull request may close this issue.
Describe the bug
When I tried the following code in order to solve a linear recurrence, I got an error (as shown below).
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: