MathGroup Archive 2002

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

Search the Archive

Different Methods inside one package. More details

(* 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? .*)


methodTest1::usage="SystemDSolve1. This is an example"

EV;LT; (*How can avoid write its?*)



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)]]




list1 ={{a11, a12 },{a21,a22}}

list2 = {b1, b2}


methodTest1[list1,list2, Method\[Rule]LT]

methodTest1[list1,list2, Method\[Rule]EV]

  • Prev by Date: Re: function assignment to list of functions
  • Next by Date: Re: Symbols using Prolog
  • Previous by thread: Re: FullSimplify[Abs[Sign[x]],x>=0] equals 1?
  • Next by thread: Re: Different Methods inside one package. More details