Integral does only solve on second run

28 views
Skip to first unread message

Tom van Woudenberg

unread,
Jan 12, 2023, 2:58:46 PM1/12/23
to sympy
Hi there,

I'm Tom van Woudenberg, lecturer at Delft University of Technology and I'm new to this group. I've got the following problem when trying to solve an ODE with a duhamel integral:

import sympy as sp
omega_n, F_0, m, Omega, zeta = sp.symbols('omega_n, F_0, m, Omega, zeta',real=True,positive=True)
t = sp.symbols('t',real=True)
u_0, v_0 = sp.symbols('u_0, v_0',real=True)
omega_1, t_tilda = sp.symbols('omega_1, t_tilda',real=True,positive=True)
u_forced = sp.simplify(F_0/m/omega_1 *sp.integrate(sp.sin(Omega*t_tilda)*sp.exp(-zeta*omega_n*(t-t_tilda))*sp.sin(omega_1*(t-t_tilda)),(t_tilda,0,t)))
print(u_forced)

u_forced takes extremely long (I never got a solution) to find on the first run of the cell in a Jupyter Notebook. If it aborted and I run it another time, it's found in a couple of seconds:

F_0*(Omega**3*sin(omega_1*t) - Omega**2*omega_1*exp(omega_n*t*zeta)*sin(Omega*t) - Omega*omega_1**2*sin(omega_1*t) - 2*Omega*omega_1*omega_n*zeta*exp(omega_n*t*zeta)*cos(Omega*t) + 2*Omega*omega_1*omega_n*zeta*cos(omega_1*t) + Omega*omega_n**2*zeta**2*sin(omega_1*t) + omega_1**3*exp(omega_n*t*zeta)*sin(Omega*t) + omega_1*omega_n**2*zeta**2*exp(omega_n*t*zeta)*sin(Omega*t))*exp(-omega_n*t*zeta)/(m*omega_1*(Omega**4 - 2*Omega**2*omega_1**2 + 2*Omega**2*omega_n**2*zeta**2 + omega_1**4 + 2*omega_1**2*omega_n**2*zeta**2 + omega_n**4*zeta**4))

The same happens in Spyder.

Any ideas of what is causing this issue?

Kind regards,
Tom van Woudenberg

Aaron Meurer

unread,
Jan 12, 2023, 3:06:21 PM1/12/23
to sy...@googlegroups.com
I can reproduce this. Seems to be an issue with manualintegrate. Can you open an issue in the issue tracker for this?

Aaron Meurer

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/bec838d6-9719-4e57-84bf-848f6fac3c6an%40googlegroups.com.

Tom van Woudenberg

unread,
Jan 13, 2023, 5:53:16 AM1/13/23
to sympy
Thanks Aaron, I opened the issue: https://github.com/sympy/sympy/issues/24518

Op donderdag 12 januari 2023 om 21:06:21 UTC+1 schreef asme...@gmail.com:
Reply all
Reply to author
Forward
0 new messages