|
[Date Index]
[Thread Index]
[Author Index]
Re: Replace in Modules
- To: mathgroup at smc.vnet.net
- Subject: [mg81264] Re: Replace in Modules
- From: Joerg Schaber <schaber at molgen.mpg.de>
- Date: Tue, 18 Sep 2007 00:35:44 -0400 (EDT)
- References: <fcg3t2$rcr$1@smc.vnet.net>
Thanks for your comments.
actually, my real problem was a more complicated and the
?NumceriQ-thing did work.
However, the hint that first f[z] is evaluated before the replacement is
done (I assumed it to be the other way round) and that FindRoot has the
HoldAll attribute led me to the simple solution to just do f[z/.{z->2}].
This was also recommended by another reply not in the newsgroups.
Thanks.
Joerg Schaber schrieb:
> Hi,
>
> why doesn't the following give me the square root?
>
> f[x_] := Module[{a, y},y = x;Return[FindRoot[y == a^2, {a, 1}]]]
>
> f[z] /. {z -> 2}
>
> where as
>
> f[x_] := Module[{a},Return[FindRoot[x == a^2, {a, 1}]]]
>
> f[z] /. {z -> 2}
>
> works fine?
>
> best,
>
> joerg
>
Prev by Date:
Re: piecewise functions from logical relationships (ie. solving with constraints)
Next by Date:
coupled map lattice problem
Previous by thread:
Re: Replace in Modules
Next by thread:
Re: Replace in Modules
|