Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

MATHS 159 Lab 9: Solving Mathematical Problems with Mathematica, Lab Reports of Mathematics

A lab assignment for a mathematics course where students are required to use mathematica to answer various mathematical questions. The assignment includes instructions on how to create print statements, define piecewise functions, and use the bisection method to find roots. Students are also encouraged to use mathematica's features to help with the calculations and to submit their work in a mathematica notebook file.

Typology: Lab Reports

2009/2010

Uploaded on 03/28/2010

koofers-user-oud
koofers-user-oud 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
MATHS 159 Lab 9
This lab is due on Monday, November 16, 2009. For this lab, please find at least one partner
from your section to work with your group’s work should be turned in by only one
member of the group, designated as the group leader. Using Mathematica, answer each of
the questions below. Include all of your work for this lab, including written responses in single
Mathematica notebook file, with answers to each question clearly marked (to help with this, use
the formatting ideas we talked about in class). Whenever possible, to save time and do less hand
calculation, use Mathematica’s features to help with these questions. Be as neat and complete
as possible. Save this Mathematica file as LastnameFirstname15900XLab9.nb, where 00X is
chosen to be 001 or 002, as appropriate to the section in which you are enrolled, using your
group leader’s name. The group leader is responsible for turning in the assignment file with
names of all members of the group written in the file and should send everybody in the group
a copy of the file. Your group’s Mathematica file should also be emailed to our class Graduate
Assistant, Priyanka Bhatlapenumarthi at bhrrpriyanka@gmail.com.
1. (Making a Print Statement): Use the Print command to print out the following type of statement
that includes the names of the partners who worked on this assignment. This is what lab
partners Stan Laurel and Oliver Hardy would have printed using Mathematica 7.0, if they chose
the function f[x] = sin(
2x
) as their “favorite” function. Assume your favorite function is the
same as theirs! (Hint: Look up TraditionalForm in the Help file.)
pf3
pf4

Partial preview of the text

Download MATHS 159 Lab 9: Solving Mathematical Problems with Mathematica and more Lab Reports Mathematics in PDF only on Docsity!

MATHS 159 Lab 9

This lab is due on Monday, November 16, 2009. For this lab, please find at least one partner from your section to work with – your group’s work should be turned in by only one member of the group, designated as the group leader. Using Mathematica, answer each of the questions below. Include all of your work for this lab, including written responses in single Mathematica notebook file, with answers to each question clearly marked (to help with this, use the formatting ideas we talked about in class). Whenever possible, to save time and do less hand calculation, use Mathematica’s features to help with these questions. Be as neat and complete as possible. Save this Mathematica file as LastnameFirstname15900XLab9.nb , where 00X is chosen to be 001 or 002, as appropriate to the section in which you are enrolled, using your group leader’s name. The group leader is responsible for turning in the assignment file with names of all members of the group written in the file and should send everybody in the group a copy of the file. Your group’s Mathematica file should also be emailed to our class Graduate Assistant, Priyanka Bhatlapenumarthi at bhrrpriyanka@gmail.com.

  1. ( Making a Print Statement ): Use the Print command to print out the following type of statement that includes the names of the partners who worked on this assignment. This is what lab partners Stan Laurel and Oliver Hardy would have printed using Mathematica 7.0, if they chose

the function f[x] = sin( x  2 ) as their “favorite” function. Assume your favorite function is the

same as theirs! (Hint: Look up TraditionalForm in the Help file.)

  1. ( Creating Piecewise Functions Revisited ) In Example 3.5.3 of the optimization problems handout from Lab 8, the function f[x]=(Abs[x]-2)^(1/3) is considered. In order to deal with the cube roots, the Mathematica RealOnly Package is called via a Get command: <<MiscellaneousRealOnly. In Mathematica 7.0 this package is obsolete, so if you load it, Mathematica will warn you it is no longer being used.

(a) Let f1[x]=x^(1/3). Using Mathematica, find each of the following: f1[1], f1[-1], f1’[x], f1’[1], and f1’[-1]. Then graph f1[x] and f1’[x] on the x-interval [-3,3]. What do you notice?

(b) One way to fix the “problem” with the cube root function in Mathematica is to use a piecewise definition for the function. Define f2[x] with the following commands:

f2[x_]:= x^(1/3) /; x > 0 f2[x_]:= -(-x)^(1/3) /; x < 0

Repeat part (a). Is there any improvement?

(c) Using commands such as If, Which, or Switch, create a cube root function r[x] that works the way the cube root is supposed to work, i.e. Mathematica can find r[1], r[-1], and plot both r[x] and r’[x] correctly.

(d) Repeat part (c) for f[x]=(Abs[x]-2)^(1/3). You should get these graphs for y = f[x] and y = f’[x]:

(e) Repeat part (d) with the following change. Instead of being given the value of n (i.e., how many times to repeat the process), you are only given the allowable error (and a maximum number of bisections to make). That is, given the error tolerance, you must continue using the bisection method until you are certain that the approximation of x_n is accurate to the actual root to within the error tolerance or you have completed the maximum number of bisections without achieving the desired accuracy. Make your program only print out the final interval and final approximation. Test your program with n = 50 and error tolerance = 0.0001. How does the output of this program compare to that in part (b) and (c)?