Filter löschen
Filter löschen

Why can't I get this integration to work?

1 Ansicht (letzte 30 Tage)
Kendra Hamilton
Kendra Hamilton am 6 Okt. 2023
Kommentiert: Kendra Hamilton am 6 Okt. 2023
Hi, I'm trying to integrate the function I(z) from -infinity to infinity. This is my code:
syms P w0 r n lamda z
Pi = sym(pi);
zR = Pi*w0^2*n/lamda;
I(z) = 2*P*zR^2/(Pi*w0^2)*1/(zR^2+z^2)*exp(-2*r^2*zR^2/(w0^2*zR^2+w0^2*z^2));
I1 = int(I, z, -inf, inf)
I1 = 
but it just prints
I1 = int((2*P*n^2*w0^2*pi*exp(-(2*n^2*r^2*w0^4*pi^2)/(lamda^2*(w0^2*z^2 + (n^2*w0^6*pi^2)/lamda^2))))/(lamda^2*(z^2 + (n^2*w0^4*pi^2)/lamda^2)), z, -Inf, Inf)
Can someone tell me what I'm doing wrong?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 6 Okt. 2023
Verschoben: Walter Roberson am 6 Okt. 2023
syms P w0 r n lamda z real
Pi = sym(pi);
zR = Pi*w0^2*n/lamda;
I(z) = 2*P*zR^2/(Pi*w0^2)*1/(zR^2+z^2)*exp(-2*r^2*zR^2/(w0^2*zR^2+w0^2*z^2));
IE = expand(I)
IE(z) = 
I1 = int(IE, z, -inf, inf)
I1 = 
Now look at the form of that integral. Can we find a simpler integral that has the same general form but still cannot be integrated? Yes.
syms B C x
F = exp(-B/(x^2+C))
F = 
int(F, x, -inf, inf)
ans = 
A key point for this is that if you hardcode B as 1 then MATLAB can proceed, and likewise if you hard-code C as 0. But the combination of the two is more than MATLAB can deal with.
Maple is not able to deal with this integral either
Your actual integral is worse than this.
Your basic problem, then, is that there is no closed form integral for that expression that can be found by MATLAB (or Maple either)

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by