"...how it differs from the rocks"

Category: OpenLab Assignment

OpenLab #4: Flipping the class – Taylor Series

Hi everyone,

After Spring Break we will be launching into a new and incredibly useful topic – using Taylor Series to solve differential equations.  Of course, using this method requires you to remember something about Taylor Series (uh oh!).  You should have studied them in Calculus II.  Don’t remember? This is your chance to refresh your memory.

Assignment (Due Tuesday, April 25th, BEFORE CLASS):  Watch all of the following videos carefully.  As you are watching, make a note of any questions you have.  When you are done, complete the following exercise:

Exercise:  Find at least the first 15 terms of the Taylor Series for y=e^{2x} at the point x=0.

Finally, post a comment here confirming that you watched the videos, and including the following:

  1. Confirm that you watched the videos (say something like “I watched all the videos.”)
  2. Post ONE of the terms you found while solving the exercise above (for example, you might say “One of the terms is \frac{4x^5}{15}“).  CHALLENGE: Don’t use the same term as anyone else.
  3. Ask a question about Taylor Series, either about one of the videos (tell me which one), or about Taylor Series in general. Make it an honest question – something you are confused about, or stuck on, or genuinely interested in.

Extra Credit.  For extra credit, answer someone else’s question.

Here are the videos:

Video 1: Taylor/Maclauren Series intuition

 

Video 2: Taylor Series for Cosine at x=0 (Maclaurin Series)

Video 3 (OPTIONAL): Taylor Series for Sine at x=0  (NOTE: This video is OPTIONAL, but it might help you better understand the next video)

Video 4: Visualizing Taylor Series Approximation

OpenLab #3: Numerical Methods PROJECT – Scoring Guide and Solutions to Project Example

Hi everyone,

I wanted to share the scoring guide that I will use when grading your project – this is based on the Part 1 and Part 2 project assignments.  I also included my own solutions to the Project Example given in Part 2, if you’d like to compare.

Project Scoring Guide

This project is worth 15 points towards the “OpenLab” portion of your grade, equivalent to three OpenLab assignments.  These points are assigned as follows:

  • (5 points) A working numerical methods calculator using your choice of technology.
    • 3 points – solution correctly implements each method (Euler’s Method, Improved Euler’s Method, Runge-Kutta Method)
    • 1 point – solution displays intermediate points and other important values (k1, k2, etc.)
    • 1 point – ease of implementation (can easily change initial condition, step size, target value)
  • (5 points) Solutions to the Project Example
    • 2 points – value of y(7.1) is approximated by each method
    • 3 points – appropriate step size is chosen for each method
  • (5 points) Writing Assignment
    • 2 points – meet minimum length requirement (300 words)
    • 1 point – Describe your project
    • 1 point – Describe the process
    • 1 point – Why do we need numerical methods? Why is this assignment included in the class?

 

 

Project Example Solutions

The example given in the “Project Part 2” post was:

Project Example.  Given the differential equation dy/dx = \frac{xy}{x-y} and initial condition y(6)=0.8, approximate the value of y(7.1) using Euler’s Method, Improved Euler’s Method, and Runge-Kutta.

For each method, choose a step size that gives four correct digits following the decimal point.  How many steps are required to obtain this level of precision?

NOTE: The actual solution is y(7.1)=3.700936

In my own solution, implemented first in Google Sheets and later (when I needed more computing power) in Microsoft Excel, I obtained the following results:

Euler’s Method

To obtain four correct digits after the decimal point required:

  • 275,000 steps
  • step size h = 0.000004
  • final approximation y(7.1) = 3.70090152430816

 

Improved Euler’s Method

To obtain four correct digits after the decimal point required:

  • 390 steps
  • step size h = 0.002820513
  • final approximation y(7.1) = 3.70090010561837

 

Runge-Kutta Method

To obtain four correct digits after the decimal point required:

  • 8 steps
  • step size h = 0.1375
  • final approximation y(7.1)=3.70091299278611

 

OpenLab #3: Numerical Methods PROJECT – Part 2

This post contains additional information related to the Numerical Methods Project posted last week, due March 23rd.

