
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

MA-334 Computer Programming - Exam 3
April 30, 2009 Please be sure to show all work. No credit can be given if your answers are not substantiated.
number k if jxj < 1. For k =
the sum simpliÖes to the following formula:
(1 + x) ^1 =^2 = 1
x +
x^2
x^3 + + ( 1)k^
1 3 5 (2k 1) 2 4 6 (2k)
xk^ +
Write a Python function invRoot(xvl,nmax) to compute and return the sum for an input xvl up to term nmax.
Write an appropriate introductory statement for the user.
Contain appropriate comment statements.
Set the variable nordr automatically based on the length of the list coef (so that if a di§erent coef is declared, nordr will be automatically set accordingly).
Make the loop with variable kntr work for any length of the list of x-values (the list eksz).
matrix (using the len() function). For example, if A =
(^5) and the rows to swap are 2 and
3, then the output should be something like Swapping rows 2 and 3 of the matrix A gives PA=[[1,5],[3,8],[0,-9]].
= f (t; y) ; y (t 0 ) = y 0 :
There are several other methods that are more sophisticated and give better results on average. One such method is the Midpoint Method:
yi+1 = yi + h
f
ti +
h 2
; yi +
h 2
f (ti; yi)
where yi+1 y (ti+1) and ti+1 = ti + h. Use this method to approximate y (3) for the initial value problem y^0 = 1 + (t y)^2 ; y (2) = 1 with h = 0: 5.