Help with interpreting an interpolation problem

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.
 
Prove $$\int\limits_0^{\sqrt2/4}\frac{1}{\sqrt{x-x^2}}\arcsin\sqrt{\frac{(x-1)\left(x-1+x\sqrt{9-16x}\right)}{1-2x}} \, \mathrm dx = \frac{\pi^2}{8}.$$ Let $$I = \int\limits_0^{\sqrt 2 / 4}\frac{1}{\sqrt{x-x^2}}\arcsin\sqrt{\frac{(x-1)\left(x-1+x\sqrt{9-16x}\right)}{1-2x}} \, \mathrm dx. \tag{1}$$ The representation integral of ##\arcsin## is $$\arcsin u = \int\limits_{0}^{1} \frac{\mathrm dt}{\sqrt{1-t^2}}, \qquad 0 \leqslant u \leqslant 1.$$ Plugging identity above into ##(1)## with ##u...
Back
Top