Programming > Research Paper > Baku Higher Oil School - PROGRAMMIN 101assignment5.py (All)
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# I. Linear least squares approximation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Consider a funct ... ion $y = f(x)$ which is defined by a set of values $y_0, y_1, \\cdots, y_n$ at points $x_0, x_1, \\cdots, x_n$." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "x = [-1, -0.7, -0.43, -0.14, -0.14, 0.43, 0.71, 1, 1.29, 1.57, 1.86, 2.14, 2.43, 2.71, 3]\n", "y = [-2.25, -0.77, 0.21, 0.44, 0.64, 0.03, -0.22, -0.84, -1.2, -1.03, -0.37, 0.61, 2.67, 5.04, 8.90]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### I.I. Find a best fit polynomial\n", "\n", "$$\n", "P_m(x) = a_0 + a_1 x + \\cdots + a_m x^m\n", "$$\n", "\n", "using the linear least squares approach. To this end\n", "\n", "1. implement a function which constructs the design matrix using $1, x, \\cdots, x^m$ as the basis functions.\n", "\n", "2. construct explicitly the normal system of equations of the linear least squares problem at fixed $m$.\n", "\n", "3. Solve the normal equations to find the coefficients of $P_m(x)$ for $m = 0, 1, 2, \\dots$. For the linear algebra problem, you can either use library functions (`numpy.linalg.solve`) or your LU factorization code from week 1.\n", "\n", "(20% of the total grade)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ [Show More]
Last updated: 3 years ago
Preview 1 out of 4 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Apr 12, 2021
Number of pages
4
Written in
All
This document has been written for:
Uploaded
Apr 12, 2021
Downloads
0
Views
88
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·