Beginner problem solving equations.
Dear all,
This is my second day on Sagemath!
I don't understand what I'm doing wrong, and right now, I can't even open the documentation online (I get error even there). I simply want to solve the last equation for p_n
, I suppose that Sage sees that I am comparing two equations, so it doesn't understand that I want to compare the right-hand side of both, but then what is the purpose of the .rhs
method? (Even here, it would be nice to understand what this is... I'm copying the code of a friend of mine and trying to apply it to my own problem).
P.S. Also with respect to the documentation, what should I read, about this stuff? I went through the first sections, but I saw nothing on methods.
var('x, p_r, p_n, t, beta, delta')
U_ow_np = x - p_n
U_ow_p = x*(1-beta) - p_n + (delta/(1-delta))*p_r*(1-t)
U_r_p = 1-x*(1-beta) - delta*p_r
U_O_O = 1-x
x_ow_np_ow_p = solve(U_ow_np == U_ow_p, x)[0].rhs
x_ow_p_r_p = solve(U_ow_p == U_r_p, x)[0].rhs
x_r_p_O_O = solve(U_r_p == U_O_O, x)[0].rhs
# Here I get the error.
solve(x_ow_np_ow_p == x_ow_p_r_p, p_n)[0].rhs
P.S. What does the [0] mean?
Sorry for the naivite, I tried to have a look on the forum, but this problem seems too basic for this forum...
Welcome to Ask Sage! Thank you for your question!
Try using .rhs() with brackets. [0] gives you the first element of an array.
Exactly, thank you!