More on Curve Fitting

Size: px
Start display at page:

Download "More on Curve Fitting"

Transcription

1 PHY 310 DataAnalysis 5 More on Curve Fitting In [1]: # All the standard "import" stuff import scipy as sp from scipy.optimize import curve_fit from scipy.linalg import lstsq import matplotlib.pyplot as plt %matplotlib inline In [2]: # M.L. modifications of matplotlib defaults using syntax of v.2.0 # More info at # Changes can also be put in matplotlibrc file, or effected using mpl.rcparams[] plt.rc('figure', figsize = (6, 4.5)) # Reduces overall size of figures plt.rc('axes', labelsize=16, titlesize=14) plt.rc('xtick', labelsize=14) plt.rc('ytick', labelsize=14) #plt.rc('figure', autolayout = True) # Adjusts supblot parameters for Setting things up for the curve-fitting. The following block is the part that you change to determine what type of function you are fitting to. In its current form, you are fitting to a polynomial. In fact, it's just a linear regression. If you want a higher-order polynomial, then uncomment the X2 line and return X2 for a quadratic function, make a X3 = x**3 line and return X3 for a cubic, etc. On the other hand, if you want to fit to a function f(x) = acos(x) + bsin(x) or whatever, then put in something like "X1 = cos(x)" etc. In [3]: # Basis functions for linear model: func = a0*x0 + a1*x1 + a2*x def basis(x): ''' Returns basis functions for linear model The function to be fit is assumed to be of the form f(x) = a0*x0 + a1*x1 + a2*x2 + a3*x where a0, a1, a2,... are constants, and X0, X1, X2,... are defined below. ''' #Uncomment the next line if you want a quadratic fit # X2 = x**2 X1 = x X0 = 0.*X # Need array of len(x), thus the 0.*X1 # Swap the next two lines if you want quadratic # return sp.array([x0,x1,x2]) return sp.array([x0,x1]) Leave the following two blocks alone. (Although you need to evaluate

2 them again if you change the basis.) In [4]: In [5]: def func(x, a): '''Given basis functions and coefficients, returns value of linear function'' return sp.dot(basis(x).t, a) def LinearModelFit(x, y, u): '''Performs linear least squares fit to a set of 2-d data with uncertainties x = array of x values [x0, x1, x2,...] y = array of values of dependent variable [y0, y1, y2,...] u = array of uncertainties for dependent variable [u0, u1, u2,...] ''' X = basis(x).t # Basis functions evaluated at all x (the X_j(x_i)) of N.R.) W = sp.diag(1/u) # Matrix with uncertainties on diagonal Xw = sp.dot(w,x) # A_ij of Eq. (14.3.4) Yw = sp.dot(y,w) # b_i of Eq. (14.3.5) fit = sp.linalg.lstsq(xw,yw) # lstq returns: best values, chi2,... covariance = sp.linalg.inv(sp.dot(xw.t,xw)) uncertainty = sp.sqrt(sp.diag(covariance)) return(fit[0], uncertainty,fit[1], covariance) Okay, we now have everything set up to do the curve-fitting. Onward to the data... Four data sets for class Change whichever data set you want to use to the name "data" and then take it from there. In [33]: #x-values will be the same for all the data sets xvals = sp.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) #First data set yvals = sp.array([ , , , , , , errvals = sp.array([0.5, 0.4, 0.6, 0.5, 0.4, 0.6, 0.5, 0.5, 0.6, 0.5]) #Second data set yvals2 = sp.array([ , , , , , , errvals2 = sp.array([0.05, 0.04, 0.06, 0.05, 0.04, 0.06, 0.05, 0.05, 0.06, 0.05]) #Third data set yvals3 = sp.array([ , , , , , , errvals3 = sp.array([0.5, 0.6, 1.2, 1.5, 2.4, 3.6, 3.5, 4.5, 4.6, 5.5]) #Fourth data set yvals4 = sp.array([ , , , , , , errvals4 = sp.array([0.5, 0.4, 0.6, 0.5, 0.4, 0.6, 0.5, 0.5, 0.6, 0.5]) yvals5 = sp.array([ , , , , , , , errvals5 = sp.array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])

3 In [34]: #We can plot the values with their correponding errorbars plt.errorbar(xvals,yvals,errvals, fmt = 'k.') plt.xlabel('x') plt.ylabel('y') Out[34]: <matplotlib.text.text at 0x > Okay, now do the fit. Returns a: array of coefficients of basis function unc: array of uncertainties for these coefficients chi2: value of χ 2 (not reduced) cov: covariance matrix In [35]: a,unc,chi2,cov = LinearModelFit(xvals,yvals,errvals) In [36]: print('the fitted coefficients',a) print('uncertainties in those values',unc) The fitted coefficients [ ] Uncertainties in those values [ ] Okay, let's plot again but with the fit so that we can see how it looks.

4 In [37]: xfine = sp.linspace(min(xvals), max(xvals), 201) # "quasi-continuous" set of x's # plt.figure(2) # I'm not sure what this does. # plt.title("data with linear best fit",fontsize=14) # This is here if you want a plt.xlabel('$x$') plt.ylabel('$y$') # plt.axhline(0, color='magenta') # This is here if you want to plot a horizontal # plt.xlim(min(xvals)-0.05*(max(xvals)-min(xvals)), max(xvals)+ 0.05*(max(xvals)-m plt.errorbar(xvals, yvals, yerr=errvals, fmt='o') plt.plot(xfine, func(xfine, a)); Okay, now let's determine residuals

5 In [38]: Out[38]: res=func(xvals,a)-yvals #And let's plot them. plt.xlabel('$x$') plt.ylabel('$residuals$') plt.axhline(0, color='magenta') # Let's plot a horizontal line at zero to make it plt.scatter(xvals,res) <matplotlib.collections.pathcollection at 0x886ec18> Now, for normalized residuals

6 In [39]: Out[39]: normres=res/errvals #And let's plot them. plt.xlabel('$x$') plt.ylabel('$normalized residuals$') plt.axhline(0, color='magenta') # Let's plot a horizontal line at zero to make it plt.axhline(1, color='green') # In fact, let's plot horizontal lines at 1 and -1, plt.axhline(-1, color='green') plt.scatter(xvals,normres) <matplotlib.collections.pathcollection at 0xb6fa8d0> χ 2 χ 2 χ 2 Okay, now we will determine and reduced. We are going to calculate this manually, even though the curve fitting program returns.

7 In [40]: chisq = sp.sum(normres**2) print("chi-squared is",chisq) # And let's check to see if the linear model fit came up with the same chi-squared print("chi-squared returned by the Linear Model Fit function:", chi2) DegreesOfFreedom=len(xvals)-len(a) #Number of points in fit minus number of parame RedChisq = chisq/degreesoffreedom print("degrees of freedom is", DegreesOfFreedom) print("reduced Chi-squared is", RedChisq) Chi-squared is Chi-squared returned by the Linear Model Fit function: Degrees of freedom is 8 Reduced Chi-squared is Okay, we're going to get fancy now. We are going to look at the parameter space and plot contour maps of reduced. χ 2 In [41]: In [42]: def RedChiFunc(slope, intercept): # res=func(xvals,sp.array([intercept,slope]))-yvals res=(intercept+slope*xvals-yvals) normres = res/errvals chisq = sp.sum(normres**2) RedChisq = chisq/degreesoffreedom return RedChisq# # Let's test it out. Presumably, if we put the best values of slope and intercep # we should get the reduced chi-squared that we calculated above. print(a[0],a[1]) print(redchifunc(a[1],a[0])) Okay, we got the same result for the reduced chi-squared, so we probably have the function defined correctly. Now, do a contour plot of the reduced chi-squared.

8 In [43]: numvals=50 minslope=-4.0 maxslope=0.0 minint=0.0 maxint=10.0 slopevals=sp.linspace(minslope,maxslope,numvals) intvals=sp.linspace(minint,maxint,numvals) SLOPE, INT = sp.meshgrid(slopevals,intvals) ZVALS = sp.zeros((len(slope),len(int))) for i in range(len(slope)): for j in range(len(int)): ZVALS[i,j]=RedChiFunc(SLOPE[i,j],INT[i,j])# #ZVALS2 = ZVALS - RedChiFunc(a[1],a[0]) # to subtract off the minimum value of ch #cs=plt.contour(slope,int,zvals2,levels=[1,5,10,20,50],colors="k") cs=plt.contour(slope,int,zvals,levels=[1,5,10,20,50],colors="k") plt.xlabel("slope") plt.ylabel("intercept") plt.clabel(cs) Out[43]: <a list of 4 text.text objects> You want to do a few things here. First, zoom in around the minimum. Second, uncomment the lines that calculate zvals2 which is the reduced χ 2 χbest 2 and then replot the contours. The uncertainties are determined by looking at the contour of χr 2 χbest 2 = 1. If I uncommented the line that does the contour plot of χ 2 χ (i.e., subtract off the minimum value of ), I end up with an oval that extends from about to or so, giving an 2.28 ( 2.55) uncertainty α m or so. And the uncertainty in intercept is roughly 2

9 α b or so. The fitting program came up with uncertainties of around 0.3 for the intercept and 0.05 for slope. The reason for the difference is explained in Taylor and Hase: what I did in the previous paragraph isn't quite right. You shouldn't take the min and max values for the χr 2 1 contour. Instead, you should look at max and mins when cutting horizontally and vertically across the oval through the 2.32 ( 2.48) center. When we do that, we find an uncertainty in slope of 0.08, and an uncertainty in intercept of 0.3 or 0.4, both of which are closer to what the fitting routine 2 returned. For data set #5. Presumably, when you have looked at this, you'll see that a linear fit sucks. Of course, you can add more terms in the polynomial, but another approach is to try a log-log fit. Note that to plot uncertainties in the log of the data, we can use (to first approximation) the calculus f approach: if we define a function f(y) = ln(y), then the uncertainty α f = α 1 =. y y y α y In [26]: In [27]: Out[27]: xvalslog = sp.log(xvals) yvalslog = sp.log(yvals) errvalslog = 1.0/yvals # (I'm putting in 1.0 for alpha_y) #We can plot the values with their correponding errorbars plt.errorbar(xvalslog,yvalslog,errvalslog, fmt = 'k.') plt.xlabel('logx') plt.ylabel('logy') <matplotlib.text.text at 0x8775be0>

10 Note that the error bars get smaller with larger values. (By the way, the error bars really would be asymmetrical here.) Now, do a fit. In [32]: a,unc,chi2,cov = LinearModelFit(xvalslog,yvalslog,errvalslog) print('the fitted coefficients',a) print('uncertainties in those values',unc) print('chi-squared is ', chi2) print('reduced chi-squared is ', chi2/8) #Divide by 8 because 10 data points and The fitted coefficients [ ] Uncertainties in those values [ ] Chi-squared is Reduced chi-squared is Plot with the fit. In [31]: xfine = sp.linspace(min(xvalslog), max(xvalslog), 201) # "quasi-continuous" set o plt.xlabel('$logx$') plt.ylabel('$logy$') plt.errorbar(xvalslog, yvalslog, yerr=errvalslog, fmt='o') plt.plot(xfine, func(xfine, a)); In [ ]:

11

Nonlinear curve-fitting example

Nonlinear curve-fitting example Nonlinear curve-fitting example Implementation of curve-fitting in Python. Compare with results of Mathematica for same data sets: see pythontest.nb. In [1]: import scipy as sp from scipy.optimize import

More information

Problems from Hughes and Hase

Problems from Hughes and Hase Problems from Hughes and Hase In [1]: import scipy as sp from scipy import stats import matplotlib as mpl # As of July 017 Bucknell computers use v..x import matplotlib.pyplot as plt # Following is an

More information

PHY Introduction to Python Programming, week 5

PHY Introduction to Python Programming, week 5 PHY1024 - Introduction to Python Programming, week 5 The lecture materials, worksheets, and assignments can all be found here: http://go.qub.ac.uk/phy1024y2016 (http://go.qub.ac.uk/phy1024y2016) Lecture

More information

Interpolation and curve fitting

Interpolation and curve fitting CITS2401 Computer Analysis and Visualization School of Computer Science and Software Engineering Lecture 9 Interpolation and curve fitting 1 Summary Interpolation Curve fitting Linear regression (for single

More information

Bi 1x Spring 2014: Plotting and linear regression

Bi 1x Spring 2014: Plotting and linear regression Bi 1x Spring 2014: Plotting and linear regression In this tutorial, we will learn some basics of how to plot experimental data. We will also learn how to perform linear regressions to get parameter estimates.

More information

import matplotlib as mpl # As of July 2017 Bucknell computers use v. 2.x import matplotlib.pyplot as plt

import matplotlib as mpl # As of July 2017 Bucknell computers use v. 2.x import matplotlib.pyplot as plt PHYS 310 HW Problem Simulation of PHYS 211 M&M Experiment 6 Colors: Yellow, Blue, Orange, Red, Green, and Blue Assume 60 M&Ms in every bag Assume equal probabilities (well mixed, large "reservoir") Assume

More information

For examples, documentation, tutorials, etc, see Astropy at ( # For retrieving an image from a URL

For examples, documentation, tutorials, etc, see Astropy at   (  # For retrieving an image from a URL Astronomy example 1 Downloading images and writing FITS files For examples, documentation, tutorials, etc, see Astropy at http://www.astropy.org (http://www.astropy.org) In [1]: import scipy as sp import

More information

5.1 Introduction to the Graphs of Polynomials

5.1 Introduction to the Graphs of Polynomials Math 3201 5.1 Introduction to the Graphs of Polynomials In Math 1201/2201, we examined three types of polynomial functions: Constant Function - horizontal line such as y = 2 Linear Function - sloped line,

More information

Derek Bridge School of Computer Science and Information Technology University College Cork

Derek Bridge School of Computer Science and Information Technology University College Cork CS468: Artificial Intelligence I Ordinary Least Squares Regression Derek Bridge School of Computer Science and Information Technology University College Cork Initialization In [4]: %load_ext autoreload

More information

Sketching graphs of polynomials

Sketching graphs of polynomials Sketching graphs of polynomials We want to draw the graphs of polynomial functions y = f(x). The degree of a polynomial in one variable x is the highest power of x that remains after terms have been collected.

More information

Tutorial Four: Linear Regression

Tutorial Four: Linear Regression Tutorial Four: Linear Regression Imad Pasha Chris Agostino February 25, 2015 1 Introduction When looking at the results of experiments, it is critically important to be able to fit curves to scattered

More information

Quadratic Functions. *These are all examples of polynomial functions.

Quadratic Functions. *These are all examples of polynomial functions. Look at: f(x) = 4x-7 f(x) = 3 f(x) = x 2 + 4 Quadratic Functions *These are all examples of polynomial functions. Definition: Let n be a nonnegative integer and let a n, a n 1,..., a 2, a 1, a 0 be real

More information

Math 182. Assignment #4: Least Squares

Math 182. Assignment #4: Least Squares Introduction Math 182 Assignment #4: Least Squares In any investigation that involves data collection and analysis, it is often the goal to create a mathematical function that fits the data. That is, a

More information

Polynomial and Rational Functions. Copyright Cengage Learning. All rights reserved.

Polynomial and Rational Functions. Copyright Cengage Learning. All rights reserved. 2 Polynomial and Rational Functions Copyright Cengage Learning. All rights reserved. 2.1 Quadratic Functions Copyright Cengage Learning. All rights reserved. What You Should Learn Analyze graphs of quadratic

More information

Derek Bridge School of Computer Science and Information Technology University College Cork

Derek Bridge School of Computer Science and Information Technology University College Cork CS4619: Artificial Intelligence II Overfitting and Underfitting Derek Bridge School of Computer Science and Information Technology University College Cork Initialization In [1]: %load_ext autoreload %autoreload

More information

An introduction to plotting data

An introduction to plotting data An introduction to plotting data Eric D. Black California Institute of Technology February 25, 2014 1 Introduction Plotting data is one of the essential skills every scientist must have. We use it on a

More information

Core Mathematics 3 Functions

Core Mathematics 3 Functions http://kumarmaths.weebly.com/ Core Mathematics 3 Functions Core Maths 3 Functions Page 1 Functions C3 The specifications suggest that you should be able to do the following: Understand the definition of

More information

9.1: GRAPHING QUADRATICS ALGEBRA 1

9.1: GRAPHING QUADRATICS ALGEBRA 1 9.1: GRAPHING QUADRATICS ALGEBRA 1 OBJECTIVES I will be able to graph quadratics: Given in Standard Form Given in Vertex Form Given in Intercept Form What does the graph of a quadratic look like? https://www.desmos.com/calculator

More information

User-Defined Function

User-Defined Function ENGR 102-213 (Socolofsky) Week 11 Python scripts In the lecture this week, we are continuing to learn powerful things that can be done with userdefined functions. In several of the examples, we consider

More information

Warm-Up Exercises. Find the x-intercept and y-intercept 1. 3x 5y = 15 ANSWER 5; y = 2x + 7 ANSWER ; 7

Warm-Up Exercises. Find the x-intercept and y-intercept 1. 3x 5y = 15 ANSWER 5; y = 2x + 7 ANSWER ; 7 Warm-Up Exercises Find the x-intercept and y-intercept 1. 3x 5y = 15 ANSWER 5; 3 2. y = 2x + 7 7 2 ANSWER ; 7 Chapter 1.1 Graph Quadratic Functions in Standard Form A quadratic function is a function that

More information

Today is the last day to register for CU Succeed account AND claim your account. Tuesday is the last day to register for my class

Today is the last day to register for CU Succeed account AND claim your account. Tuesday is the last day to register for my class Today is the last day to register for CU Succeed account AND claim your account. Tuesday is the last day to register for my class Back board says your name if you are on my roster. I need parent financial

More information

Calculator Basics TI-83, TI-83 +, TI-84. Index Page

Calculator Basics TI-83, TI-83 +, TI-84. Index Page Calculator Basics TI-83, TI-83 +, TI-84 Index Page Getting Started Page 1 Graphing Page 2 Evaluating Functions page 4 Minimum and Maximum Values Page 5 Table of Values Page 6 Graphing Scatter Plots Page

More information

Numerical Calculations

Numerical Calculations Fundamentals of Programming (Python) Numerical Calculations Sina Sajadmanesh Sharif University of Technology Some slides have been adapted from Scipy Lecture Notes at http://www.scipy-lectures.org/ Outline

More information

EXAMPLE. 1. Enter y = x 2 + 8x + 9.

EXAMPLE. 1. Enter y = x 2 + 8x + 9. VI. FINDING INTERCEPTS OF GRAPHS As we have seen, TRACE allows us to find a specific point on the graph. Thus TRACE can be used to solve a number of important problems in algebra. For example, it can be

More information

Lecture 8. Divided Differences,Least-Squares Approximations. Ceng375 Numerical Computations at December 9, 2010

Lecture 8. Divided Differences,Least-Squares Approximations. Ceng375 Numerical Computations at December 9, 2010 Lecture 8, Ceng375 Numerical Computations at December 9, 2010 Computer Engineering Department Çankaya University 8.1 Contents 1 2 3 8.2 : These provide a more efficient way to construct an interpolating

More information

import matplotlib as mpl # As of July 2017 Bucknell computers use v. 2.x import matplotlib.pyplot as plt

import matplotlib as mpl # As of July 2017 Bucknell computers use v. 2.x import matplotlib.pyplot as plt Intro to sympy: variables differentiation integration evaluation of symbolic expressions In [1]: import sympy as sym sym.init_printing() # for LaTeX formatted output import scipy as sp import matplotlib

More information

AP Calculus Problems with HP Prime

AP Calculus Problems with HP Prime AP Calculus Problems with HP Prime G. T. Springer Email: gt.springer@hp.com Hewlett-Packard Calculators and Educational Software In this hands-on workshop, participants will explore a number of problems

More information

#To import the whole library under a different name, so you can type "diff_name.f unc_name" import numpy as np import matplotlib.

#To import the whole library under a different name, so you can type diff_name.f unc_name import numpy as np import matplotlib. In [1]: #Here I import the relevant function libraries #This can be done in many ways #To import an entire library (e.g. scipy) so that functions accessed by typing "l ib_name.func_name" import matplotlib

More information

3.1 INTRODUCTION TO THE FAMILY OF QUADRATIC FUNCTIONS

3.1 INTRODUCTION TO THE FAMILY OF QUADRATIC FUNCTIONS 3.1 INTRODUCTION TO THE FAMILY OF QUADRATIC FUNCTIONS Finding the Zeros of a Quadratic Function Examples 1 and and more Find the zeros of f(x) = x x 6. Solution by Factoring f(x) = x x 6 = (x 3)(x + )

More information

A function: A mathematical relationship between two variables (x and y), where every input value (usually x) has one output value (usually y)

A function: A mathematical relationship between two variables (x and y), where every input value (usually x) has one output value (usually y) SESSION 9: FUNCTIONS KEY CONCEPTS: Definitions & Terminology Graphs of Functions - Straight line - Parabola - Hyperbola - Exponential Sketching graphs Finding Equations Combinations of graphs TERMINOLOGY

More information

(Refer Slide Time: 00:03:51)

(Refer Slide Time: 00:03:51) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 17 Scan Converting Lines, Circles and Ellipses Hello and welcome everybody

More information

Effective Programming Practices for Economists. 10. Some scientific tools for Python

Effective Programming Practices for Economists. 10. Some scientific tools for Python Effective Programming Practices for Economists 10. Some scientific tools for Python Hans-Martin von Gaudecker Department of Economics, Universität Bonn A NumPy primer The main NumPy object is the homogeneous

More information

GSE Algebra 1 Name Date Block. Unit 3b Remediation Ticket

GSE Algebra 1 Name Date Block. Unit 3b Remediation Ticket Unit 3b Remediation Ticket Question: Which function increases faster, f(x) or g(x)? f(x) = 5x + 8; two points from g(x): (-2, 4) and (3, 10) Answer: In order to compare the rate of change (roc), you must

More information

MEI Desmos Tasks for AS Pure

MEI Desmos Tasks for AS Pure Task 1: Coordinate Geometry Intersection of a line and a curve 1. Add a quadratic curve, e.g. y = x² 4x + 1 2. Add a line, e.g. y = x 3 3. Select the points of intersection of the line and the curve. What

More information

HW 10 STAT 672, Summer 2018

HW 10 STAT 672, Summer 2018 HW 10 STAT 672, Summer 2018 1) (0 points) Do parts (a), (b), (c), and (e) of Exercise 2 on p. 298 of ISL. 2) (0 points) Do Exercise 3 on p. 298 of ISL. 3) For this problem, try to use the 64 bit version

More information

Introduction to Matlab

Introduction to Matlab Technische Universität München WT 21/11 Institut für Informatik Prof Dr H-J Bungartz Dipl-Tech Math S Schraufstetter Benjamin Peherstorfer, MSc October 22nd, 21 Introduction to Matlab Engineering Informatics

More information

Diode Lab vs Lab 0. You looked at the residuals of the fit, and they probably looked like random noise.

Diode Lab vs Lab 0. You looked at the residuals of the fit, and they probably looked like random noise. Diode Lab vs Lab In Lab, the data was from a nearly perfect sine wave of large amplitude from a signal generator. The function you were fitting was a sine wave with an offset, an amplitude, a frequency,

More information

Section 7.2 Characteristics of Quadratic Functions

Section 7.2 Characteristics of Quadratic Functions Section 7. Characteristics of Quadratic Functions A QUADRATIC FUNCTION is a function of the form " # $ N# 1 & ;# & 0 Characteristics Include:! Three distinct terms each with its own coefficient:! An x

More information

More Ways to Solve & Graph Quadratics The Square Root Property If x 2 = a and a R, then x = ± a

More Ways to Solve & Graph Quadratics The Square Root Property If x 2 = a and a R, then x = ± a More Ways to Solve & Graph Quadratics The Square Root Property If x 2 = a and a R, then x = ± a Example: Solve using the square root property. a) x 2 144 = 0 b) x 2 + 144 = 0 c) (x + 1) 2 = 12 Completing

More information

PSY 9556B (Feb 5) Latent Growth Modeling

PSY 9556B (Feb 5) Latent Growth Modeling PSY 9556B (Feb 5) Latent Growth Modeling Fixed and random word confusion Simplest LGM knowing how to calculate dfs How many time points needed? Power, sample size Nonlinear growth quadratic Nonlinear growth

More information

MDM 4UI: Unit 8 Day 2: Regression and Correlation

MDM 4UI: Unit 8 Day 2: Regression and Correlation MDM 4UI: Unit 8 Day 2: Regression and Correlation Regression: The process of fitting a line or a curve to a set of data. Coefficient of Correlation(r): This is a value between and allows statisticians

More information

FUNCTIONS AND MODELS

FUNCTIONS AND MODELS 1 FUNCTIONS AND MODELS FUNCTIONS AND MODELS In this section, we assume that you have access to a graphing calculator or a computer with graphing software. FUNCTIONS AND MODELS 1.4 Graphing Calculators

More information

1.1 Pearson Modeling and Equation Solving

1.1 Pearson Modeling and Equation Solving Date:. Pearson Modeling and Equation Solving Syllabus Objective:. The student will solve problems using the algebra of functions. Modeling a Function: Numerical (data table) Algebraic (equation) Graphical

More information

Assignment 2. with (a) (10 pts) naive Gauss elimination, (b) (10 pts) Gauss with partial pivoting

Assignment 2. with (a) (10 pts) naive Gauss elimination, (b) (10 pts) Gauss with partial pivoting Assignment (Be sure to observe the rules about handing in homework). Solve: with (a) ( pts) naive Gauss elimination, (b) ( pts) Gauss with partial pivoting *You need to show all of the steps manually.

More information

Mini-Max Type Robust Optimal Design Combined with Function Regularization

Mini-Max Type Robust Optimal Design Combined with Function Regularization 6 th World Congresses of Structural and Multidisciplinary Optimization Rio de Janeiro, 30 May - 03 June 2005, Brazil Mini-Max Type Robust Optimal Design Combined with Function Regularization Noriyasu Hirokawa

More information

Tutorial 2 PHY409 Anadi Canepa Office, TRIUMF MOB 92 B ( )

Tutorial 2 PHY409 Anadi Canepa Office, TRIUMF MOB 92 B ( ) Tutorial 2 PHY409 Anadi Canepa canepa@triumf.ca Office, TRIUMF MOB 92 B (1-604- 222-7330) Alan Manning mannin2@phas.ubc.ca Mohammad Samani samani@physics.ubc.ca During the 1 st tutorial We learnt What

More information

Chapter 12: Quadratic and Cubic Graphs

Chapter 12: Quadratic and Cubic Graphs Chapter 12: Quadratic and Cubic Graphs Section 12.1 Quadratic Graphs x 2 + 2 a 2 + 2a - 6 r r 2 x 2 5x + 8 2y 2 + 9y + 2 All the above equations contain a squared number. They are therefore called quadratic

More information

Mastery. PRECALCULUS Student Learning Targets

Mastery. PRECALCULUS Student Learning Targets PRECALCULUS Student Learning Targets Big Idea: Sequences and Series 1. I can describe a sequence as a function where the domain is the set of natural numbers. Connections (Pictures, Vocabulary, Definitions,

More information

3.7. Vertex and tangent

3.7. Vertex and tangent 3.7. Vertex and tangent Example 1. At the right we have drawn the graph of the cubic polynomial f(x) = x 2 (3 x). Notice how the structure of the graph matches the form of the algebraic expression. The

More information

Chapter 2: Polynomial and Rational Functions Power Standard #7

Chapter 2: Polynomial and Rational Functions Power Standard #7 Chapter 2: Polynomial and Rational s Power Standard #7 2.1 Quadratic s Lets glance at the finals. Learning Objective: In this lesson you learned how to sketch and analyze graphs of quadratic functions.

More information

Factoring. Factor: Change an addition expression into a multiplication expression.

Factoring. Factor: Change an addition expression into a multiplication expression. Factoring Factor: Change an addition expression into a multiplication expression. 1. Always look for a common factor a. immediately take it out to the front of the expression, take out all common factors

More information

Friday, 11 January 13. Interpolation

Friday, 11 January 13. Interpolation Interpolation Interpolation Interpolation is not a branch of mathematic but a collection of techniques useful for solving computer graphics problems Basically an interpolant is a way of changing one number

More information

Mid-Chapter Quiz: Lessons 2-1 through 2-3

Mid-Chapter Quiz: Lessons 2-1 through 2-3 Graph and analyze each function. Describe its domain, range, intercepts, end behavior, continuity, and where the function is increasing or decreasing. 1. f (x) = 2x 3 2 16 1.5 6.75 1 2 0 0 1 2 1.5 6.75

More information

Education Resources. This section is designed to provide examples which develop routine skills necessary for completion of this section.

Education Resources. This section is designed to provide examples which develop routine skills necessary for completion of this section. Education Resources Trigonometry Higher Mathematics Supplementary Resources Section A This section is designed to provide examples which develop routine skills necessary for completion of this section.

More information

Lab1: Use of Word and Excel

Lab1: Use of Word and Excel Dr. Fritz Wilhelm; physics 230 Lab1: Use of Word and Excel Page 1 of 9 Lab partners: Download this page onto your computer. Also download the template file which you can use whenever you start your lab

More information

Ingredients of Change: Nonlinear Models & 2.1 Exponential Functions and Models

Ingredients of Change: Nonlinear Models & 2.1 Exponential Functions and Models Chapter 2 Ingredients of Change: Nonlinear Models & 2.1 Exponential Functions and Models As we consider models that are not linear, it is very important that you be able to use scatter plots, numerical

More information

To Plot a Graph in Origin. Example: Number of Counts from a Geiger- Müller Tube as a Function of Supply Voltage

To Plot a Graph in Origin. Example: Number of Counts from a Geiger- Müller Tube as a Function of Supply Voltage To Plot a Graph in Origin Example: Number of Counts from a Geiger- Müller Tube as a Function of Supply Voltage 1 Digression on Error Bars What entity do you use for the magnitude of the error bars? Standard

More information

PreCalculus Chapter 9 Practice Test Name:

PreCalculus Chapter 9 Practice Test Name: This ellipse has foci 0,, and therefore has a vertical major axis. The standard form for an ellipse with a vertical major axis is: 1 Note: graphs of conic sections for problems 1 to 1 were made with the

More information

Student Exploration: Quadratics in Polynomial Form

Student Exploration: Quadratics in Polynomial Form Name: Date: Student Exploration: Quadratics in Polynomial Form Vocabulary: axis of symmetry, parabola, quadratic function, vertex of a parabola Prior Knowledge Questions (Do these BEFORE using the Gizmo.)

More information

Number of Regions An Introduction to the TI-Nspire CAS Student Worksheet Created by Melissa Sutherland, State University of New York at Geneseo

Number of Regions An Introduction to the TI-Nspire CAS Student Worksheet Created by Melissa Sutherland, State University of New York at Geneseo 1 Name Number of Regions An Introduction to the TI-Nspire CAS Student Worksheet Created by Melissa Sutherland, State University of New York at Geneseo Below you will find copies of the notes provided on

More information

HW 10 STAT 472, Spring 2018

HW 10 STAT 472, Spring 2018 HW 10 STAT 472, Spring 2018 1) (0 points) Do parts (a), (b), (c), and (e) of Exercise 2 on p. 298 of ISL. 2) (0 points) Do Exercise 3 on p. 298 of ISL. 3) For this problem, you can merely submit the things

More information

Graphing Techniques. Domain (, ) Range (, ) Squaring Function f(x) = x 2 Domain (, ) Range [, ) f( x) = x 2

Graphing Techniques. Domain (, ) Range (, ) Squaring Function f(x) = x 2 Domain (, ) Range [, ) f( x) = x 2 Graphing Techniques In this chapter, we will take our knowledge of graphs of basic functions and expand our ability to graph polynomial and rational functions using common sense, zeros, y-intercepts, stretching

More information

Section 4.4: Parabolas

Section 4.4: Parabolas Objective: Graph parabolas using the vertex, x-intercepts, and y-intercept. Just as the graph of a linear equation y mx b can be drawn, the graph of a quadratic equation y ax bx c can be drawn. The graph

More information

Quadratic (and higher order) regression on your calculator (TI-82, 83, or 84) NAME:

Quadratic (and higher order) regression on your calculator (TI-82, 83, or 84) NAME: Quadratic (and higher order) regression on your calculator (TI-82, 83, or 84) NAME: Notice the points on the scatter plot below have a curved pattern. We will find the quadratic, cubic, and quartic functions

More information

. As x gets really large, the last terms drops off and f(x) ½x

. As x gets really large, the last terms drops off and f(x) ½x Pre-AP Algebra 2 Unit 8 -Lesson 3 End behavior of rational functions Objectives: Students will be able to: Determine end behavior by dividing and seeing what terms drop out as x Know that there will be

More information

What is log a a equal to?

What is log a a equal to? How would you differentiate a function like y = sin ax? What is log a a equal to? How do you prove three 3-D points are collinear? What is the general equation of a straight line passing through (a,b)

More information

Section 18-1: Graphical Representation of Linear Equations and Functions

Section 18-1: Graphical Representation of Linear Equations and Functions Section 18-1: Graphical Representation of Linear Equations and Functions Prepare a table of solutions and locate the solutions on a coordinate system: f(x) = 2x 5 Learning Outcome 2 Write x + 3 = 5 as

More information

Polymath 6. Overview

Polymath 6. Overview Polymath 6 Overview Main Polymath Menu LEQ: Linear Equations Solver. Enter (in matrix form) and solve a new system of simultaneous linear equations. NLE: Nonlinear Equations Solver. Enter and solve a new

More information

Elementary Functions

Elementary Functions Elementary Functions Part 1, Functions Lecture 1.2a, Graphs of Functions: Introduction Dr. Ken W. Smith Sam Houston State University Spring 2013 Smith (SHSU) Elementary Functions Spring 2013 1 / 37 Representing

More information

This is called a linear basis expansion, and h m is the mth basis function For example if X is one-dimensional: f (X) = β 0 + β 1 X + β 2 X 2, or

This is called a linear basis expansion, and h m is the mth basis function For example if X is one-dimensional: f (X) = β 0 + β 1 X + β 2 X 2, or STA 450/4000 S: February 2 2005 Flexible modelling using basis expansions (Chapter 5) Linear regression: y = Xβ + ɛ, ɛ (0, σ 2 ) Smooth regression: y = f (X) + ɛ: f (X) = E(Y X) to be specified Flexible

More information

Objectives Graph and Analyze Rational Functions Find the Domain, Asymptotes, Holes, and Intercepts of a Rational Function

Objectives Graph and Analyze Rational Functions Find the Domain, Asymptotes, Holes, and Intercepts of a Rational Function SECTIONS 3.5: Rational Functions Objectives Graph and Analyze Rational Functions Find the Domain, Asymptotes, Holes, and Intercepts of a Rational Function I. Rational Functions A rational function is a

More information

5. ADVANCED DATA TECHNIQUES

5. ADVANCED DATA TECHNIQUES 5. ADVANCED DATA TECHNIQUES JHU Physics & Astronomy Python Workshop 2015 Lecturer: Mubdi Rahman SCIPY: FUNCTIONS YOU WANT, THE PACKAGE YOU NEED The Docs: http://docs.scipy.org/doc/scipy/reference/ L.J.

More information

Cubic Splines By Dave Slomer

Cubic Splines By Dave Slomer Cubic Splines By Dave Slomer [Note: Before starting any example or exercise below, press g on the home screen to Clear a-z.] Curve fitting, the process of finding a function that passes through (or near)

More information

TI-83 Graphing Functions & Relations

TI-83 Graphing Functions & Relations To graph a function: 1. The equation must be written in functional notation in explicit (or y equals ) form. (Y is the dependent variable and X is the independent variable.) For instance, we may need to

More information

QUESTIONS 1 10 MAY BE DONE WITH A CALCULATOR QUESTIONS ARE TO BE DONE WITHOUT A CALCULATOR. Name

QUESTIONS 1 10 MAY BE DONE WITH A CALCULATOR QUESTIONS ARE TO BE DONE WITHOUT A CALCULATOR. Name QUESTIONS 1 10 MAY BE DONE WITH A CALCULATOR QUESTIONS 11 5 ARE TO BE DONE WITHOUT A CALCULATOR Name 2 CALCULATOR MAY BE USED FOR 1-10 ONLY Use the table to find the following. x -2 2 5-0 7 2 y 12 15 18

More information

Hey there, I m (name) and today I m gonna talk to you about rate of change and slope.

Hey there, I m (name) and today I m gonna talk to you about rate of change and slope. Rate and Change of Slope A1711 Activity Introduction Hey there, I m (name) and today I m gonna talk to you about rate of change and slope. Slope is the steepness of a line and is represented by the letter

More information

PS6-DCT-Soln-correction

PS6-DCT-Soln-correction PS6-DCT-Soln-correction Unknown Author March 18, 2014 Part I DCT: Discrete Cosine Transform DCT is a linear map A R N N such that the N real numbers x 0,..., x N 1 are transformed into the N real numbers

More information

OVERVIEW DISPLAYING NUMBERS IN SCIENTIFIC NOTATION ENTERING NUMBERS IN SCIENTIFIC NOTATION

OVERVIEW DISPLAYING NUMBERS IN SCIENTIFIC NOTATION ENTERING NUMBERS IN SCIENTIFIC NOTATION OVERVIEW The intent of this material is to provide instruction for the TI-86 graphing calculator that may be used in conjunction with the second edition of Gary Rockswold's College Algebra Through Modeling

More information

This is a simple example of how the lasso regression model works.

This is a simple example of how the lasso regression model works. 1 of 29 5/25/2016 11:26 AM This is a simple example of how the lasso regression model works. save.image("backup.rdata") rm(list=ls()) library("glmnet") ## Loading required package: Matrix ## ## Attaching

More information

Homework #6 Brief Solutions 2012

Homework #6 Brief Solutions 2012 Homework #6 Brief Solutions %page 95 problem 4 data=[-,;-,;,;4,] data = - - 4 xk=data(:,);yk=data(:,);s=csfit(xk,yk,-,) %Using the program to find the coefficients S =.456 -.456 -.. -.5.9 -.5484. -.58.87.

More information

Practice Test (page 391) 1. For each line, count squares on the grid to determine the rise and the run. Use slope = rise

Practice Test (page 391) 1. For each line, count squares on the grid to determine the rise and the run. Use slope = rise Practice Test (page 91) 1. For each line, count squares on the grid to determine the rise and the. Use slope = rise 4 Slope of AB =, or 6 Slope of CD = 6 9, or Slope of EF = 6, or 4 Slope of GH = 6 4,

More information

UNIT 8: SOLVING AND GRAPHING QUADRATICS. 8-1 Factoring to Solve Quadratic Equations. Solve each equation:

UNIT 8: SOLVING AND GRAPHING QUADRATICS. 8-1 Factoring to Solve Quadratic Equations. Solve each equation: UNIT 8: SOLVING AND GRAPHING QUADRATICS 8-1 Factoring to Solve Quadratic Equations Zero Product Property For all numbers a & b Solve each equation: If: ab 0, 1. (x + 3)(x 5) = 0 Then one of these is true:

More information

scikit-learn (Machine Learning in Python)

scikit-learn (Machine Learning in Python) scikit-learn (Machine Learning in Python) (PB13007115) 2016-07-12 (PB13007115) scikit-learn (Machine Learning in Python) 2016-07-12 1 / 29 Outline 1 Introduction 2 scikit-learn examples 3 Captcha recognize

More information

A Function of Two Variables A function of two variables is a function that is, to each input is associated exactly one output.

A Function of Two Variables A function of two variables is a function that is, to each input is associated exactly one output. Chapter 4 Functions of Two Variables Applied Calculus 240 Section 1: Functions of Two Variables Real life is rarely as simple as one input one output. Many relationships depend on lots of variables. Examples:

More information

Exploring Quadratic Graphs

Exploring Quadratic Graphs Exploring Quadratic Graphs The general quadratic function is y=ax 2 +bx+c It has one of two basic graphs shapes, as shown below: It is a symmetrical "U"-shape or "hump"-shape, depending on the sign of

More information

Example 1: Given below is the graph of the quadratic function f. Use the function and its graph to find the following: Outputs

Example 1: Given below is the graph of the quadratic function f. Use the function and its graph to find the following: Outputs Quadratic Functions: - functions defined by quadratic epressions (a 2 + b + c) o the degree of a quadratic function is ALWAYS 2 - the most common way to write a quadratic function (and the way we have

More information

2.4. A LIBRARY OF PARENT FUNCTIONS

2.4. A LIBRARY OF PARENT FUNCTIONS 2.4. A LIBRARY OF PARENT FUNCTIONS 1 What You Should Learn Identify and graph linear and squaring functions. Identify and graph cubic, square root, and reciprocal function. Identify and graph step and

More information

You should be able to plot points on the coordinate axis. You should know that the the midpoint of the line segment joining (x, y 1 1

You should be able to plot points on the coordinate axis. You should know that the the midpoint of the line segment joining (x, y 1 1 Name GRAPHICAL REPRESENTATION OF DATA: You should be able to plot points on the coordinate axis. You should know that the the midpoint of the line segment joining (x, y 1 1 ) and (x, y ) is x1 x y1 y,.

More information

Not for reproduction

Not for reproduction x=a GRAPHING CALCULATORS AND COMPUTERS (a, d ) y=d (b, d ) (a, c ) y=c (b, c) (a) _, by _, 4 x=b FIGURE 1 The viewing rectangle a, b by c, d _4 4 In this section we assume that you have access to a graphing

More information

MS6021 Scientific Computing. TOPICS: Python BASICS, INTRO to PYTHON for Scientific Computing

MS6021 Scientific Computing. TOPICS: Python BASICS, INTRO to PYTHON for Scientific Computing MS6021 Scientific Computing TOPICS: Python BASICS, INTRO to PYTHON for Scientific Computing Preliminary Notes on Python (v MatLab + other languages) When you enter Spyder (available on installing Anaconda),

More information

Algebra II Chapter 5

Algebra II Chapter 5 Algebra II Chapter 5 5.1 Quadratic Functions The graph of a quadratic function is a parabola, as shown at rig. Standard Form: f ( x) = ax2 + bx + c vertex: b 2a, f b 2a a < 0 graph opens down a > 0 graph

More information

5.5 Newton s Approximation Method

5.5 Newton s Approximation Method 498CHAPTER 5. USING DERIVATIVES TO ANALYZE FUNCTIONS; FURTHER APPLICATIONS 4 3 y = x 4 3 f(x) = x cosx y = cosx 3 3 x = cosx x cosx = 0 Figure 5.: Figure showing the existence of a solution of x = cos

More information

x = 12 x = 12 1x = 16

x = 12 x = 12 1x = 16 2.2 - The Inverse of a Matrix We've seen how to add matrices, multiply them by scalars, subtract them, and multiply one matrix by another. The question naturally arises: Can we divide one matrix by another?

More information

Radical Functions. Attendance Problems. Identify the domain and range of each function.

Radical Functions. Attendance Problems. Identify the domain and range of each function. Page 1 of 12 Radical Functions Attendance Problems. Identify the domain and range of each function. 1. f ( x) = x 2 + 2 2. f ( x) = 3x 3 Use the description to write the quadratic function g based on the

More information

Using LoggerPro. Nothing is more terrible than to see ignorance in action. J. W. Goethe ( )

Using LoggerPro. Nothing is more terrible than to see ignorance in action. J. W. Goethe ( ) Using LoggerPro Nothing is more terrible than to see ignorance in action. J. W. Goethe (1749-1832) LoggerPro is a general-purpose program for acquiring, graphing and analyzing data. It can accept input

More information

An Introduction to Gnuplot for Chemists. By Nicholas Fitzkee Mississippi State University Updated September 1, 2016

An Introduction to Gnuplot for Chemists. By Nicholas Fitzkee Mississippi State University Updated September 1, 2016 An Introduction to Gnuplot for Chemists By Nicholas Fitzkee Mississippi State University Updated September 1, 2016 Introduction Many biophysical problems involve fitting a model (as described by some mathematical

More information

D-Optimal Designs. Chapter 888. Introduction. D-Optimal Design Overview

D-Optimal Designs. Chapter 888. Introduction. D-Optimal Design Overview Chapter 888 Introduction This procedure generates D-optimal designs for multi-factor experiments with both quantitative and qualitative factors. The factors can have a mixed number of levels. For example,

More information

Section 7.6 Graphs of the Sine and Cosine Functions

Section 7.6 Graphs of the Sine and Cosine Functions Section 7.6 Graphs of the Sine and Cosine Functions We are going to learn how to graph the sine and cosine functions on the xy-plane. Just like with any other function, it is easy to do by plotting points.

More information

Linear and Quadratic Least Squares

Linear and Quadratic Least Squares Linear and Quadratic Least Squares Prepared by Stephanie Quintal, graduate student Dept. of Mathematical Sciences, UMass Lowell in collaboration with Marvin Stick Dept. of Mathematical Sciences, UMass

More information

How to Do Everything We Need to Do on a TI Calculator in Algebra 2 for Now (Unless Davies Forgot Something)

How to Do Everything We Need to Do on a TI Calculator in Algebra 2 for Now (Unless Davies Forgot Something) How to Do Everything We Need to Do on a TI Calculator in Algebra 2 for Now (Unless Davies Forgot Something) 10.01.17 Before you do anything, set up your calculator so that it won t get in your way. Basics:

More information