Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Define a function with different cases

I'm working with a function whose functional form is different at a specific value of the parameter (a=1):

 if a==1:
            U(x,L)=log(x)+log(1-L)
 else:
            U(x,L)=(x^(1-a)/(1-a)+(1-L)^(1-a)/(1-a))

Is it possible to define once and for all a function U(x,L,a) which includes the parameter as a variable so that I don't need to redefine it when a = 1?