Re: Functions and Packages

• To: mathgroup at smc.vnet.net
• Subject: [mg26981] Re: Functions and Packages
• Date: Tue, 30 Jan 2001 03:38:29 -0500 (EST)
• References: <94r6u9\$id9@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

The problem was that f contained global versions of x and y,
whereas EulerEquations[...] was called with local versions
of x and y. Below is a complete solution to your problem,
I believe. Let me know if this is not the case:

BeginPackage["Extremal`", {"Calculus`VariationalMethods`"}]

Extremal::usage = "Usage: Extremal[ { f[ <<x, y[x]>> ], y[x], x } , {a,
b}, yy ] " ;

Begin["`Private`"]

Extremal[ { f_, y_[x_], x_ }, { a_, b_ } , yy:{__List} ] :=
Module[
{ w = Length[yy]-1, q, s }
,
q = Table[ Derivative[n][y] /@ {a,b} , {n, 0, w} ] // Flatten ;
q = Thread[ q == Flatten[yy] ] ;
s = EulerEquations[ f, y[x], x ] ;
s = Prepend[ q, s ];
DSolve[ s, y[x], x ]
]

End[]

EndPackage[]

math
Mathematica 4.1 for Linux
-- Motif graphics initialized --

In[1]:= <<Extremal`

In[2]:= ?Extremal
Usage: Extremal[ { f[ <<x, y[x]>> ], y[x], x } , {a, b}, yy ]

In[3]:= Extremal[ {360 x^2 y[x]-y''[x]^2,y[x],x},{0,1},{{0,0},{0,5/2}}]

2    3    6
-2 x  + x  + x
Out[3]= {{y[x] -> ---------------}}
2

//Marten

Sent via Deja.com
http://www.deja.com/

```

• Prev by Date: Re: i need help
• Next by Date: Re: How can I creat a user coordinate system for my routine?
• Previous by thread: RE: Functions and Packages