Re: How to change symbolic values to numbers
- To: mathgroup at smc.vnet.net
- Subject: [mg77052] Re: How to change symbolic values to numbers
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sat, 2 Jun 2007 04:12:36 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f3of5j$oq2$1@smc.vnet.net>
krzysztof.lisowski at wp.pl wrote:
> Hello for all.
> I have a problem with changeing symbolic to number values:
>
> f1[{x1_,x2_}]=Block[{},
> L={x1, 1-x1};
> Print[L]; (*Print prints {x1, 1-x1} but I want to get value {.5, .
> 5)*)
>
> ];
>
> fCE=f1[{x1,x2}]; fC[{x1_, x2_}]=fCE;
> fCi:=(N[f1[#]])&;
> fCa=fCi[{.5,.5}];
> fCa
>
> Any help would by very appreciated.
> With best regards,
> Krzysztof Lisowski
>
>
Use SetDelayed (:=) rather than Set (=) and define L in your Block
statement otherwise it is useless (although Module might be more
appropriate here).
f1[{x1_, x2_}] := Block[{L}, L = {x1, 1 - x1}; Print[L]; ];
f1[{0.5, 2.}]
{0.5, 0.5}
Regards,
Jean-Marc