Applied Differential Equations I
Applied Differential Equations I MA 341
Popular in Course
Popular in Mathematics (M)
This 46 page Class Notes was uploaded by Braeden Lind on Thursday October 15, 2015. The Class Notes belongs to MA 341 at North Carolina State University taught by Staff in Fall. Since its upload, it has received 32 views. For similar materials see /class/223726/ma-341-north-carolina-state-university in Mathematics (M) at North Carolina State University.
Reviews for Applied Differential Equations I
Report this Material
What is Karma?
Karma is the currency of StudySoup.
Date Created: 10/15/15
Over Determined Algebraic Systems Curve Fitting to Data Introduction In this section we investigate algebraic systems that have more equations than unknowns In general these will not have a solution in the sense that one gets equality for each equation Here we hope to be able to choose the unknowns so that the equations are as close to being satis ed as possible For example consider the following where there are two variables and three equations 1x1 1xz 1 2x1 1xz 3 and 3x1 1xz 7 Here there is no solution because there are more equations and only two unknowns Or in matrix form with the residual vector r inserted is 11 1r1 x 2113 r2 x 312 7 r3 We will want to choose the solution x so that the quotsizequot of the residual vector is a minimum A very appropriate measure of quotsizequot will be the sum of the squares of residual s components rT r r12 r22 r32 Such x are called the least squares solution to the overdetermined system Applied Area We will apply the above concepts to two areas Both are related to tting curves to a number of data points There are many other problems that can be formulated as minimization problem which are in many cases related to algebraic systems Application to Business Forecasting Consider a computer company which has recorded sales of 78 85 90 96 104 and 113 computers over the last six months Table Sales Data Month Computers Sold 1 78 2 85 3 90 4 96 5 104 6 1 13 They wish to make a prediction of the sales over the next siX months This will help them plan their production needs during this period The data is increasing more or less in a linear fashion Consequently we are looking for a straight line that is quotclosestquot to the data An analytical way of saying this is that we are looking for y mx c that is the slope m and the y intercept c so that this line is quotclosestquot to the graphed data Once the m and the c are known then the future sales can be predicted by putting the appropriate month into the X variable and computing the forecasted sales in the y variable Sales l gtxlt gtxlt T gtxlt L 7 Time Figure Sales Data and a quotClosequot Straight Line In order to form the corresponding over determined system note the components of the residual vector are just the vertical distances between the data points and the desired straight line So for each data point there is an equation which has the two unknowns m and c For the above data the siX equations are mlc78 m2c85 m3c90 m4c96 m5c104and m6cll3 Or the matrix form with the residual vector is 1 1 78 r1 2 1 85 r2 3 1 m 90 VS 4 1L 96 r4 5 1 104 r5 6 1 113 r Application to Nonlinear Heat Diffusion In the introductory models of heat diffusion via the Fourier heat law the thermal conductivity was the constant of proportionality for the diffusion of heat However if the temperature varies over a large range the thermal conductivity will not be a constant Consider the following data for thermal conductivity as a function of temperature Table Thermal Conductivit Data Tem erature Inspection of this data indicates that it is generally shaped like a parabola whose equation is a second order polynomial a bX 0X2 We want to choose the three coefficients so that the graph of the polynomial will be closest to the data In this problem there are 5 data points and three unknowns and the corresponding equations are a b000 c0002 0010 a b200 c2002 0015 a b400 c4002 0021 a b600 c6002 0051 and a b800 c8002 0094 Or the matrix form with the residual vector is 1 000 0002 0010 r1 1 200 2002 a 0015 r2 1 400 4002 b 0021 r3 1 600 6002 C 0051 r4 1 800 8002 0094 r5 Model The model has the form of AX d where A is an m by n matrix with m larger than n that is there are more rows or equations than the unknowns in the X vector Since there are no exact solutions we try to find X so that the residual vector in AX d r is as quotsmallquot as possible De nition The vector X is called a least squares solution of the over determined system if and only if X is such that rT r d AXT d AX is a minimum of all d AyT d Ay Method Fortunately this solution in most cases has a very nice answer If X is the least squares solution then for all y d AxT d Ax s d AyT d Ay 1 Let y X y X and consider d Ayf d Ay d Ax Ay xT d Ax Ay x d Axf Ay xT d Ax Ay x d Axf d Ax Ay xT d Ax d Axf Ay x Ay xT Ay x 2 d AxT d Ax 2y xT AT d Ax 2 If the last term on the right side of 2 is zero then the inequality in 1 must hold This prompts the following de nition and theorem which we have just established De nition ATAX ATd is called the normal equation associated with the least squares problem Normal Equation Theorem If ATA has an inverse then the solution of the normal equation is also a solution of the least squares problem Example Consider the problem in the introduction with three equations and two unknowns ATd1233 111 The solution of the normal equation is X1 3 and X2 73 An interpretation of this is with X1 slope m and X2 y intercept c is that the straight line y 3X 73 is closest to the three data points Xi yi 11 23 and 37 Implementation First we use the MatlabMaple symbolic procedure linsolve to nd the solution of the normal equations for the business forecast Then Matlab is used to nd the thermal conductivity MatlabMaple Symbolic Code for the Business Forecast Model EDUgtgtA1l2131415161 A UIAUJNt I D ID ID ID ID I 6 l EDU transposeA ans 1 2 3 4 5 6 l l l l l l EDU ata transposeAA ata 91 21 21 6 EDU d 78 85 90 96104113 d 78 85 90 96 104 113 EDU atd transposeAd atd 2100 566 EDU lssol linsolveataatd lssol 345 105815 This means the slope m 345 and the y intercept c 105815 The predicted sales at 9 months is m9 c 132 Matlab Code for the Thermal Conductivity EDUgtgtformat long 16 digits EDUgtgtA 1 0 0 1 200 40000 1 400 160000 1 600 360000 1 800 640000 A 1 0 0 1 200 40000 1 400 160000 1 600 360000 1 800 640000 EDUgtgtd 0010 0015 0021 0051 009439 000100000000000 000150000000000 000210000000000 000510000000000 000940000000000 EDUgtgtlssol A AA d lssol 000116857142857 00000040857l429 000000001785714 EDU ezplot 001l685714285700000408571429x0000000l7857l4xx 0 800 X 10393 11 1685714235741 xumooo1735714xx 0 100 200 300 400 500 600 700 300 X Figure Thermal Conductivity versus Temperature Assessment The least squares linear approximation model requires that the data be in the form of a straight line Other factors governing the effectiveness in economic models include unpredictable costs attractiveness of items may increase or decrease rapidly and new technologies The thermal conductivity model may not be valid if there are changes of physical state within the desired range In this case the thermal conductivity will have jump discontinuities and therefore polynomial approximations will not be a good model Not all models are in the form of polynomials In many cases the models have the form of transcendental functions such as log or exponential functions Here the least squares model must be altered to include these more complicated nonlinear effects In another polynomial approximation Lagrange polynomials given by requiring the approximation to be exactly the value of a complicated function at a number of points If there are a large number of points then the Lagrange polynomial will have a high order and there will be many oscillations By using least squares with the appropriate degree polynomial which re ects the data one can use many data points Often the least squares method generates an algebraic problem that is prone to large numerical errors In this case one is adVised to use the QRfactorization method to solve the algebraic problem This is incorporated into the backslash command in Matlab as is illustrated below gtgt Ad ans 000116857142857 000000408571429 000000001785714 gtgt lsquad Ad Solves for the quadratic approximation lsquad 000116857142857 000000408571429 000000001785714 gtgt lslinear A12d Solves for the linear approximation lslinear 10e003 026000000000000 001020000000000 gtgt resquad d Alsquad Computes the residual for the quadratic resquad 10e003 0l6857142857143 043428571428571 029142857142857 00457l42857l429 007142857142857 gtgt reslinear d Al2lslinear Computes the residual for the linear reslinear 000126000000000 000028000000000 000172000000000 000076000000000 000150000000000 gtgt resquad resquad Minimum of the least squares function for quadratic ans 3091428571428574e007 gtgt reslinear reslinear Minimum of the least squares function for linear ans 7452000000000003e006 One can compare either r39r or the graphs of the approximating functions gtgt syms X gtgt ezplotlsquad1 lsquad2x lsquad3XX 000 900 gtgt hold on gtgt ezplotlslinear1 lslinear2X 000 900 gtgt plot0 200 400 600 800 d X m2 47961534691a45mMsummnmgammaocm1u maazszgaggag 147g 5179352s25s56 X i l l l w w Homework 1 The sales of air conditioners during the months of January February March and April were 4 6 7 and 12 respectively Find the linear least squares solution associated with this data Use it to predict the sales in May Would this be a good model to make predictions for the months of July or August 2 Use the nonlinear thermal conductiVity function to nd the steady state temperature of a thin wire with no heat loss through the lateral sides 3 Justify the steps leading from equation 1 to 2 4 Consider the data 20 10 10 20 and 2114 Approximate the above data in two ways i use Lagrange fourth order polynomial and ii use linear least squares Graph both and compare them Separation of Variables and dsolve Solution of y39cysur y and y0 y0 Via dsolve EDU syms y c ysur y0 t EDU sol dsolve39Dy cysur y 39y0 y039 sol ysurexpctysury0 EDU sol subssol ysurc7001 sol 70exp1100t70y0 EDU s01200 subssol y0200 s01200 70130exp1100t EDU ezplots01200 0 400 7o130exp 11oot 0 50 100 150 200 250 300 350 400 Solution of y39 cy 1y 8 and y0 y0 First use dsolve EDU sol dsolve39Dy cy1y339a 39y0 yo39 sol 8exp7 ctlog1y08y0exp7 ctlog 1y08y01 EDU syms c y0 y t EDU soll subssolc01 soll 8exp7100t log1y08y0exp7100t l0g1y08y01 EDU s0110 subssoll y0 10 s0110 8exp7100t log92exp7100tlog92 1 EDU ezplots0110 0 100 8eXp7100tIog92exp7100tIog921 EDU sol7 subssolly0 7 sol7 8exp7100t log 6exp7100tlog6 1 EDU ezplotsol70 100 8exp7l100tIog6lexp7l100tIog6 1 EDU solm7 subss011y0 7 solm7 8exp7100t log815exp7100tlog815 1 EDU ezplotsolm70 100 8exp7l100 tIog8l15lexp7l100 tIog8l1 51 Solution of y39 cy 1y 8 and y0 y0 Second use separation of variables EDU clear EDU syms left right y t sol y0 EDU left int391y1y83939y39 left 17logy117logy8 EDU right int39c3939t39 right ct EDU lefttop subsleftysol lefttop 17 logsol117logsol8 EDU leftbottom subsleftyy0 leftbottom 17log1y017log8y0 EDU solve3917logsol117 logsol817log 1y0 17 log8y0ct3939sol39 ans 8exp7ctexp7cty088y0 8exp7ctexp7cty01y0 EDU dsolve39Dyy 1y83939y0y039 ans 8exp7 t10g1y08y0 exp7 t log1y08y0 1 EDU simplifyans ans 8exp7ctexp7cty088y0 8exp7ctexp7cty01y0 Tangent Vectors via quiver QUIVER Quiver plot QUIVERXYUV plots velocity vectors as arrows with components uv at the points xy The matrices XYUV must all be the same size and contain corresponding position and velocity components X and Y can also be vectors to specify a uniform grid QUIVER automatically scales the arrows to fit within the grid EDU x 1 12 EDU y 1 2 EDU u 3 4 EDU v 4 6 EDU quiverxyuv Direction Field for y 110 yy 1 Population with Harvesting EDU edit quiverdem clears matlab39s memory clear creates grid points in the ty plane t y meshgrid0120 1112 creates slope of all direction vectors slope 11010 yy 1 plots direction vectors at all grid points quivertyonessizetslope QZ MMMHM MHNMMV 50 IKIIlIA IIIZZ x V 29 x VIIIIIIIIVA llIA Iig apJaAgnb flag Direction Field for y 0170 y Newton Law of Cooling clears matlab39s memory clear creates grid points in the ty plane t y meshgrid010400010210 creates slope of all direction vectors slope 0170 y plots direction vectors at all grid points quivertyonessizetslope x 15 o 100 Direction Field for y 3y23 Multiple Solutions for y2 0 y 0 and y t23 clears matlab39s memory clear creates grid points in the ty plane t y meshgrid256O52 creates slope of all direction vectors slope 3y 32 plots direction vectors at all grid points quivertyonessizetslope 0 l v l l l l l l v 15 2 25 3 35 4 45 5 55 6 65 Direction Field for y y12 Solution Blows Up y 11t 1 clears matlab39s memory clear creates grid points in the ty plane t y meshgrid011 525z3 creates slope of all direction vectors slope y1 2 plots direction vectors at all grid points quivertyonessizetslope x gt39 x s x 39 39 s x us39 s 39 s xss 39xs isa xsxx o N o o N 0 4 o m o on N Solution of ODEs Via dsolve EDU Solve y39 0170 y and y0 200 EDU y dsolve39Dy 0170 y3939y0 20039 y 70130exp1100t EDU ezploty0 300 EDU ezploty0 600 7o130exp 11oot EDU Verify y is the solution EDU leftside diffy leftside 1310exp1100t EDU rightside 0170 y rightside 1310exp1100t EDU Use dsolve to nd the solution of yquot 2y39 3y t y0 1 and y390 2 EDU y dsolve39D2y 2Dy 3y t39 39y0 139 2VVtV y 19 2expt3texpt11c0s2quot12t13sin2A12t 2quot12expt EDU prettyy 2 expt 3 t expt 11 cos2 2 t 13 sin2 2 0212 19 expt EDU EDU ezploty0 10 1l92expt3texpt11cos 13sin2quot12t2quot12expt EDU Verify y is a solution EDU leftside diffy2 2diffy 3y leftside 194expt3texpt 22c0s2quot12t 26sin2quot12t2A12expt29 2expt3texpt11c0s2quot12t13sin2A12t 2quot12expt EDU simplifyleftside ans t EDU This is the same as the rightside ODE Solution Via Complex Eigenvalues A 1 2 1 3 A 1 2 1 3 u d eigA u 05774 05774i 05774 05774i 0 05774i 0 05774i d 20000 10000i 0 0 20000 10000i Au ans 05774 17321i 05774 17321i 05774 11547i 05774 11547i ud ans 05774 17321i 05774 17321i 05774 11547i 05774 11547i c realu1 imagu1x0 c 51962 34641 sol c1exp2tc0strealu1 exp 2tsintimagu1 c2exp 2tsintrealu1 exp 2tc0stimagu1 1sooas1xZ39dX9gt5Z1ulsas1sZ39dX9gts 39 18031Z39dX91us1Z39dxa59 SHE 0SKdu1s DSO31Z39dX9asz1uss1sZ39dX9gts 39 ZIv 1soo1zdxogsIZIv s1usm 39dX9s IZIv gt5zZIv s1soa1asz 39dX9s IZIv s1us1xZ39dX9x I5ZIv x 0s 0 1 0 0 3 0 2 0 0 0 0 1 2 0 5 0 u d eigA u 01954 01954 05117 05117 0 04881i 0 04881i 0 06796i 0 06796i 03162 03162 03162 03162 0 07897i 0 07897i 0 04200i 0 04200i d 0 24972i 0 0 0 0 0 24972i 0 0 0 0 0 13281i 0 0 0 0 0 13281i x0123439 x0 IBMND K c realu1 imagu1 realu3 imagu3x0 54505 25326 40363 47620 syms t sola c1c0simagd11trealu1 sinimagd11timagu1 c2sinimagd11trealu1 c0simagd11timagu1 solb c3c0simagd33trealu3 sinimagd33timagu3 c4sinimagd33trealu3 c0simagd33timagu3 sol sola solb ezplotsol1 0 20 hold on ezplotsol3 0 20 07199254740992 00528116108042795771125899906842624 t 101242892251478388619007199254740992 sin598 37039426141745l More Examples of Particular Solutions and The Speed Bump EDU dsolve39D2y 2Dy 3y 2xexpxsinx expxc0sx3939x39 ans 220289expxsinx 817expxxc0sx 21289expxc0sx 217xexpxsinx C1expxC2exp3x EDU dsolve39D2y 2Dy 3y xxexpx 3xexpx3939x39 ans 112expxxA3516XA2expx 532xexpx5128expx C1expxC2exp3x XXIII SHE 05 9AIOSP Xsdxesz1IXdxeMIX quot l Xs 39dX9gtssZII39XdX9ssi7I X quot 0 n InzdX9n dxe1uxas 39dX9ssZI39X quot 0 X dX9ZIIXdxoawnX quot 0 I assZdX9 dX91 gtsXgts 39dX9add390 quot 0 InasxZdX9 dX9I1uXW Qadd151 SUB AXA AO 01A A0 mm Kw Kaz KZQPAIOSP 1051 Xs 39dX9sZDXdX9as I 3 X IXas ZdX9Xas dX91uXs 39dX9aslasZI 39X IXsasZdX9XdX9I1uXdX9gtsgtsZIas I SHE X Xum Kw Kaz KZGJMIOSP IIGEI so q 3151 uysn s1u9u1919 9M7 s 8101 pIIBJf quo MS 921 IXI A quo MS 969 IXI 10s nefqo uIKs 969 1x1 sue sseD so g azgs aumN soqAA flag A sums flag ZvAI391 SAIdasZISO3ZVAI 39 VAZ1 SAdsZI503ZVAI 39AZ391SO3gtZVAI AdZIusstz1s09szIA dZIusAz 39Aas1asAI S1quotS15AIquotS41 5 39As1sAI39 S1 S15AI us1usA1sAIsoo1s091AIs091s09 As1sAISO315031gt5AI303s1503sZI SHE 3 30 1Asoo K KZQPAIOSP 1651 dumg paads 01 uoymouddv EDU sol73 subssolv 73 sol73 50173c0stcos173100t5027c0stc0s 27100t 5027sintsin 27100t50173sintsin173100t 73004671sin5073pic0st 73004671c0s5073pisint EDU simplifysol73 ans 50173c0stc0s173100t5027c0stc0s27100t 5027sintsin27100t50173sintsin173100 t 73004671sin2373pic0st73004671c0s2373pi sint EDU ezplotsol73pi273 pi273 50173 005t005173100 t502 7730046710055073p5mt EDU ezplot392v1vvc0spi2v39 0 2 2v1vvcospil2v Homogeneous and Particular Solutions EDU dsolve39D2y y x expx3939x39 ans x 12 expxC 1 cosxC2sinx EDU dsolve39D2y y 2 XAZ39 ans 2exptxA2exptC1exptA2C2expt EDU dsolve39D2y y 2 xquot23939x39 ans XA2expxC 1 expxA2C2expx ZVMI1us VM ZVMI 39Z1 SsMasZVMI39Z39Mgts1gtsMI395031 S 3915MISO31HSM15MISO31quotS15M 15091 SM15MI S15091gt5MI S40503 M15MI39 S1SO33915MI39quotS15035ZI 0s sue 0s ag ZVMI1us VM ZVMI 39Z1 SsMasZVMI39Z39Mgts1gtsMI395031 S 3915MISO31USM15MISO31quotS15M 15091 SM15MI S15091gt5MI S40503 M15MI39 S1SO33915MI39quotS15035ZI SHE 3amp0 0KL 0 0amp 15Mus K KZQPAIOSP 1651 EDU syms w EDU whos Name Size Bytes Class ans 1x1 126 sym object sol 1x1 582 sym object w 1x1 126 sym object Grand total is 234 elements using 834 bytes EDU sol2 subssolw2 sol2 c0stsint16c0stsin3t 16sintc0s3t23sint EDU simplifysol2 ans 23c0stsint23sint EDU sol11 subssolw11 sol11 5c0stsin110t521c0stsin2110t 521sintc0s2110t 5sintc0s110t11021sint EDU ezplotsol20 10 EDU hold Current plot held EDU ezplotsol110 10 5 cost sin1l10 t521 cost sint cos1l10 t110l21 sint EDU sol1 dsolve39D2y y sint39 39y0039 39Dy0039 39t39 sol1 12c0stt12sint EDU hold off EDU ezplotsol10 50 1l2costt1l2 sint