Symbolic math integrals not solving at all

61 vues (au cours des 30 derniers jours)
Florian Rössing
Florian Rössing le 30 Avr 2021
Commenté : Taw Tha le 24 Avr 2023
Hi all, I am playing around with functions and the symbolic math toolbox.
I want to calculate an integral of a difficult function:
syms t t0 tau x;
syms l(t,t0,tau);
l(t,t0,tau)= exp(-1/2*exp(-(t-t0)/tau));
syms f(t,t0,tau);
f(t,t0,tau)= exp(-1/2*((t-t0)/tau));
syms p(t,t0,tau);
p(t,t0,tau)=l(t,t0,tau)*f(t,t0,tau);
It can not integrate p directly, which is not that difficult, wolfram alpha does is. But anyhow, I'll help a little and do the substitution:
p=tau*subs(p,(t-t0)/tau,x)
int(p,x,-inf,inf)
But it still just comes up with nothing. It just puts out a formated version of my input instead of calculating the integral.
The answer should be
sqrt(2*pi)*tau
Did I use the toolbox wrong or is it just not that powerfull?
  3 commentaires
Florian Rössing
Florian Rössing le 30 Avr 2021
Thanks for your reply.
Actually it does not matter if you integrate with respect to t or t-t0, t0 just shifts the function along the t axis, but has no influence on the shape. The integral is independent of t0. In the first integral I want it to integrate by t.
However, the second integral clearly states to integrate by x, which still doesnt work.
Walter Roberson
Walter Roberson le 29 Juil 2021
When I take the expression over to Maple and convert the exp() into sinh cosh, then Maple is able to integrate the system. However, I do not seem to be able to do the same thing for MATLAB.

Connectez-vous pour commenter.

Réponse acceptée

Tanmay Das
Tanmay Das le 29 Juil 2021
Your function has no obvious closed form integral. You need to switch to numeric integration, such as with integral() or vpaintegral() which will require you to have a numeric value for x. Similar question has already been answered here:
Also, the same is mentioned in the Tips Section of the int documentation:
You can go through the documentations on integral and vpaintegral to try integrate the same function:
  8 commentaires
Paul
Paul le 27 Avr 2022
Nope. Also doesn't work anymore in 2021B.
However, that code yields the closed form solution in 2020B.
In 2021B I had to change the expression for the integrand
int(simplify(expand(p(t,t0,tau),'IgnoreAnalyticConstraints',true),'IgnoreAnalyticConstraints',true),t,-inf,inf,'IgnoreAnalyticConstraints',true)
to get the same integrand as in in 2020B, at least by visual comparison. But even though the integrands were the same, 2021B int() still did not yield the closed form solution.
Taw Tha
Taw Tha le 24 Avr 2023
Thank you everyone here, I would also like to contribute that simplify('Steps', \*int steps\*)
intFuncky = simplify(int((sqrt(tao^2 - (t-tao)^2) * (t-tao)^2),t,0,2*tao),"Steps",100)
or
intFuncky = simplify(int(( f ,x ,a, b), "Steps" ,100);%100 chosen as a small steps count medium is 400 steps
matlab 2022b

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by