I need to solve differential equation y'=6e^(2x-y). I am trying to do that in sympy with dsolve().
sol = dsolve(Derivative(f(x), x) - 6 *(e**(2*x-f(x))), f(x))
But always get error
expecting ints or fractions, got 7.38905609893065022723042746058 and 6
What is the problem?
Where did you get e
from? It seems you used math.exp(1)
or similar to get a floating point value that the symbolic package can not treat correctly
Using sympy.exp
instead works perfectly, even defining e=sympy.exp(1)
is correctly recognized. Both with the result
Eq(f(x), log(C1 + 3*exp(2*x)))