Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(C++) Implement the code shown in C++. Create the Test_Spline3() program that determines the natural cubic spline interpolant for sin x at 10 equidistant knots

image text in transcribed

(C++) Implement the code shown in C++. Create the Test_Spline3() program that determines the natural cubic spline interpolant for sin x at 10 equidistant knots in the interval [0,1.6875]. Over the same interval, subdivide each subinterval into four equally spaced parts, and find the point where the value of |sin x S(x)| is the largest. At the minimum, please do the pseudocode so I can do the math portion. I have a hard time doing pseudocode, it would help to see how it looks correctly

V { Spline3 Coef Pseudocode procedure Spline3 Coef (n. (ti), (yi), (z:)) integer i, n; real array(t)on (yon, (zon allocate real array (hi)0:2-1, (b):1-1, (u):-1, (V;:-1 for i = 0 ton-1 h; i+1-1 b; - (Y+1 - yi)/h end for 20ho th) 6(b-bo) for i = 2 to n-1 u; + 2(h; +hi-1) - },/u;-1 V - 6(bi - b1) - hi-1051Mi-1 end for 20 for i = n - 1 to 1 step - 1 Zi (v; hizi+1)/u; end for 200 deallocate array (h;), (b), (u), (v) end procedure Spline3.Coef Now a procedure called Spline3_Eval is written for evaluating Equation (12), the natural cubic spline function S(x), for x a given value. The procedure Spline3 Eval first determines the interval [ti, li +1] that contains x and then evaluates S(x) using the nested form of this cubic polynomial: Spline3 Eval Pseudocode real function Spline3 Evalin. (), (yi), (z.), x) integer i; real h, tmp real array(t)o:n, (yi)on, (zio:n for i = n - 1 to 0 step - 1 if x - 20 then exit loop end for h 1+1-11 imp (zi/2) + (x - 1)(zi+1 - 2i)/h) tmp-(h/6)(2+1 +22) + (9i+1 :)/h + (x - 1)(tmp) Spline3. Eval+ (x - 1)(mp) end function Spline3 Eval

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago