Problem with integration for WKB approximation

Click For Summary
SUMMARY

The discussion focuses on solving a complex integration problem using MATLAB, specifically for WKB approximation. The user encountered difficulties with nested integrals, particularly when trying to compute an integral that includes another integral within a cosine function. The solution involved utilizing the quad function to evaluate the outer integral while calling a custom function for the inner integral, achieving satisfactory results despite some accuracy concerns. The final implementation demonstrates how to handle multiple integration steps effectively.

PREREQUISITES
  • Understanding of numerical integration techniques in MATLAB
  • Familiarity with WKB approximation methods
  • Knowledge of MATLAB function syntax and global variables
  • Basic concepts of nested integrals and their computational challenges
NEXT STEPS
  • Explore MATLAB's integral function for improved accuracy in numerical integration
  • Learn about adaptive quadrature methods for better integration results
  • Investigate the use of symbolic computation in MATLAB for complex integrals
  • Study the implementation of custom integration algorithms in MATLAB
USEFUL FOR

Researchers, physicists, and engineers working with numerical methods in MATLAB, particularly those dealing with WKB approximations and complex integral calculations.

magimbu
Messages
2
Reaction score
0
problem with integration for WKB approximation in MATLAB

hi all,
i have been having troubles with getting MATLAB to solve the following problem (the language is not the MATLAB one, the functions are not solvable by the symbolic integration and i was trying to get one of the quad functions to do it)(r1,r2 are numbers):

int(function*cos(int(function2,rprime,r,r2)),r,r1,r2)

As you can see the problem is that inside the cosinues there is an integral that goes from r ( variable of the first integral) to r2, so i can t solve it numerically, because i need it in function of r in order to perform the big integral.

I thought a couple integral function would exist but i am not able to find any ( the doublequad only works if its only one function integreded twice).

I hope what i wrote cna be understood, and appreciate your help and time!
JN
 
Last edited:
Physics news on Phys.org
hi all,
i found the answer a couple hours ago, even if accuracy hasn t been the best, it is just now a matter of choosing the right integration algorithm withim matlab.
I have until now write it using quad, basically the principle is that every time the outside integration wants to evaluate the function at a certain point, i evaluate the inner integral starting at that point. i m posting my solution so maybe it can help somebody else, thanks for looking at my post. so the code looks like this:

solutionTest= quad((@integrand2),r1,r2)

% then here is integrand 2, the letters are global constants


function valor = integrand2(r)

% here i have to see how many steps there are and for each of those i do
% the numerical integration inside
steps1 = size(r);
steps = steps1(1,2);
i=1;
% and for each step i perform the integration

while i <steps+1

valores(i) = 1./(((Q-calculateVTotal1(r(i))).*2*reducedMass/(hbar^2)).^(1/2))*cos( quad((@integrand1),r(i),r2)).^2;
i=i+1;
end
valor = valores;

end
 

Similar threads

Replies
5
Views
4K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
Views
10K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
7K