Revision history [back]

You can do:

sage: A = list(var('A_%d' % i) for i in (0..3))
sage: A
[A_0, A_1, A_2, A_3]
sage: B = [1, 2 * A_0, A_0 + A_1^2, A_1 * A_2]


You can generically construct the list of equations as follows:

sage: [A[i] == b for i,b in enumerate(B)]
[A_0 == 1, A_1 == 2*A_0, A_2 == A_1^2 + A_0, A_3 == A_1*A_2]


And you can solve the system:

sage: solve([A[i] == b for i,b in enumerate(B)], A)
[[A_0 == 1, A_1 == 2, A_2 == 5, A_3 == 10]]