0

I have this equation that I want to solve in python but I'm not sure if I'm following the right procedure, the equation is ((e^x)* a + b=0) where a and b are constants this my code the output is [-0.916290731874155 + 3.14159265358979*I] which I'm not sure what it means

import sympy as sp
​
T_final= 70.0
T_intial= 75.0
T_diff= T_final - T_intial

T_now= 72.0
T_d= T_final - T_now
x = Symbol('x')
​
z= (sp.exp(x)* T_diff)+ T_d
sp.solve(z, x)
Aya Doma
  • 11
  • 2
  • The `i * pi` term appears because [`exp(i * pi) == -1`](https://en.wikipedia.org/wiki/Euler%27s_identity), so if you were expecting there to be a solution in the [real numbers](https://en.wikipedia.org/wiki/Real_number) then you probably got a minus sign the wrong way round. – kaya3 Feb 18 '20 at 21:04
  • @kaya3 I edited a few things and now the answer is [-0.916290731874155 + 3.14159265358979*I] what is I ? – Aya Doma Feb 18 '20 at 21:07
  • That is the same thing, just in decimal format. – kaya3 Feb 18 '20 at 21:08
  • yes but what does I stands for? – Aya Doma Feb 18 '20 at 21:10
  • See the link I posted above. – kaya3 Feb 18 '20 at 21:10

1 Answers1

0

I stands for sqrt(-1), e.g. solve(x**2+1) -> [-I, I]. When solving the equation f(x) = a you have to pass this to solve as solve(f(x) - a, x) (note the minus on a) or as solve(Eq(f(x), a), x).

In your case do you mean

>>> solve((sp.exp(x)* T_diff) - T_d, x)  # i.e. Tdiff*e^x = Td
[-0.916290731874155]
smichr
  • 16,948
  • 2
  • 27
  • 34