|
From: Alan G I. <ai...@am...> - 2005-09-22 19:30:02
|
On Thu, 22 Sep 2005, Andrea Riciputi apparently wrote:=20
> this is probably an already discussed problem, but I've not been able=20
> to find a solution even after googling a lot.=20
> I've a piecewise defined function:=20
> /=20
> | f1(x) if x <=3D a=20
> f(x) =3D |=20
> | f2(x) if x > a=20
> \=20
> where f1 and f2 are not defined outside the above range. How can I=20
> define such a function in Python in order to apply (map) it to an=20
> array ranging from values smaller to values bigger than a?=20
I suspect I do not understand your question.
But perhaps you want this:
def f(x):
return x<=3Da and f1(x) or f2(x)
fwiw,
Alan
|