Re: Functions and Packages

*To*: mathgroup at smc.vnet.net*Subject*: [mg26900] Re: Functions and Packages*From*: "Paul Lutus" <nospam at nosite.com>*Date*: Fri, 26 Jan 2001 23:29:45 -0500 (EST)*References*: <94r6u9$id9@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

"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; > q=Thread[q==Flatten[yy]]; > 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? Have you tried *not* using the same name for the package and the function? This is just an educated guess -- and such name conflicts are easy to avoid. Also, when you say it is not working, what specifically happens? What errors do you see? -- Paul Lutus www.arachnoid.com