How to symbolically integrate f(T) = exp (E/(8.314*T) through integration by parts or with trapezoidal method?
Ältere Kommentare anzeigen
I have a function in T which must be integrated trapezoidally. Eα is a constant. Can someone suggest how to perform such an integration in matlab?
Since this is an exponential inteagral with no unique solution, another option is to integrate by parts upto n times, ignore the nth integral and assume the terms upto n-1 as the solution. can this be done in matlab?
Thanks in advance :)
5 Kommentare
J. Alex Lee
am 6 Aug. 2021
Bearbeitet: J. Alex Lee
am 6 Aug. 2021
is this a homework or exercise for implementing trapezoidal integration, or do you need to evaluate the integral for some purpose?
i think your nomenclature needs to be clarified...trapezoidal integration is like a pedagogical tool to introduce to numerical integration techniques and probably isn't so useful in the real world except as a really fast tool for approximate work.
i think typically "integration by parts" is reserved for a strategy unrelated to numerical integration...
edit: trapezoidal isn't so useful when you have a well-defined kernel function like you have here...if you only had data and no underlying function for the kernel, it may be one of few choices you have to approximate an "integral"
Rahul Ramesh
am 6 Aug. 2021
Bearbeitet: Rahul Ramesh
am 6 Aug. 2021
Star Strider
am 6 Aug. 2021
I doubt that the integrateByParts function is appropriate here, however the series, taylor, or pade functions could work.
.
John D'Errico
am 6 Aug. 2021
I just remembered that I recall seeing you ask the same question before. PLEASE STOP ASKING THE SAME QUESTION MULTIPLE TIMES.
Rahul Ramesh
am 6 Aug. 2021
Akzeptierte Antwort
Weitere Antworten (1)
J. Alex Lee
am 6 Aug. 2021
The application still is unclear to me...
If you just want numerical integration, look at the function "integral", as implemented below.
It may be worth noting that the "exact" indefinite integral can be expressed

where Ei is the exponential integral, which seems to have a related in-built numerical algorithm in matlab: expint.
If you have crazy values of Ea, the tops and bottoms in your double sum expression may get crazy too, and then you'll have to deal with finite precision problems in the ratio. If that expression is already the result of some kind of discretization of soemthing else, may be worth going back to that and looking at the problem mathematically in more detail.
Ta = 270;
Tb = 290;
R = 8.314;
Ea = 1e+3;
num_soln = integral(@(T)intKrnl(T,R,Ea),Ta,Tb,"AbsTol",1e-16,"RelTol",1e-16);
san_soln = indefInt(Tb,R,Ea)-indefInt(Ta,R,Ea);
fplot(@(T)intKrnl(T,R,Ea),[Ta,Tb])
function out = indefInt(T,R,Ea)
Ei = -(expint(-Ea/(R*T))+1i*pi);
out = T*exp(Ea/(R*T)) - Ea/R*Ei;
end
function out = intKrnl(T,R,Ea)
out = exp(Ea./(R*T));
end
Kategorien
Mehr zu Calculus finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
