problem evaluating a function on a list
- To: mathgroup at smc.vnet.net
- Subject: [mg69867] problem evaluating a function on a list
- From: wtplasar at ehu.es
- Date: Tue, 26 Sep 2006 00:59:27 -0400 (EDT)
Hi everyone,
I have to ask for your advise once again.
I have this function
H[x_, om_,
or_, H0_] := If[Im[om - 4*om^(2/3)*or^(1/3) + 2*
or + 2*Sqrt[or]*Sqrt[om + or]] == 0. && -1 + om - 4*om^(2/3)
*or^(1/
3) + 2*or + 2*Sqrt[or]*Sqrt[om + or] < 0, H0*((1 - om -
2*or - 2*
Sqrt[or]*Sqrt[om + or])*(1 + x)^2 + (Sqrt[or] + Sqrt[or + om*(1
+
x)^3])^2), I]
and I want to evaluate it at a list
xlist = {0.09, 0.17, 0.27, 0.4, 0.88, 1.3, 1.43, 1.53, 1.75};
When I choose parameters so that a list of real values should be
obtained everything seems to be fine as one can see if for instance we
evaluate
H[xlist, 0.4, 0.1, 70]
(my result is {81.138, 92.4217, 108.473, 132.803, 261.891, 435.859,
503.238, 559.829, 699.774})
whereas in the cases I would expect the result to be
{I,I,I,I,I,I,I,I,I}
I get simply one single
I
instead, as one can see from evaluation of
H[xlist, -0.4, 0.1, 70].
Can someone indicate why this happens, and how I can get the
desired list which looks like {I,I,I,I,I,I,I,I,I}?
Thanks in advance for your time,
Ruth