       Re: Functions and Packages

• To: mathgroup at smc.vnet.net
• Subject: [mg26915] Re: Functions and Packages
• From: "Allan Hayes" <hay at haystack.demon.co.uk>
• Date: Fri, 26 Jan 2001 23:29:55 -0500 (EST)
• References: <94r6u9\$id9@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Abel,

One problem with the way that you have it is that the context
"Calculus`VariationalMethods`" will not be in \$ContextPath after

BeginPackage["Extremal`", "Calculus`VariationalMethods`"]
Extremal;
Begin["`Private`"]

End[]
EndPackage[]

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Abel Toledano" <toledano11 at hotmail.com> wrote in message
news:94r6u9\$id9 at smc.vnet.net...
> 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: Re: Functions and Packages
• Next by thread: RE: Functions and Packages