I need to calculate the Laplace transform. For that I used the following code:
from sympy.abc import x, s
from sympy import Symbol, exp, cos , sin , Heaviside, integrate, limit, oo
x=Symbol("x")
s=Symbol ("s")
f=raw_input(" write any function : ")
integral= integrate( exp(-s*x) * cos(3*x) ,(x,0,oo), conds="none")
print integral
The problem is that having f
with raw_input
, when the user enters the code f
takes value of string so I throw error.
This is an example if f takes the value of
f=3*x
he tells me:
integral= integrate( exp(-s*x) * f ,(x,0,oo), conds="none") TypeError: can't multiply sequence by non-int of type 'exp'
Any ideas on how to fix this?