Submission guidelines. Your completed project will consist of three elements:

  1. A working numerical methods calculator using your choice of technology (spreadsheet, programming, mathematical software), as described in the previous post.
    HOW TO SUBMIT:

    • If your project is a spreadsheet, either share it with me (if it is in Google Docs or a similar cloud-based platform), or email the file to me as an attachment.
    • If your project is code, please submit it using an online coding site like ideone.com – once your code is working on the site, you can simply submit a link.  If you are using a programming language not supported by ideone.com, you can email the source code to me.
    • If your project uses mathematical software, either share it with me (if it is in MatLab Online or a similar cloud-based platform), or email the file to me as an attachment.
  2. Solutions to the following example using each of the three methods studied in class (Euler’s Method, Improved Euler’s Method, and Runge-Kutta), generated by your numerical methods calculator.  Submit using the same method as in part 1.

Project Example.  Given the differential equation dy/dx = \frac{xy}{x-y} and initial condition y(6)=0.8, approximate the value of y(7.1) using Euler’s Method, Improved Euler’s Method, and Runge-Kutta.

For each method, choose a step size that gives four correct digits following the decimal point.  How many steps are required to obtain this level of precision?

NOTE: The actual solution is y(7.1)=3.700936

  1. Writing assignment.  Write one or two paragraphs (minimum 300 words) responding to the following.  Leave your response as a comment on this post.
    1. Describe your project and how it works.
    2. Describe the process of building your numerical methods calculator.  What kind of technology did you decide to use, and why? Did you encounter any unexpected challenges in completing this project?
    3. Why do we need numerical methods in addition to the other methods studied in the class?
    4. Why is this assignment included in the class (instead of just computing the various methods using a calculator)?
    5. Please include a link to your project (if it is online), or clearly state that you will be sending me the files by email (and don’t forget to do it!).

 

OpenLab #3: Numerical methods PROJECT – Example Data

Below you will find complete solutions for the Example given the previous post – you can use this to test your project.

Example.  Given the differential equation dy/dx=x^2-0.5xy and initial condition y(1.5)=2.2, approximate the value of y(2.5) using step size h=0.05

ACTUAL ANSWER: y(2.5) = 3.49201…

Euler’s Method
i h x_i y_i k = f(x_i,y_i) y_(i+1)
0 0.05 1.5 2.2 0.6 2.23
1 0.05 1.55 2.23 0.67425 2.2637125
2 0.05 1.6 2.2637125 0.74903 2.301164
3 0.05 1.65 2.301164 0.8240397 2.342365985
4 0.05 1.7 2.342365985 0.8989889128 2.387315431
5 0.05 1.75 2.387315431 0.9735989982 2.435995381
6 0.05 1.8 2.435995381 1.047604158 2.488375588
7 0.05 1.85 2.488375588 1.120752581 2.544413217
8 0.05 1.9 2.544413217 1.192807443 2.60405359
9 0.05 1.95 2.60405359 1.26354775 2.667230977
10 0.05 2 2.667230977 1.332769023 2.733869428
11 0.05 2.05 2.733869428 1.400283836 2.80388362
12 0.05 2.1 2.80388362 1.465922199 2.87717973
13 0.05 2.15 2.87717973 1.52953179 2.95365632
14 0.05 2.2 2.95365632 1.590978049 3.033205222
15 0.05 2.25 3.033205222 1.650144125 3.115712428
16 0.05 2.3 3.115712428 1.706930708 3.201058964
17 0.05 2.35 3.201058964 1.761255718 3.289121749
18 0.05 2.4 3.289121749 1.813053901 3.379774445
19 0.05 2.45 3.379774445 1.862276305 3.47288826
20 0.05 2.5 y(2.5) = 3.47288826

 

 

 

 

 

