-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Week two assignment #38
base: master
Are you sure you want to change the base?
Conversation
Week two assignment.
plt.subplot(2,1,1) | ||
plt.scatter(x,y) | ||
fit_1 = np.polyfit(x,y,1) | ||
fit_lin = np.poly1d(fit_1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assignment requests that you use the curve fit
function to fit the cubic. It shouldn't be too difficult, so could you go back and change this to use that function?
#plt.title('x-y curve with Cubic Fit') | ||
|
||
# Compute the area using the composite Simpson's rule. | ||
area_s = simps(y, dx=0.5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! You could also use the quad
function. This uses Gaussian Quadrature and works on functions.
h_Linear = BIC(y,fit_lin(x),2) # for 1st order there are two coefficients | ||
print("h_Linear=",h_Linear) | ||
|
||
h_Cubic = BIC(y,fit_cubic(x),4) # 4 coefiicients for order 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like you caught on to the error I made in recitation, that cubic has 4 parameters, not 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comment on using the curve fit function
Week two assignment.
Description
Submission of week two assignment showing data plot fit with a linear and a cubic fit.
Weekly Journal
Based on the BIC both the fits are almost identical.
Questions