I am using Julia and Sympy to solve a partial differential equation and am having problems printing one of my equations in the format that I desire. This is the code that I am using:
function diffeq_3()
@vars z t
P, ∇Pk, Uk, dUdtk = symbols(“P ∇Pk Uk dUdtk”, cls = sympy.Function)
P = cos(t)*cos(z)
∇Pk = diff.(P, z)
dUdtk = diff.(Uk(z, t), t)
diffeq = Eq(dUdtk, ∇Pk)
#println(diffeq)
#solution = pdsolve(diffeq)
end
Notice that the two lines of code before the “end” statement are “commented out”. When I run diffeq_3() using Atom IDE (with Juno) I get the following differential equation in the REPL:
julia> diffeq_3()
∂
──(Uk(z, t)) = -sin(z)⋅cos(t)
∂t
This is the format that I desire.
But when I remove the two “#” characters I get the following in the REPL:
julia> diffeq_3()
Eq(Derivative(Uk(z, t), t), -sin(z)*cos(t))
Uk(z, t) = F(z) - sin(t)⋅sin(z)
So now, the differential equation is printed as “Eq(Derivative(Uk(z, t), t), -sin(z)*cos(t))”. This
is not the format that I want. Is there a way to print the differential equation in the format that I desire and still have the “solution = pdsolve(diffeq)” statement just before the “end” statement?