JuliaPy / SymPy.jl

Julia interface to SymPy via PyCall
http://juliapy.github.io/SymPy.jl/
MIT License
268 stars 62 forks source link

Feature request: Add curried form of doit function #455

Closed fatteneder closed 2 years ago

fatteneder commented 2 years ago

Hi

I like to use the subs function when chaining operations with |>. Unfortunately, there is no such version for doit. Here is a MWE with a curried version of it:

julia> @syms x f()
(x, f)

julia> D = Differential(x)
Differential(x)

julia> subs(D(f(x)), f(x), x)
d
──(x)
dx

julia> subs(D(f(x)), f(x), x).doit() # already available
1

julia> subs(D(f(x)), f(x), x) |> doit # to be implemented
1

The actual implementation is as simple as

doit(ex::T; deep::Bool=false) where {T<:SymbolicObject} = ex.doit(deep=deep)

Would you be interested in a PR for this?

jverzani commented 2 years ago

Sure that seem reasonable. Look forward to seeing it!