Closed form not the same as the discrete form

In summary, the code provided calculates two different summations, one using a for loop and the other using an analytical function. However, the plots for both functions are different, with the analytical function not matching the expected behavior. Both functions are equal at the limiting case of a equals x, but for all other values, there is a discrepancy. The analytical function should approach a delta function as T approaches infinity, but with the given T value, this is not observed in the plot.
  • #1
tworitdash
107
26
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: 118
Last edited by a moderator:
Physics news on Phys.org
  • #2
Z1 approaches a delta function as ##T\rightarrow\infty##, you are using ##T= 5 \times 10^{-3}##.
 
Last edited by a moderator:

1. What is the difference between closed form and discrete form?

Closed form and discrete form refer to two different methods of representing mathematical expressions. Closed form refers to an equation that can be written in a simple, finite form, such as a polynomial or a rational function. Discrete form, on the other hand, refers to a representation of a function using a sequence of discrete values, such as a table of values or a graph.

2. Can a function have both a closed form and a discrete form?

Yes, a function can have both a closed form and a discrete form. For example, the function f(x) = 2x + 1 can be represented in closed form as an equation, f(x) = 2x + 1, and in discrete form as a table of values:

x f(x)
0 1
1 3
2 5

3. What are the advantages of using closed form over discrete form?

The main advantage of using closed form is that it allows for a more concise and general representation of a function. This can be useful for performing calculations, making predictions, and proving mathematical properties. Closed form also allows for easier manipulation of the function using algebraic techniques.

4. When should I use closed form and when should I use discrete form?

The choice between using closed form or discrete form depends on the specific context and purpose of the function. Closed form is typically preferred when working with continuous functions, as it provides a more accurate and general representation. Discrete form may be more appropriate for representing functions with limited or discrete values, such as in computer programming or data analysis.

5. Are there any real-world applications for closed form and discrete form?

Yes, closed form and discrete form have many real-world applications in various fields, such as physics, engineering, economics, and computer science. For example, in physics, closed form equations are commonly used to model physical systems and make predictions. In computer science, discrete form is often used to represent and manipulate data in algorithms and programming languages.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
875
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
225
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
264
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
899
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top