MathGroup Archive 2006

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

Search the Archive

Re: function's local constants interdependence


Just use, e. g., Module[{a,b,c},a=1;b=2a;c=Sqrt[b];a+b+c]

On 9/17/06, rych <rychphd at gmail.com> wrote:
> Could someone please help me find a decent way to have local constants
> defined using one another in order?
> Simple "With[" doesn't work:
>
> Clear[a,b,x,y]
> ff[x_,y_]:=With[{a=x, b=2*a},{a,b}]
> ff[x,y]
> > {x,2 a}
>
> where I'd like it be >{x, 2 x}. I suspect it would work with "Module["
> but I especially wanted them to be constants.
>
> Do I have to nest With[ ? Or is there a prettier way?
> Thanks
> Igor
>
>


-- 
http://chris.chiasson.name/


  • Prev by Date: Re: function's local constants interdependence
  • Next by Date: Re: function's local constants interdependence
  • Previous by thread: function's local constants interdependence
  • Next by thread: Re: function's local constants interdependence