4 Problems for Assignment 1 - Numerical Computations | MATH 451, Assignments of Mathematics

Material Type: Assignment; Class: Numerical Computations; Subject: Mathematics; University: Penn State - Main Campus; Term: Spring 2005;

Typology: Assignments

Pre 2010

Uploaded on 09/24/2009

koofers-user-ubk
koofers-user-ubk 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE/MATH 451: Numerical Computations, spring 2005,
section 2
Homework 1
Instructor: Wen Shen
Deadline: Friday Jan 28, in class.
Problem 1:
Convert to hexadecimal, to octal, and then to decimal.
a). (110111001.101011101)2
b). (1001100101.01101)2
Problem 2:
For some values of x, the function f(x) = x2+ 1 xcannot be accurately computed by
using this formula. Explain and find a way around the difficulty.
Problem 3:
How can the values of the function f(x) = x+ 2 xbe computed accurately when xis
large?
Problem 4: Matlab exercises:
The goal of this exercise is to get started with Matlab. You will go through:
Matrix, vector, solutions of systems of linear equations;
simple plots;
Use of Matlab’s own help functions.
The target problem: Find the interpolating polynomial
p3(x) = a3x3+a2x2+a1x+a0(1)
that interpolates the following data points:
xi0 5 10 15
yi382 9 (2)
Preparations:
1
pf3

Partial preview of the text

Download 4 Problems for Assignment 1 - Numerical Computations | MATH 451 and more Assignments Mathematics in PDF only on Docsity!

CSE/MATH 451: Numerical Computations, spring 2005,

section 2

Homework 1

Instructor: Wen Shen

Deadline: Friday Jan 28, in class.

Problem 1: Convert to hexadecimal, to octal, and then to decimal. a). (110111001.101011101) 2 b). (1001100101.01101) 2

Problem 2: For some values of x, the function f (x) =

x^2 + 1 − x cannot be accurately computed by using this formula. Explain and find a way around the difficulty.

Problem 3: How can the values of the function f (x) =

x + 2 −

x be computed accurately when x is large?

Problem 4: Matlab exercises: The goal of this exercise is to get started with Matlab. You will go through:

  • Matrix, vector, solutions of systems of linear equations;
  • simple plots;
  • Use of Matlab’s own help functions.

The target problem: Find the interpolating polynomial

p 3 (x) = a 3 x^3 + a 2 x^2 + a 1 x + a 0 (1)

that interpolates the following data points:

xi 0 5 10 15 yi 3 8 − 2 9

Preparations:

a) Show that the coefficients to the interpolating polynomial (1) can be found by solving   

a 0 a 1 a 2 a 3

b) Read Ch. 1 and 2 in “A Practical Introduction to Matlab” by Gockenbach (you find it at the web-page of the course).

How do you do it:

Introduction

Find a computer with Matlab installed in it. Start Matlab, by either click on the appropriate icon(Windows), or by typing in matlab (unix or linux). You should get a command window on the screen. Go through the examples in Gockenbach’s notes.

Linear equations Solve the system of linear equations (3). The interpolating polynomial should be

p 3 (x) = 0. 048 x^3 − 1. 02 x^2 + 4. 9 x + 3.

Simple plots Plot the interpolating points and the interpolating polynomial. In addition to the function plot try also: grid on/off: add or remove a grid on the plot. xlabel(’text’): put text under x-axis. ylabel(’text’): put text next to y-axis. title(’text’): put text above the plot.

Help! As we will see later, Matlab has many build-in numerical functions. One among them is a function that does polynomial interpolation. But what is the name, and how to use it? Here we will see how we could use lookfor to find the function, and help to get a description on how to use it. lookfor keyword: Look after the “keyword” among Matlab functions. Try for example: lookfor polynomial

and see what you can find. Suppose you get polyfit and polyval as your candidates. For more information on them you can type: help function, and in our case you type: help polyfit, which gives:

POLYFIT Fit polynomial to data. POLYFIT(X,Y,N) finds the coefficients of a polynomial P(X) of