Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error: unsupported operand type for ^ or pow(): 'list' and 'int' (Newbie)

Hi all,

I want to do a very simple thing: display an equation in Sage:

%display typeset 
var('d, r, mu, c, g_1, g_2')

pi_m = [(1+d)*g_1 + r*(1-d*mu)-c*d^2]^(2)/(4*g_1) + [(1+d)*g_2 - c*d^2]^(2)/(4*g_2)

I receive the following error, which I understood is related to the fact that Python and Sage cannot elevate a list to the power of an integer:

TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int'

Unfortunately, from the past answers I understood the problem, not the solution :D.

Can anyone help me? I imagine it's something immediate...