Improved Euler’s Method
i h x_i y_i k1 z_(i+1) k2 y_(i+1)
0 0.05 1.5 2.2 0.6 2.23 0.67425 2.23185625
1 0.05 1.55 2.23185625 0.6728114063 2.26549682 0.7476025438 2.267366599
2 0.05 1.6 2.267366599 0.746106721 2.304671935 0.8211456538 2.306547908
3 0.05 1.65 2.306547908 0.8195979758 2.347527807 0.8946013641 2.349402892
4 0.05 1.7 2.349402892 0.8930075421 2.394053269 0.9677033899 2.395920665
5 0.05 1.75 2.395920665 0.9660694182 2.444224136 1.040198278 2.446077357
6 0.05 1.8 2.446077357 1.038530378 2.498003876 1.111846414 2.499836777
7 0.05 1.85 2.499836777 1.110150981 2.555344326 1.18242289 2.557151124
8 0.05 1.9 2.557151124 1.180706432 2.616186446 1.251718216 2.61796174
9 0.05 1.95 2.61796174 1.249987303 2.680461105 1.319538895 2.682199895
10 0.05 2 2.682199895 1.317800105 2.7480899 1.385707852 2.749787594
11 0.05 2.05 2.749787594 1.383967716 2.81898598 1.450064721 2.820638405
12 0.05 2.1 2.820638405 1.448329675 2.893054889 1.512465995 2.894658297
13 0.05 2.15 2.894658297 1.510742331 2.970195413 1.572785045 2.971746481
14 0.05 2.2 2.971746481 1.571078871 3.050300425 1.630912022 3.051796253
15 0.05 2.25 3.051796253 1.629229215 3.133257714 1.686753629 3.134695825
16 0.05 2.3 3.134695825 1.685099802 3.218950815 1.740232793 3.220329139
17 0.05 2.35 3.220329139 1.738613261 3.307259802 1.791288237 3.308576677
18 0.05 2.4 3.308576677 1.789707988 3.398062076 1.839873957 3.399316225
19 0.05 2.45 3.399316225 1.838337624 3.491233107 1.885958617 3.492423631
20 0.05 2.5 y(2) = 3.492423631

 

 

 

 

Runge-Kutta
i h x_i y_i k1 = f(x_i,y_i) k2 = f(x_i+.5h,y_i+.5hk1) k3 = f(x_i+.5h, y_i+.5hk2) k4 = f(x+h,y+hk3) Runge-Kutta y_(i+1) = y_i + h*(k1+2k2+2k3+k4)/6
0 0.05 1.5 2.2 0.6 0.6366875 0.6359881445 0.6728554594 2.23181839
1 0.05 1.55 2.23181839 0.6728407481 0.709821466 0.7090934081 0.746181552 2.267292157
2 0.05 1.6 2.267292157 0.7461662747 0.7832936203 0.7825394711 0.8197042176 2.306438296
3 0.05 1.65 2.306438296 0.8196884061 0.8568207014 0.856043244 0.8931456109 2.349259645
4 0.05 1.7 2.349259645 0.8931293019 0.9301304558 0.9293326184 0.9662395087 2.395745436
5 0.05 1.75 2.395745436 0.9662227434 1.002962858 1.002147687 1.038732462 2.445871905
6 0.05 1.8 2.445871905 1.038715285 1.075071194 1.074241825 1.110384803 2.499602956
7 0.05 1.85 2.499602956 1.110367265 1.146222996 1.145382627 1.180971517 2.556890873
8 0.05 1.9 2.556890873 1.18095367 1.216200837 1.215352702 1.250282954 2.617677071
9 0.05 1.95 2.617677071 1.250264856 1.284802979 1.283950319 1.318125413 2.681892878
10 0.05 2 2.681892878 1.318107122 1.351843875 1.350989913 1.384321567 2.749460347
11 0.05 2.05 2.749460347 1.384303145 1.417154527 1.416302445 1.448710757 2.820293079
12 0.05 2.1 2.820293079 1.448692267 1.480582715 1.479735625 1.51114915 2.894297063
13 0.05 2.15 2.894297063 1.511130657 1.541993079 1.541154007 1.57150976 2.971371518
14 0.05 2.2 2.971371518 1.57149133 1.601267084 1.600438946 1.629682352 3.051409732
15 0.05 2.25 3.051409732 1.629664051 1.658302858 1.657488442 1.685573222 3.134299898
16 0.05 2.3 3.134299898 1.685555117 1.713014923 1.712216872 1.739104879 3.219925928
17 0.05 2.35 3.219925928 1.739087035 1.765333814 1.764554613 1.79021561 3.308168257
18 0.05 2.4 3.308168257 1.790198091 1.815205609 1.814447568 1.838858971 3.398904619
19 0.05 2.45 3.398904619 1.838841842 1.862591365 1.861856614 1.885003188 3.492010794
20 0.05 2.5 y(2.5) = 3.492010794

