Help with interpreting an interpolation problem

Click For Summary
SUMMARY

The discussion focuses on evaluating the trigonometric interpolant ##p_n(x)## using a MATLAB function for a given set of samples ##\bf{y}##, specifically testing the function with ##f(x) = 10cos(x)+5cos(3x)##. Participants clarify that the task involves calculating the maximum error ##max |p_n(x)-f(x)|## for various values of ##n (4, 8, 16, 32, 64)## and verifying that the error approaches machine precision for ##n=32,64##. The main confusion arises around whether to plot the maximum error for specific points or to create a continuous plot of the error function.

PREREQUISITES
  • Understanding of trigonometric interpolation
  • Familiarity with MATLAB or Julia programming
  • Knowledge of error analysis in numerical methods
  • Basic concepts of machine precision and numerical stability
NEXT STEPS
  • Learn how to implement trigonometric interpolation in MATLAB or Julia
  • Explore error analysis techniques in numerical computations
  • Study the concept of machine precision and its implications in numerical methods
  • Investigate plotting techniques for error functions in MATLAB or Julia
USEFUL FOR

Students and professionals in mathematics, computer science, or engineering who are working on numerical methods, particularly those dealing with interpolation and error analysis in programming environments like MATLAB or Julia.

PhysicsKid0123
Messages
95
Reaction score
1

Homework Statement


I don't know if this is the appropriate place to ask this, but I really do need some help. I am doing a homework problem and I don't understand what is being asked. It goes as follows:

> Write a MATLAB function to evaluate the trigonometric interpolant ##p_n(x)## for a given set of samples, ##\bf{y}##:

Here it follows with some comments about making such a function, I'll leave that out since it's not relevant, but it goes on to say:

> To test your program use ##f(x) = 10cos(x)+5cos(3x)## and plot the maximum error ##max |p_n(x)-f(x)|## for ##n= 4,8,16,32,64.## Verify that the maximum error is close to machine precision for ##n=32,64.## What is the reason behind this?

So I was able to find the interpolating function ##p_n(x)##, but I don't know what the next part is asking. Am I supposed to find the maximum value of ##g_n(x) = |p_n(x)-f(x)|## for each ##n##, say it is ##g_n(x_0)##, then plot ##g_i(x_0)## vs ##i## for ##i= 1...n##? So effectively, each value ##g_i(x_0)## is plotted on an ##y##- axis and ##i## on a corresponding ##x##-axis? Or am I simply supposed to make a plot of ##g_n(x) = |p_n(x)-f(x)|## for each n?

Also, how do I know when I am close to machine precision? When I start getting cancellation errors?

Thank in advance for the help.

By the way, I am using Julia to do this, not MATLAB.

Homework Equations


None are relevant to my question.

The Attempt at a Solution


No solution yet, I wouldn't be asking this question.
 
Last edited by a moderator:
Physics news on Phys.org
Sorry, I don't know how to enable LaTex.
 
PhysicsKid0123 said:
Sorry, I don't know how to enable LaTex.

Instead of $p_n(x)$, replace each starting and ending $ by #nospace# (two # signs with no space between them) for in-line formulas; that gives you ##p_n(x)##. If you want a displayed equation or formula, replace each starting and ending $ by $nospace$, that is, write two $ signs with no space between them. That gives you $$p_n(x)$$
 
Fixed the LaTeX in post #1.
 
Mark44 said:
Fixed the LaTeX in post #1.
Yes, I got it. Thank you.
 
Fixed the volume in post #1.
 

Similar threads

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