MathGroup Archive 2006

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

Search the Archive

Re: Problems with Set, SetDelayed and replacement rules...


Johannes skrev:

> f[x_]:= g/h*x;
> g[p_]= 1+p;
> h[p_]=1+p^2;
> params={g->g[p],h->h[p]};
> [...]
> f3[x_, p_] := f[x] /. params;
> 
> If I am now calculating [...], for f3[1,1] p isn't replaced by its value 1.
> 
> Can anybody explain me the differences, especially the differences between f2 and f3? I suspected it to be exactly identical. 

Sorry. I cannot explain this, but it seems to work for me.

f3[x_, pp_] := (f[x] /. params) //. p -> pp

I thought params := ... instead of params = ... would be enough, but it 
seems it was not.

/ johan


  • Prev by Date: Re: simplifying inequalities
  • Next by Date: Re: simplifying inequalities
  • Previous by thread: Re: Problems with Set, SetDelayed and replacement rules...
  • Next by thread: Re: Problems with Set, SetDelayed and replacement rules...