Ask Your Question
0

Unspecified function with some properties and substitution

asked 2024-01-11 16:27:18 +0100

Cyrille gravatar image

updated 2024-01-11 16:33:30 +0100

This is an unformal question.

suppose that I have an undefined function $U()$ such that if $y\geq x$ then $U(y) \geq U(x)$.

I know that $U(16) = .2 U(10)+.8 U(20)$ .

I have to evaluate formaly

$EU_1=0.1 U(10) + 0.4U(16) + 0.5U(20)$

where $EU_1$ is the expected utility of the lotery $l = [(10,0.1),(16,0.4),(20,0.5)]$. So first I want to substitute $U(16)$ in $EU_1$. On my sheet of paper this seems simple, but I do not know if I am able to write all this (with the substitution) in Sage ? Could some one help me.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-01-11 16:50:25 +0100

Max Alekseyev gravatar image

updated 2024-01-11 17:01:06 +0100

There are mutiple approaches possible, depending on the type of known relations and expression to evaluate. If they are linear over the values of $U()$ you can employ a linear algebra over the vectors of used $U()$ values. For a given example, we can work with vectors of coefficients of $U(10),U(16),U(20)$, and substitution of $U(16)$ into $EU_1$ can be performed by matrix multiplication:

eu_1 = vector([0.1,0.4,0.5])
eu_2 = Matrix([ [1,0.2,0], [0, 0, 0], [0, 0.8, 1] ]) * eu_1

Here we get eu_2 equal (0.180000000000000, 0.000000000000000, 0.820000000000000) with the coefficient of $U(16)$ (i.e., the second component) nullified.


If relations and expressions are (not necessarily linear) polynomials, a possible approach is to represent each used $U()$ value as a polynomial variable, and each known relation as a polynomial over those variables. Then defined a polynomial ring with the lexicographical term order (with variables to be substituted coming first), define an ideal generated by the relations, and perform reduction of a polynomial of interest with respect to this ideal:

K.<u16,u10,u20> = PolynomialRing(RR, order='lex')
J = K.ideal( [u16 - .2*u10 - .8*u20] )
eu_1 = 0.1*u10 + 0.4*u16 + 0.5*u20
eu_2 = eu_1.reduce(J)

Here we get eu_2 equal 0.180000000000000*u10 + 0.820000000000000*u20, that is, u16 got substituted.

edit flag offensive delete link more

Comments

Thanks Max

Cyrille gravatar imageCyrille ( 2024-01-13 16:22:36 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-01-11 16:27:18 +0100

Seen: 173 times

Last updated: Jan 11