Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Probability space valued functions

I am trying to define a FiniteProbabilitySpace whose probabilities depend on a value x:

var('x') S=[-1,0,1] P={} P[1] = lambda x: x P[-1] = lambda x: x P[0] = lambda x: 1.-2*x Sp = DiscreteProbabilitySpace(S,P)

Then if I say Sp.entropy(), I get the result:

TypeError: bad operand type for unary -: 'function'

which seems logic, I did not determine x. But if I say Sp(0).entropy(), I get:

TypeError: Unable to convert x (='<function<lambda>at0xa65d2a8>') to real number.

I do not understand this. Is it possible to do what I want?

Thank you very much!

Probability space valued functions

I am trying to define a FiniteProbabilitySpace whose probabilities depend on a value x:

var('x') S=[-1,0,1] P={} var('x')
S=[-1,0,1]
P={}
P[1] = lambda x: x x
P[-1] = lambda x: x x
P[0] = lambda x: 1.-2*x Sp = DiscreteProbabilitySpace(S,P)

Then if I say Sp.entropy(), Sp.entropy(), I get the result:

TypeError: bad operand type for unary -: 'function'

which seems logic, I did not determine x. But if I say Sp(0).entropy(), Sp(0).entropy(), I get:

TypeError: Unable to convert x (='<function<lambda>at0xa65d2a8>') to real number.

I do not understand this. Is it possible to do what I want?

Thank you very much!

Probability space valued functions

I am trying to define a FiniteProbabilitySpace whose probabilities depend on a value x:

var('x')
S=[-1,0,1]
P={}
P[1] = lambda x: x
P[-1] = lambda x: x
P[0] = lambda x: 1.-2*x 1.-2*x
Sp = DiscreteProbabilitySpace(S,P)

Then if I say Sp.entropy(), I get the result:

TypeError: bad operand type for unary -: 'function'

which seems logic, I did not determine x. But if I say Sp(0).entropy(), I get:

TypeError: Unable to convert x (='<function<lambda>at0xa65d2a8>') to real number.

I do not understand this. Is it possible to do what I want?

Thank you very much!

click to hide/show revision 4
retagged

Probability space valued functions

I am trying to define a FiniteProbabilitySpace whose probabilities depend on a value x:

var('x')
S=[-1,0,1]
P={}
P[1] = lambda x: x
P[-1] = lambda x: x
P[0] = lambda x: 1.-2*x
Sp = DiscreteProbabilitySpace(S,P)

Then if I say Sp.entropy(), I get the result:

TypeError: bad operand type for unary -: 'function'

which seems logic, I did not determine x. But if I say Sp(0).entropy(), I get:

TypeError: Unable to convert x (='<function<lambda>at0xa65d2a8>') to real number.

I do not understand this. Is it possible to do what I want?

Thank you very much!