0

I am trying to output an answer to a differential equation.

My Code:

function = "cos(z)"
def Complex_Function(z):
    f1=eval(function)
    return f1
f_subsituted = Complex_Function(a+b*exp(x)) # make z = a+b e^x
DerivativeN1_Func = sm.diff(f_subsituted , a)  #differntiate f_subsituted once
DerivativeN2_Func = sm.diff(DerivativeN1_Func , a) # differntiate f_subsituted twice
display(Latex(r"$y'''(x)+y(x)=-b^2 e^{-2x}$")) #Output needed (Here is the problem)
display(DerivativeN2_Func)

The correct output should be:

y'''(x)+y(x)=-b^2 e^{-2x} *DerivativeN2_Func

But whatever I try it shows the "DerivativeN2_Func" in a new line.

I tried to:

  1. display(Latex(r"$y'''(x)+y(x)=-b^2 e^{-2x}$"), DerivativeN2_Func)
  2. use (end"") method.

non of them worked.

Can you help me solving this issue please?

0 Answers0