Reader small image

You're reading from  Scientific Computing with Python 3

Product typeBook
Published inDec 2016
Reading LevelBeginner
PublisherPackt
ISBN-139781786463517
Edition1st Edition
Languages
Right arrow
Authors (3):
Claus Führer
Claus Führer
author image
Claus Führer

Claus Führer is a professor of scientific computations at Lund University, Sweden. He has an extensive teaching record that includes intensive programming courses in numerical analysis and engineering mathematics across various levels in many different countries and teaching environments. Claus also develops numerical software in research collaboration with industry and received Lund University's Faculty of Engineering Best Teacher Award in 2016.
Read more about Claus Führer

View More author details
Right arrow

Exercises


Ex. 1 → Consider a 4 × 3 matrix M:

  1. Construct this matrix in Python using the function array .
  2. Construct the same matrix using the function arange  followed by a suitable reshape.
  3. What is the result of the expression M[2,:] ? What is the result of the similar expression M[2:]?

Ex. 2 → Given a vector x, construct in Python the following matrix:

                 

Here, xi are the components of the vector x (numbered from zero). Given a vector y, solve in Python the linear equation system Va = y. Let the components of a be denoted by ai, i = 0, ..., 5. Write a function poly, which has a and z as input and which computes the polynomial:

Plot this polynomial and depict in the same plot the points (xi , yi ) as small stars. Try your code with the vectors:

  • x = (0.0, 0.5, 1.o, 1.5, 2.0, 2.5)
  • y = (-2.0, 0.5, -2.0, 1.0, -0.5, 1.0)

Ex. 3 → The matrix V in Ex. 2 is called a Vandermonde matrix. It can be set up in Python directly by the command vander. Evaluating a polynomial defined by a coefficient...

lock icon
The rest of the page is locked
Previous PageNext Chapter
You have been reading a chapter from
Scientific Computing with Python 3
Published in: Dec 2016Publisher: PacktISBN-13: 9781786463517

Authors (3)

author image
Claus Führer

Claus Führer is a professor of scientific computations at Lund University, Sweden. He has an extensive teaching record that includes intensive programming courses in numerical analysis and engineering mathematics across various levels in many different countries and teaching environments. Claus also develops numerical software in research collaboration with industry and received Lund University's Faculty of Engineering Best Teacher Award in 2016.
Read more about Claus Führer