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;

[Maple Math]

> a := b:
b := s:

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

[Maple Math]

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

[Maple Math]

> evalf(hyp);

[Maple Math]

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;

[Maple Math]

>

>

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

[Maple Math]

> evalf(sides);

[Maple Math]

> sides[1];

[Maple Math]

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

[Maple Math]

> evalf(Area);

[Maple Math]

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

[Maple Math]

> evalf(stuff);

[Maple Math]

>

>

>

>

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 );

[Maple Plot]

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 );

[Maple Math]

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 );

[Maple Math]

>

The problem itself

Problem 3