       Re: Functions and Packages

• To: mathgroup at smc.vnet.net
• Subject: [mg26896] Re: [mg26873] Functions and Packages
• From: Jean-Marie THOMAS <jmt at agat.net>
• Date: Fri, 26 Jan 2001 23:29:43 -0500 (EST)
• References: <200101260627.BAA18685@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```You need to give a usage message to Extremal. A usage message, beside
providing information like
? Extremal
is the way Mathematica handles "exporting" functions outside packages.

In short :
BeginPackage["Extremal`"]
Extremal::usage="whatever you want, even nothing, i.e. an empty string"
Begin["`Private`"]
etc.

Make sure too the package is loaded :
Contexts[]
should return
{..., Extremal, ...}
If not, check in the book the way to load packages.

On Friday 26 January 2001 07:27, you wrote:
Hello.
I am using the package Calculus`VariationalMethods`,
to try to find the solutions of the functional:
J (y) =Integral[ f (x,y,y',y'',...)dx], a=< x =<b,
y(a)=a1, y(b)=b1, y'(a)=a2, y'(b)=b2, y''(a)=a3, y''(b)=b3,...

I have wrote this function:

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

To resolve the functional:
J(y)=Integral[(360 x^2 y-y''^2)dx],
0=< x =<1,y(0)=0,y(1)=0,y'(0)=0,y'(1)=5/2;
We do:
Extremal[360 x^2 y[x]-y''[x]^2,{0,1},{{0,0},{0,5/2}}]
We get : {{y[x]-> 1/2(2 x- 6 x^2 + 3 x^3 + x^6)}}, which is correct.

But, if I put this function inside a Package, like that:

BeginPackage["Extremal`"]
Extremal;
Begin["`Private`"]
Needs["Calculus`VariationalMethods`"]
Extremal[...]:=Module[{},...]
End[]
EndPackage[]

Then is NOT working. Why?

Thanks
Abel

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

```

• Prev by Date: Re: Functions and Packages
• Next by Date: Re: Functions and Packages
• Previous by thread: Functions and Packages
• Next by thread: Re: Functions and Packages