Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Don't understand replacement rule for some functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89551] Re: [mg89538] Don't understand replacement rule for some functions
  • From: "Szabolcs HorvÃt" <szhorvat at gmail.com>
  • Date: Thu, 12 Jun 2008 06:29:36 -0400 (EDT)
  • References: <200806120658.CAA08881@smc.vnet.net>

On Thu, Jun 12, 2008 at 09:58, Mac <mwjdavidson at googlemail.com> wrote:
> Can somebody explain why the following replacement rule works
>
> In[15]:= f[x] /. x -> y
>
> Out[15]= f[y]
>
> and this one complains
>
> In[14]:= RandomReal[GammaDistribution[L, 1/L], 2] /. L -> 3
>
> During evaluation of In[14]:= RandomReal::parpos: The parameter L in \
> position 1 of GammaDistribution[L,1/L] should be positive >>
>
> Out[14]= {1.89311, 1.11748}
>
> I find it quite elegant to use replacements for complicated functions
> but I'm never quite sure whether the replacement is actually carried
> out because of such behavior.
>

Break up your expression and test the fragments separately.
RandomReal[GammaDistribution[L, 1/L], 2] will give an error because it
should not contain any symbolic expressions like L.


  • Prev by Date: Re: 4 variable, whats the least cost?[i remember 2var linear programing]
  • Next by Date: Re: Re: ConditionNumber
  • Previous by thread: Don't understand replacement rule for some functions
  • Next by thread: Re: Don't understand replacement rule for some functions