OpenLab #3: Numerical methods PROJECT – Part 1

Numerical methods provide a way to compute (approximate) values of solutions to differential equations, even when we cannot solve the equations exactly.  The drawback is the large number of numerical calculations required to obtain a desired value and level of precision.  In this project, you will use technology to implement the various numerical methods and use your technological solution to solve differential equations problems.

Assignment (Due Thursday, March 23).  Create a numerical methods calculator.  You can choose your technology tool for this job – use any one of the following:

  1. a spreadsheet (Excel, Google Sheets, or other spreadsheet)
    • if you choose to create a spreadsheet, you should have columns forx, y, f(x,y) , and so on, and each stage should appear in its own row
  2. a programming language (Java, Perl, or other programming language)
    • if you choose to write code, your program should output the values of x, y, f(x,y) and so on at each stage
  3. mathematical software (MatLab, Maple, Mathematica, or other mathematical software)
    • if you choose to use mathematical software, your program should output the values of x, y, f(x,y) and so on at each stage

How to submit. Part 2 of this project will talk about how to submit your project – you will be asked to upload your solution (spreadsheet, or code, or mathematical software document) and to write  about what you did.  For now, focus on getting your solution working.

Requirements:

  1. Your solution should allow you to solve problems of this type:

Example.  Given the differential equation dy/dx=x^2-0.5xy and initial condition y(1.5)=2.2, approximate the value of y(2.5) using step size h=0.05

  1. Your solution must be able to carry out Euler’s Method, Improved Euler’s Method, and Runge-Kutta (you may implement these as three separate spreadsheets or programs if you wish).
  2. Your solution should display all the points (x,y) found along the way, not just the final point.
  3. Your solution should also display other values found while carrying out each method:
    1. Euler’s Method: display the slope f(x,y) at each stage
    2. Improved Euler’s: display the values of k1, k2 at each stage
    3. Runge-Kutta: display the values of k1, k2, k3, k4 at each stage
    4. You can display other values as well, if you wish (for example, the intermediate y-value in the Improved Euler method that we refer to as z).
  4. Your solution may NOT use any built-in version of these methods (for example, most mathematical software contains a built-in command for Euler’s Method – you can use this to check your work, but you need to create your own solution).
  5. You should be able to relatively easily change the initial condition, step size, and target value.
  6. You should be able to relatively easily change the differential equation.

Test your project.  Solution data for the above example using Euler, Improved Euler, and Runge-Kutta will be posted this weekend so you can test your project.  You can also use examples from class to test your work, since you know what the solutions are.

 

OpenLab #2: Technology Survey

Please complete the following survey no later than this Thursday, March 2nd.

MAT 2680 Technology Survey

Part of this course will introduce numerical solution methods for differential equations - these methods can generate extremely accurate approximate solutions when implemented on a computer. This survey is intended to give an indication of which technological tools you are most familiar with.

  • Like Microsoft Excel, Google Sheets, OpenOffice Calc, or others?
  • Like Microsoft Excel, Google Sheets, OpenOffice Calc, or others.
  • In any programming language (for example Python, Java, C++, PHP, etc.)
  • Python, Java, Javascript, C, C++, Swift, PHP, SQL, or others.
  • Like Maple, Mathematica, R, or others.
  • Maple, Mathematica, R, or others.
  • TI-84+, TI-89, or others
  • TI-84+,TI-89, or others

OpenLab #1: Advice from the Past

In Fall 2014 I taught this same course.   At the end of the semester, I gave my students the following assignment:

Imagine that you are invited to speak on the first day of MAT 2680, to give advice to entering students.  Write at least three sentences … describing what you would tell them.

To see the assignment and the students’ responses, follow this link.

Your assignment, due at the beginning of class next Thursday, February 16th, is to:

  1. Read through ALL the responses (there are 57 of them, but many of these are short replies to other comments).
  2. Write a reply to this post (1 paragraph) responding to all of the following:
    1. What advice seemed most relevant to you personally? Why? (you can copy/paste a short statement, or put it in your own words)
    2. Based on this advice, what changes can you make right now to help you succeed in this course?

Extra Credit. For extra credit, write a response to one of your classmates’ comments.  Do you have any advice?  Be kind.