### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# Principles of Public Health Informatics 173 120

UI

GPA 3.98

### View Full Document

## 40

## 0

## Popular in Course

## Popular in Epidemiology

This 31 page Class Notes was uploaded by Marlene Crist on Friday October 23, 2015. The Class Notes belongs to 173 120 at University of Iowa taught by Staff in Fall. Since its upload, it has received 40 views. For similar materials see /class/227977/173-120-university-of-iowa in Epidemiology at University of Iowa.

## Reviews for Principles of Public Health Informatics

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/23/15

PIECEWISE POLYNOMIAL INTERPOLATION Recall the examples of higher degree polynomial in terpolation of the function lt12gt 1 on 55 The interpolants Pnx oscillated a great deal whereas the function was nonoscillatory To obtain interpolants that are better behaved we look at other forms of interpolating functions Consider the data xlO 1 2253 35 4 yl25 05 05 15 15 1125 0 What are methods of interpolating this data other than using a degree 6 polynomial Shown in the text are the graphs of the degree 6 polynomial interpolant along with those of piecewise linear and a piecewise quadratic interpolating functions Since we only have the data to consider we would gen erally want to use an interpolant that had somewhat the shape of that of the piecewise linear interpolant LID The data points Piecewise linear interpolation J A M Polynomial Interpolation Piecewise quadratic interpolation PIECEWISE POLYNOMIAL FUNCTIONS Consider being given a set of data points 901341 acmyn with 1lt2ltltn Then the simplest way to connect the points xjyj is by straight line segments This is called a piecewise linear interpolant of the data xjyj This graph has corners and often we eXpect the interpolant to have a smooth graph To obtain a somewhat smoother graph consider using piecewise quadratic interpolation Begin by construct ing the quadratic polynomial that interpolates 1ay1 2ay2 3243 Then construct the quadratic polynomial that inter polates 37 y3 47 y4 57 y5 Continue this process of constructing quadratic inter polants on the subintervals 17 3 37 5 57 717 If the number of subintervals is even and therefore n is odd then this process comes out fine with the last interval being mn2xn This was illustrated on the graph for the preceding data If however n is even then the approximation on the last interval must be handled by some modification of this procedure Suggest such With piecewise quadratic interpolants however there are corners on the graph of the interpolating func tion With our preceding example they are at 3 and 5 How do we avoid this Piecewise polynomial interpolants are used in many applications We will consider them later to obtain numerical integration formulas SMOOTH NON OSCILLATORY INTERPOLATION Let data points 901341 acmyn be given as let 1lt2ltltn Consider finding functions 890 for which the follow ing properties hold 1 8xiyi 73 1n 2 890 sx s x are continuous on 901xn Then among such functions 890 satisfying these prop erties find the one which minimizes the integral n ls xl2 doc CI31 The idea of minimizing the integral is to obtain an in terpolating function for which the first derivative does not change rapidly It turns out there is a unique so lution to this problem and it is called a natural cubic spline function SPLINE FUNCTIONS Let a set of node points be given satisfying a 1lt2ltltn b for some numbers a and b Often we use ab 901xn A cubic spline function 890 on ab with breakpoints or knots has the following prop erties 1 On each of the intervals a7 1 17 2 397 71 17 71 717 890 is a polynomial of degree S 3 2 390 sx s x are continuous on ab In the case that we have given data points 901 acmyn we say 890 is a cubic interpolating spline function for this data if 3 yi 73 1 n EXAMPLE Define 3 3 ac 04 96 2 oz 96 00 0 96 S 04 This is a cubic spline function on oooo with the single breakpoint x1 04 Combinations of these form more complicated cubic spline functions For example 896 2 396 1 2gc 33 is a cubic spline function on 00 00 with the break points x1 1 2 3 Define 3 so mm Z aj 26 263 j1 with 19390 some cubic polynomial Then 890 is a cubic spline function on oooo with breakpoints 1n Return to the earlier problem of choosing an interpo lating function 890 to minimize the integral 71 2 ls l doc CI31 There is a unique solution to problem The solution 890 is a cubic interpolating spline function and more over it satisfies s 1 s n 0 Spline functions satisfying these boundary conditions are called natural cubic spline functions and the so lution to our minimization problem is a natural cubic interpolatory spline function We will show a method to construct this function from the interpolation data Motivation for these boundary conditions can be given by looking at the physics of bending thin beams of flexible materials to pass thru the given data To the left of 901 and to the right of am the beam is straight and therefore the second derivatives are zero at the transition points 901 and yen CONSTRUCTION OF THE INTERPOLATING SPLINE FUNCTION To make the presentation more specific suppose we have data 17y1 7 27y2 7 37y3 7 47y4 with 901 lt 902 lt 903 lt 904 Then on each of the intervals 17 2 7 27 3 7 37 4 890 is a cubic polynomial Taking the first interval 890 is a cubic polynomial and s x is a linear poly nomial Let Mi 2 s xi 7 1234 Then on 901902 2 M1 1M2 8 7 Cl32 3731 We can find 890 by integrating twice 2 96 M1 96 9603 M2 896 2 6 2 961 We determine the constants of integration by using Cl02 8961 7417 8962 y2 Then 2 96 M1 96 9603 M2 896 2 6 962 961 962 241 96 960242 T 962 961 962 961 6 962 96 M1 96 961 M2 for 901 SS2 Check that this formula satisfies the given interpola tion condition We can repeat this on the intervals 2 3 and 3 4 obtaining similar formulas For 2 3 963 96 M2 96 9623 M3 896 2 6 963 962 963 y2 96 2y3 I 963 962 3 2 6 963 96 M2 96 962 M3 For 3 S S 4 964 96 M3 96 33 M4 6 4 3 w4 y3 3y4 T 4 3 s 4 6 963 m 26 M3 w x3M41 We still do not know the values of the second deriv atives M1 M2 M3 M4 The above formulas guar antee that 890 and s x are continuous for 901 S 90 S 904 For example the formula on 901902 yields 8962 742 82 M2 The formula on 902903 also yields 8962 742 82 M2 All that is lacking is to make s x continuous at 2 and 903 Thus we require 8952 l39 0 5952 0 8963 O 8963 0 This means I lt96 lt96 and similarly for 3 To simplify the presentation somewhat I assume in the following that our node points are evenly spaced 21h 312h 413h Then our earlier formulas simplify to 2 96 M1 96 9603 M2 6h 2 yl 1y2 T h 962 26 M1 a x1 M2 896 2 for 901 S 90 S 902 with similar formulas on 2 3 and 3 4 Without going thru all of the algebra the conditions leads to the following pair of equations h 2h h M M M 6 1 3 2 6 3 y3 y2y2 y1 h h 2h h M M M 6 2 3 3 6 4 m m w h h This gives us two equations in four unknowns The earlier boundary conditions on s x gives us immedi ately M1 M4 0 Then we can solve the linear system for M2 and M3 EXAMPLE Consider the interpolation data points 90 1 2 3 4 y 1 i 3 Z In this case h 1 and linear system becomes 2M 1M 2 1 3 2 6 3 y3 y2 y1 3 1 2 1 M M 2 6 2 3 3 y4 243 242 12 This has the solution 1 M2 5 M3 0 This leads to the spline function formula on each subinterval On 12 962 96 M1 96 9603 M2 6h 962 96y1 1y2 39 h WQ N x M lt2 0 1PgtQ xy1 1M 896 2 6 1 1 62 0 1ltgt 2x 13 11 Similarly for 2 S 90 S 3 1 3 1 2 1 1 2 2 1 a Hm 4w 3 2 andfor3 x 4 1 1 5E 4Z x 1 2 3 4 y 1 i 3 Z y1x 1 08 06 04 02 0 05 1 15 2 25 3 35 4 Graph of example of natural cubic spline interpolation 96 0 1 2253 35 4 y 25 05 05 15 15 1125 0 X 1 2 3 4 Interpolating natural cubic spline function ALTERNATIVE BOUNDARY CONDITIONS Return to the equations hM 2hM hM 6 1 3 2 6 3 y3 y2y2 y1 h h hM 2hM hM 6 2 3 3 6 4 m m w h h Sometimes other boundary conditions are imposed on 890 to help in determining the values of M1 and M4 For example the data in our numerical exam ple were generated from the function With it f x and thus we could use 1 32 With this we are led to a new formula for one M1 2 M4 that approximates more closely THE CLAMPED SPLINE In this case we augment the interpolation conditions yi7 1727374 with the boundary conditions 8 1 y 8 4 y2 The conditions lead to another pair of equations augmenting the earlier ones Combined these equa tionsare h h 242 241 M M 3 16 2 h 91 h 2h h M M M 6 13 26 3 y3 y2y2 y1 h h 2h h M M M 6 23 36 4 m mm w h h h h y4 y3 3 M4yg 6 3 h For our numerical example it is natural to obtain these derivative values from f x 1 y 1 2451 1 6 When combined with your earlier equations we have the system 1M 1M 1 3 1 6 2 2 1 2 1 1 M M M 6 1 3 2 6 3 3 1M 2M 1M 1 6 2 3 3 6 4 12 1 1 1 M M 6 3 3 4 48 This has the solution 173 7 11 1 M7M7M7M 7 7 7 1 2 3 4 1206012060 We can now write the functions 890 for each of the subintervals 1902 2903 and 3904 Recall for 961 S 96 S 962 2 96 M1 96 9603 M2 896 2 6h 2 yl 1y2 T h h g 962 96 M1 96 961 M2 We can substitute in from the data 90 1 2 3 4 y 1 i 3 Z and the solutions Doing so consider the error As an example 1 3 2 3 65260 flag as flt2gt 3 82 This is quite a decent approximation THE GENERAL PROBLEM Consider the spline interpolation problem with n nodes 17 yl 7 27 y2 7 quot7 717 y and assume the node points are evenly spaced j1j lh j1n We have that the interpolating spline 890 on xj S 90 S gag1 is given by j1 96 Mi 90 03 Mj1 896 2 6h W1 96 w x 9 yj1 39 h h E 91 3 M x 30339 Mj1l forj 1n 1 To enforce continuity of sx at the interior node points 902 xn1 the second derivatives must satisfy the linear equations h 2h h y39 1 2y39y391 M M M 2 6 3 1 3 36 31 h for j 2 n 1 Writing them out h 2h h y1 2y2y3 M M M 6 1 3 26 3 h h 2h h y2 2y3y4 M M M 6 23 36 4 h h 2h h 39 yn2 2yn1yn M M M 6 2 3 16 h This is a system of 73 2 equations in the n unknowns M1 Two more conditions must be imposed on 890 in order to have the number of equations equal the number of unknowns namely n With the added boundary conditions this form of linear system can be solved very efficiently BOUNDARY CONDITIONS Natural boundary conditions 8 1 8 96n 0 Spline functions satisfying these conditions are called natural cubic splines They arise out the minimiza tion problem stated earlier But generally they are not considered as good as some other cubic interpolating splines Clamped boundary conditions We add the condi tions 8961 93 896n 971 with y lhyg given slopes for the endpoints of 890 on 901xn This has many quite good properties when compared with the natural cubic interpolating spline but it does require knowing the derivatives at the end points Not a knotquot boundary conditions This is more com plicated to explain but it is the version of cubic spline interpolation that is implemented in Matlab THE NOT A KNOT CONDITIONS As before let the interpolation nodes be 17 yl 7 27 y2 7 quot7 717 y We separate these points into two categories For constructing the interpolating cubic spline function we use the points 17 yl 7 37 y3 7 quot7 71 27 yn Z 7 717 y Thus deleting two of the points We now have n 2 points and the interpolating spline 890 can be deter mined on the intervals 17 3 7 37 4 7 397 71 37 71 21 7 71 27 71 This leads to n 4 equations in the n 2 unknowns M1 M3 Mn2 Mn The two additional boundary conditions are 8962 y2 896n 1 yn 1 These translate into two additional equations and we obtain a system of 71 2 linear simultaneous equations in the n 2 unknowns M1 M3 Mn2 Mn xiO 1 2253 35 4 yi25 05 05 15 15 1125 0 1 2 3 4 X Interpolating cubic spline function with not aknot boundary conditions MATLAB SPLINE FUNCTION LIBRARY Given data points 17 yl 7 27 y2 7 quot7 717 y type arrays containing the ac and y coordinates 96 1 2 y y1 y2 yn plot 9634 39039 The last statement will draw a plot of the data points marking them with the letter oh39 To find the inter polating cubic spline function and evaluate it at the points of another array was say hxn x11On xx1hxn use W spline 96 y 9696 plot 96 y 390 9696 2424 The last statement will plot the data points as be fore and it will plot the interpolating spline 890 as a continuous curve ERROR IN CUBIC SPLINE INTERPOLATION Let an interval a b be given and then define b a h jaj 1h j1n n 17 Suppose we want to approximate a given function on the interval ab using cubic spline inter polation Define j17 397n Let snx denote the cubic spline interpolating this data and satisfying the not a knot boundary con ditions Then it can be shown that for a suitable constant c E E lt h4 n gig lfx 8nl c The corresponding bound for natural cubic spline in terpolation contains only a term of h2 rather than h4 it does not converge to zero as rapidly Take ble gives values of the maximum error En for various values of n The values of h are being successively halved EXAMPLE arctan 90 on 0 5 n En EnEn 7 709E 3 13 324E 4 219 25 306E 5 106 49 148E 6 207 97 904E 8 164 The following ta

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

#### "Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over $500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.