Le mardi 20 avril 2021 à 13:01:13 UTC+2, jks...@gmail.com a écrit :
> Fourier transform is currently implemented in SymPy only for integrable > functions. None of those functions is integrable > I beg your pardon ? >>> from sympy import fourier_transform, exp, cos, sin, integrate >>> from sympy.abc import t,w,o >>> integrate(sin(o*t),t) Piecewise((-cos(o*t)/o, Ne(o, 0)), (0, True)) >>> integrate(cos(o*t),t) Piecewise((sin(o*t)/o, Ne(o, 0)), (t, True)) >>> integrate(1/t**2,t) -1/t >>> integrate(2/t**3,t) -1/t**2 so SymPy cannot be used find the transform. > Please… >>> from sympy import fourier_transform, exp, cos, sin, integrate, I, pi, oo, >>> latex >>> from sympy.abc import t,w,o >>> integrate(sin(o*t)*exp(-2*I*pi*w*t),(t,-oo,oo)) Piecewise((o/(4*pi**2*w**2*(-o**2/(4*pi**2*w**2) + 1)) + 1/(o*(1 - 4*pi**2*w**2/o**2)), Eq(2*Abs(arg(o)), 0) & (Abs(2*arg(w) + pi) < pi) & (Abs(2*arg(w) - pi) < pi)), (Integral(exp(-2*I*pi*t*w)*sin(o*t), (t, -oo, oo)), True)) >>> integrate(cos(o*t)*exp(-2*I*pi*w*t),(t,-oo,oo)) Piecewise((I/(2*pi*w*(-o**2/(4*pi**2*w**2) + 1)) + 2*I*pi*w/(o**2*(1 - 4*pi**2*w**2/o**2)), Eq(2*Abs(arg(o)), 0) & (Abs(2*arg(w) + pi) < pi) & (Abs(2*arg(w) - pi) < pi)), (Integral(exp(-2*I*pi*t*w)*cos(o*t), (t, -oo, oo)), True)) >>> integrate(1/(t**2)*exp(-2*I*pi*w*t),(t,-oo,oo)) Integral(exp(-2*I*pi*t*w)/t**2, (t, -oo, oo)) >>> integrate(2/(t**3)*exp(-2*I*pi*w*t),(t,-oo,oo)) 2*Integral(exp(-2*I*pi*t*w)/t**3, (t, -oo, oo)) So sympy *can* compute at least the first two, but not via fourier_transform . BTW, according to Wolfram Alpha <htps://wolframalpha.com>, - sin(o*t) has transform -I*sqrt(1/2)*sqrt(pi)*(dirac_delta(o + w) - dirac_delta(-o + w)) - cos(o*t) has transform sqrt(1/2)*sqrt(pi)*(dirac_delta(o + w) + dirac_delta(-o + w)) - t^(-2) has transform sqrt(1/2)*sqrt(pi)*w*sgn(w) - 2/t^3 has transform -I*sqrt(1/2)*sqrt(pi)*w^2*sgn(w) HTH, > Kalevi Suominen > > On Tuesday, April 20, 2021 at 11:38:08 AM UTC+3 aTPer wrote: > >> I am trying to compute the integral fourier transform of >> sin(t),cos(t),-1/t^2 and 2/t^3(look at screenshot). This for checking >> answers for maths homework/tutorials. >> So, I went to the Sympy documentation page and learned the code from >> there to compute the FTs of the functions defined above but none of it >> actually works. Then, I tried using the noconds=False This is my code: >> >> from sympy import fourier_transform, exp, cos, sin >> from sympy.abc import t,w,o >> fourier_transform(sin(o*t), t, w, noconds=False) >> fourier_transform(cos(o*t), t, w, noconds=False) >> fourier_transform(-1/t**2, t, w, noconds=False) >> fourier_transform(2/t**3, t, w, noconds=False) >> >> https://i.stack.imgur.com/90eo8.png >> > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/5d4bdd62-f1c3-4e72-9652-e12b37a59ed5n%40googlegroups.com.