16.12.2012 Views

Computer Algebra Recipes

Computer Algebra Recipes

Computer Algebra Recipes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.3. VARIATIONAL CALCULUS MODELS 187<br />

The goal is to ¯nd the shape y(x) that minimizes A."<br />

\I know that, Greg," Gino interjects, \but get to the point. As my business<br />

associates from Earth say, time is money. What is the bottom line? How many<br />

square sretem of cloth will I need?"<br />

A little perturbed by this sign of impatience, Greg's dialect has become<br />

stronger and his response is di±cult for us to precisely translate, but the gist of<br />

it goes something like this. Long ago, some ancestors on his mother's side had<br />

adopted a trial-and-error approach to ¯nding y(x). This consisted in choosing<br />

some form for y(x) and performing the integration to calculate A. Then the<br />

venerable ancestors would choose another form and see whether it generated a<br />

smaller value for A. With a touch of hyperbole, we think, Greg said that some<br />

kept repeating this process until either they became residents in the Erehwon<br />

asylum or inductees into the Erehwon Academy of Mathematics. According<br />

to his unbiased (?) version of history, a better approach was discovered long<br />

ago by one of Greg's illustrious ancestors on his father's side, Hil Arious Nerd.<br />

Evidently, Hil independently discovered the same method as developed by Euler<br />

and Lagrange on far-distant Earth. The method is as follows.<br />

Label the integrand of the area integral as F , i.e., F =2¼y p 1+(y0 ) 2 .<br />

The curve y(x) that minimizes the area is the solution of the Euler{Lagrange<br />

equation(knownastheNerdequationonErehwon)<br />

@F d @F<br />

¡ =0: (4.17)<br />

@y dx @y 0<br />

Solving this type of problem by hand has been a standard assignment given in<br />

the past by perverse professors on Erehwon6 to their students.<br />

It appears that Greg has calmed down so that we can understand him better,<br />

so let's pick up Greg's detailed narrative once again.<br />

\It'snowfrownedupontoin°ictmentalpainonstudents(anddressdesigners)<br />

by performing hand calculations when computers can do all the algebra for<br />

you with no errors. At the Erehwon Institute of Technology we use the Elpam<br />

computer algebra system, so let's use it to crack your problem.<br />

I will begin by loading the VariationalCalculus library package which contains<br />

the EulerLagrange command for generating the left-hand side of the<br />

Euler{Lagrange (Nerd) equation (4.17).<br />

> restart: with(VariationalCalculus):<br />

Next let's enter the integrand, F = y(x) p 1+(dy(x)=dx) 2 ,omittingthefactor<br />

of 2 ¼, which would ultimately cancel out of the equation,<br />

> F:=y(x)*sqrt(1+diff(y(x),x)^2);<br />

s<br />

μ<br />

d<br />

F := y(x) 1+<br />

dx y(x)<br />

2<br />

The EulerLagrange command is applied to F , the second argument (x) being<br />

the independent variable, the third argument the dependent variable. The<br />

result is then simpli¯ed.<br />

6 Author's note: This quaint, but archaic, custom is still widely practiced on Earth.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!