Difference between revisions of "EGR 103/Spring 2023/Lab 9"
Jump to navigation
Jump to search
(Created page with "The following document is meant as an outline of what is covered in this assignment. == Review For Lab == Note: Going forward, I will refer to the Sakai / Resources Folder /...") |
|||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Submitting Work == | == Submitting Work == | ||
− | There are Connect and Lab Assignment parts for almost every problem. The Connect parts and lab uploads are due the same day. | + | There are Connect and Lab Assignment parts for almost every problem. The Connect parts and lab uploads are due the same day, but you will want to get the work done far earlier than that to have time to put together your own lab report. |
− | * You can work in small groups to create the programs. Once the programs are done, you need to work individually on making the LaTeX document. | + | * You can work in small groups to create the programs. Once the '''''programs''''' are done, you need to work '''''individually''''' on making the LaTeX document. |
− | * Be sure to carefully read each problem - sometimes Connect will change a number or a prompt slightly from the book problem. | + | * Be sure to carefully read each problem - sometimes Connect will change a number or a prompt slightly from the book problem. '''Your PDF version should use the original values in the book problem''' so be sure to change them if needed after making calculations for Connect. |
* Once you get the Connect assignment 100% correct, you will be able to look at the assignments and the explanations for the answers. '''Note:''' if there is coding involved in an answer, the solution on Connect will be presented as MATLAB code; take a look to see the similarities and differences with Python. | * Once you get the Connect assignment 100% correct, you will be able to look at the assignments and the explanations for the answers. '''Note:''' if there is coding involved in an answer, the solution on Connect will be presented as MATLAB code; take a look to see the similarities and differences with Python. | ||
** Use <code>fig.set_size_inches(6, 4, forward=True)}</code> to make your graphs all the same size. | ** Use <code>fig.set_size_inches(6, 4, forward=True)}</code> to make your graphs all the same size. | ||
− | ** Be sure to use tight layout and save as a .png (graphics) file, not a .eps file. | + | ** Be sure to use tight layout and save the graph as a .png (graphics) file, not a .eps file. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Typographical Errors == | == Typographical Errors == | ||
Line 78: | Line 29: | ||
* See [[Python:Fitting#General_Linear_Regression]] | * See [[Python:Fitting#General_Linear_Regression]] | ||
+ | === Quick note on nonlinear regression === | ||
+ | You will be using nonlinear regression for the next two problems. The main Python method you will be using is: | ||
+ | * [https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html scipy.optimize.curve_fit] | ||
+ | |||
+ | Note that generally we will bring in <code>scipy.optimize</code> with | ||
+ | import scipy.optimize as opt | ||
+ | so the function calls will look like | ||
+ | opt.curve_fit() | ||
+ | |||
+ | In the documentation on Scipy, they bring in the entire optimize package with | ||
+ | from scipy import optimize | ||
+ | so their function calls look like | ||
+ | optimize.curve_fit() | ||
===Chapra 15.11=== | ===Chapra 15.11=== |
Latest revision as of 20:19, 22 March 2023
Contents
Submitting Work
There are Connect and Lab Assignment parts for almost every problem. The Connect parts and lab uploads are due the same day, but you will want to get the work done far earlier than that to have time to put together your own lab report.
- You can work in small groups to create the programs. Once the programs are done, you need to work individually on making the LaTeX document.
- Be sure to carefully read each problem - sometimes Connect will change a number or a prompt slightly from the book problem. Your PDF version should use the original values in the book problem so be sure to change them if needed after making calculations for Connect.
- Once you get the Connect assignment 100% correct, you will be able to look at the assignments and the explanations for the answers. Note: if there is coding involved in an answer, the solution on Connect will be presented as MATLAB code; take a look to see the similarities and differences with Python.
- Use
fig.set_size_inches(6, 4, forward=True)}
to make your graphs all the same size. - Be sure to use tight layout and save the graph as a .png (graphics) file, not a .eps file.
- Use
Typographical Errors
None yet!
Specific Problems
- Be sure to put the appropriate version of the honor code -- if you use the examples from Pundit, the original author is either DukeEgr93 or Michael R. Gustafson II depending on how you want to cite things.
Chapra 14.5
- See Python:Fitting#Polynomial_Fitting
- Be sure to also calculate and report \(s_{y/x}\) and \(r\).
Chapra 15.10
Chapra 15.10 Alternate
- See Python:Fitting#General_Linear_Regression
- Remember what you are trying to keep track of when discussing the reasonableness of your solution.
Chapra 15.12
Quick note on nonlinear regression
You will be using nonlinear regression for the next two problems. The main Python method you will be using is:
Note that generally we will bring in scipy.optimize
with
import scipy.optimize as opt
so the function calls will look like
opt.curve_fit()
In the documentation on Scipy, they bring in the entire optimize package with
from scipy import optimize
so their function calls look like
optimize.curve_fit()
Chapra 15.11
- See Python:Fitting#Nonlinear_Regression
- For the initial guesses, make sure you understand the subscripts for the parameters and then figure out how to approximate their values from the information provided in the problem.
Chapra 15.22
- See Python:Fitting#Nonlinear_Regression
- For the initial guesses, mainly note that choosing $$b=0$$ would be a terrible idea.