104A Homework 2

Java Python 104A Homework 2

July 2024

1 Theory

1.1 Splines

Let s(x) be the natural cubic spline on [a, b] i.e. s(x) = si(x) on [xi , xi+1], i = 0, . . . ,(n − 1). Show that

for any g ∈ C2([a, b]) such that g(xi) = yi , i = 0, . . . , n. Hint: consider h(x) = s(x) − g(x) and rewrite g(x).

1.2 Lagrange

Prove that the functions form. a basis for degree n polynomials.

2 Coding

2.1 Spline

Consider data points (xi, yi) wi 104A Homework 2 th {xi} equidistant. Let h = (xi+1 − xi) for any i = 0, . . . ,(n − 1) and s(x) the piecewise natural cubic spline. Denote zi = s ′′(xi). The tridiagonal system stems from equation (10) in Chapter 6.4,

Setup and solve the tridiagonal system for , you can use (Scipy) or (R) linear algebra libraries. The splines then can be evaluated with and equation (7) in Chapter 6.4. Evaluate them at a given set of test values. Use the function signature,

findAndEvalSpline(double[] x data, double[] y data, double[] x testVals) return double[] spline testVals         

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值