Closed form not the same as the discrete form

Click For Summary
SUMMARY

The discussion focuses on the discrepancies between the numerical summation stored in variable Z and the analytical function stored in Z1, both computed in MATLAB. The code utilizes a for loop to calculate Z for a range of x values, while Z1 attempts to derive the same results analytically based on a formula from Wolfram MathWorld. Despite both functions being equal at the limiting case of a == x, they diverge for other values of x, particularly as T approaches infinity, with T set at 5e-3 in this instance. The plot generated illustrates these differences, highlighting that Z satisfies the expected behavior while Z1 does not.

PREREQUISITES
  • Understanding of MATLAB programming and syntax
  • Familiarity with numerical methods and summation techniques
  • Knowledge of analytical functions and their properties
  • Basic concepts of delta functions and their applications in mathematics
NEXT STEPS
  • Explore MATLAB's vectorization techniques to optimize the summation process
  • Study the properties of delta functions and their representations in mathematical analysis
  • Learn about numerical stability and convergence in summation methods
  • Investigate the implications of limits in analytical functions as parameters approach infinity
USEFUL FOR

Mathematicians, physicists, and engineers who are working with numerical simulations and analytical solutions, particularly those using MATLAB for computational analysis and modeling.

tworitdash
Messages
104
Reaction score
25
Matlab:
clear;

lambda = 3e-2;

x = 4 * pi/lambda * linspace(eps, 15, 100000);

T = 5e-3;
t = [0:0.001e-3:T] ; % 0.1:1e-3:0.1+T];

u = 3;

a = 4*pi/lambda * u;

for i = 1:length(x)
    Z(i) = sum(-((cos(a.*t) - cos(x(i).*t)).^2 + (sin(a.*t) - sin(x(i).*t)).^2));
end

% Z1 = csc((a+x)/2) .* sin(1/2.*(2.*T + 1).*(a + x)) -1/2 .*  csc(a) .* sin(2.*a.*T+a) - 1/2 .* csc(x) .* sin(2.*T.*x+x)
Z1 = csc((a-x)/2) .* sin((T+1/2).*(a-x))/(2*pi) - 2*T - 1;

figure; plot(x*lambda/(4 * pi), (Z));
hold on; plot(x*lambda/(4 * pi), (Z1), '*');
<Moderator's note: CODE tags added. Please use them when posting code.>

The above code does two things. one is a summation over `t` and stores it in `Z` for all `x` individually with a for loop. The second thing it is doing is trying an analytical function for the summation in `t` and and just use the vector `x` to find the same quantity as `Z`, but analytically. it is stored in `Z1`. Somehow they both are not the same. The expression of the analytical form can be found in https://mathworld.wolfram.com/DeltaFunction.html equation (41) on that page. There is also a plot representing the function there. However, the MATLAB plot is very different. However, it is interesting to notice that `Z` and `Z1` are the same at the limiting case `a == x`. The plot I get is shown below. It should have a maximum at `a = x`, that is the value it should take at that point is `Z = Z1 = 0` and for the rest of the `x`, it should be less than 0. However, the blue plot satisfies it, but not the red one.
 

Attachments

  • CaptureLL.PNG
    CaptureLL.PNG
    33.4 KB · Views: 220
Last edited by a moderator:
Physics news on Phys.org
Z1 approaches a delta function as ##T\rightarrow\infty##, you are using ##T= 5 \times 10^{-3}##.
 
Last edited by a moderator:

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K