MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Functions and Packages

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26928] RE: [mg26873] Functions and Packages
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 26 Jan 2001 23:30:05 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Abel,

You should name needed packages in the BeginPackage statement.

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

I would also like to suggest (although not everyone may agree with this)
that you put your package in the AddOns/ExtraPackages directory where you
can also create a Calculus subdirectory. Then it will behave just like
regular Mathematica packages, but be separate from them. Mathematica
automatically looks in both the StandardPackages and ExtraPackages
directories for packages. That is why I added Calculus` to your package
name. The first parts of the package name in the BeginPackage statement give
the file path down from ExtraPackages and the last part gives the file name
for the package itself.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


> From: Abel Toledano [mailto:toledano11 at hotmail.com]
To: mathgroup 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?
>
>   	Thanks
> 	Abel



  • Prev by Date: Re: Functions and Packages
  • Next by Date: Re: metacharacters as record separators
  • Previous by thread: Re: Functions and Packages
  • Next by thread: Re: Functions and Packages