MathGroup Archive 2002

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

Search the Archive

Re: Different Methods inside one package. More details


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]


  • Prev by Date: Interval arithmetic, of a sort
  • Next by Date: RE: function assignment to list of functions
  • Previous by thread: Different Methods inside one package. More details
  • Next by thread: Screenshot of Mathematica on SGI IRIX