Reputation: 1
New to Julia.I am trying to do some derivations by Symbolics.jl. I have a function which is defined as the sum of another two functions with expressions unassigned. As you can see, it's actually the d'Alembert solution of the wave equation.
using Symbolics, SymbolicUtils
@variables f(..) g(..) t x c
u = f(t-x/c) + g(t+x/c)
And I tried to use Dx = Differential(x)
to represent the partial differentiation with respect to x
. What I want to achieve is to give a certain boundary condition at x=0.
u'(0,t) = d/dx(f(t)+g(t)).
Dx = Differential(x)
dxu = expand_derivatives(Dx(u))
substitute(Dx(u), Dict([x => 0]))
Therefore, I can repeat similar procedures and get some equations(maybe I will subsititute f,g
with some certain expressions later for analytical results).
However, Shown below is the output.
d/0 (f(t)+g(t))
Differential(0)(g(t) + f(t))
The desirable output may be:
d/dx (f(t)+g(t))
Differential(x)(g(t) + f(t))
So is there any method to do this in Julia? Do I simply need to use another Pkg or what?
Sorry for no images. Any advice will be appreciated.
Upvotes: 0
Views: 53