Re: Different Methods inside one package. More details
- To: mathgroup at smc.vnet.net
- Subject: [mg33722] Re: Different Methods inside one package. More details
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 10 Apr 2002 00:49:02 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <a8ttp0$foh$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
add a usage message.
EV::usage="EV is a possible value for the Method option of methodTest1."
or use the full context path and write
methodTest1[A,inti,Method->test`test1`Private`EV]
Regards
Jens
"J. Guillermo Sanchez" wrote:
>
> (* Dear friends,
> I find that this pattern is mush better that the message that I post a
> few hours ago.
> I wish build a package where the user, as one option, can be choose one
> of three methods of evaluation, i.e: Automatic, LT or EV. Some thing
> like the silly example that follow. It works, I will appreciate any idea
> to enhanced it , i.e.: I need write EV and LT before Begin["`Private`"],
> how can avoid write its? .*)
>
> BeginPackage["test`test1`"]
>
> methodTest1::usage="SystemDSolve1. This is an example"
>
> EV;LT; (*How can avoid write its?*)
>
> Options[methodTest1]={Method\[Rule]Automatic};
>
> Begin["`Private`"]
>
> methodTest1[matrixA_, incond_, opts___]:=
> Module[{a, b, r, Opts},Opts= Method/.{opts}/.Options[methodTest1];
> Which[Opts=== Automatic,(a = matrixA; b = incond; r = a
> / b),
> Opts=== LT,(a = matrixA; b = incond; r = a + b),
> Opts=== EV,(a = matrixA; b = incond; r = a - b)]]
>
> End[]
>
> Protect[methodTest1];
>
> EndPackage[]
>
> list1 ={{a11, a12 },{a21,a22}}
>
> list2 = {b1, b2}
>
> methodTest1[list1,list2]
>
> methodTest1[list1,list2, Method\[Rule]LT]
>
> methodTest1[list1,list2, Method\[Rule]EV]