**Maple Introduction, Part 4:**

**Using Maple to Solve Problems**

Integrated, First-
Year
Curriculum in Science, Engineering, and Mathematics

Based on a notebook by Claude Anderson

Extensively revised by Kurt Bryan and David Mutchler

**Introduction**

**Questions and Answers about Maple **
**(about 10 minutes)**

**Syntax issues**

**The difference between **
**f := ... **** and **
**f := x -> ...**

**The difference between **
**solve**** and **
**fsolve**

**Solve**** and **
**RootOf**

**Overlaying plots**

**Homework problems**

Work through the sections above (executing all the input regions) before you begin this homework!

Caution: it is not by accident that you have several days to work on these problems. Don't forget the need for some "incubation time" on some of the hard problems. You should start thinking about each as soon as is practical, preferably tonight. None of the problems should take too much total time, provided that you start early enough and take a break when you get stuck. Ask for help (other IFYCSEM students, the Learning Center, or any of your Maple professors) if you need it.

**Problem 0**

**Problem 1**

(There really is enough info to do this problem) Consider a right triangle whose perimeter is 100 inches. Construct a function which provides the area of the triangle as a function of its hypotenuse
*h.*

a. Work on the problem without the computer. Drawing a diagram might help. Make sure you take advantage of the fact that it is a right triangle.

b. Define the function in Maple (as an expression or as a Maple function, your choice).

c. Plot the area as a function of
*h.*

d. Using only plotting and equation-solving commands (no calculus!), estimate the length of the hypotenuse for which the area of the triangle is the maximum.

`> `
**restart;**

`> `
**h := 100-2*s;**

`> `
**a := b:
b := s:**

`> `
**pyth := a^2 + b^2 = h^2;**

`> `
**hyp := [solve(pyth,s)];**

`> `
**evalf(hyp);**

Since the perimeter is limited to 100, only the second number of 29 is a valid answer for the length of the hypotenuse.

`> `
**pythNew := hyp[2]=2*l^2;**

`> `

`> `

`> `
**sides := [solve(pythNew,l)];**

`> `
**evalf(sides);**

`> `
**sides[1];**

`> `
**Area := .5*(sides[1])^2;**

`> `
**evalf(Area);**

`> `
**stuff := hyp[2]+2*sides[1];**

`> `
**evalf(stuff);**

`> `

`> `

`> `

`> `

**Problem 2**

**How to use fsolve (read this before doing the problem itself)**

A quick review:

As we saw earlier in this worksheet, there is a way to get Maple to try to find a numeric approximation to a root. Recall that you have to give it a place to start looking for the root, so we plot the expression first:

`> `
**plot( exp(x) * sin(x) + x^2 * ln(x) - 1, x = 0.1 .. 4 );**

It looks like one of the points where the expression equals 0 is between 0.5 and 1, so we give the command
*fsolve*
(a version of
*solve*
which numerically approximates the solution) our equation and a range where we think the root is:

`> `
**fsolve( exp(x) * sin(x) + x^2 * ln(x) - 1 = 0, x = 0.5 .. 1 );**

The
*fsolve*
command returns an approximation to the root, accurate to about 10 decimal places. The other root is between 3 and 4:

`> `
**fsolve( exp(x) * sin(x) + x^2 * ln(x) - 1 = 0, x = 3 .. 4 );**

`> `

**The problem itself**

**Problem 3**