Help with interpreting an interpolation problem

  • #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:

Answers and Replies

  • #2
Sorry, I don't know how to enable LaTex.
 
  • #3
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,728
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)$$
 
  • #6
14,131
11,412
Fixed the volume in post #1.
 

Related Threads on Help with interpreting an interpolation problem

  • Last Post
Replies
5
Views
2K
  • Last Post
Replies
1
Views
3K
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
3
Views
2K
Replies
0
Views
2K
  • Last Post
Replies
2
Views
870
  • Last Post
Replies
0
Views
701
  • Last Post
Replies
3
Views
1K
Top