EGR 103/Spring 2023/Lab 11

From PrattWiki
Jump to navigation Jump to search

Assignment

You will be using root-finding to solve several engineering problems. The main Python methods you will be using are:

Note that generally we will bring in scipy.optimize with

import scipy.optimize as opt

so the function calls will look like

opt.brentq()
opt.root()

In the documentation on Scipy, they bring in the entire optimize package with

from scipy import optimize

so their function calls look like

optimize.brentq()
optimize.root()

Chapra 6.13

  • See Python:Finding_roots
  • For the plot, use $$T$$ values from 0 to 1200 K
  • Use opt.brentq() for this. Remember that you do not need to work too hard to make a narrow bracket - just look at the graph and figure out values to the left and right of the root you want.

Chapra 6.14

  • See Python:Finding_roots
  • Use opt.brentq() for this. Remember that you do not need to work too hard to make a narrow bracket - just look at the graph and figure out values to the left and right of the root you want.

Chapra 6.16

  • See Python:Finding_roots
  • You should probably use opt.brentq() for this as using an open method like opt.root() could fail.

Chapra 6.33

  • See Python:Finding_roots
  • You must use opt.root() rather than opt.brentq() to get full credit here. You do not need to write a Newton-Raphson routine.