Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Flatten relations

I have a program in which I have created a list of variables

A = list(var('A_%d' % i) for i in (0..N))

and a list of expressions B involving the variables such that the i th expression involves A0, ... , Aj where j=i-1. The idea is the the B[i] should give you the formula for Ai. I now want to flatten all the relations by substituting in a number B[0] for A0, and then using B[i] to substitute inductively. E.g.

Suppose

B = [1, 2 A0, A0 + A1^2, A1 * A2, .....]

Then I want this to represent

A0 = 1, A1 = 2 A0, A2 = A0 + A1^2, A3 = A1 * A2, .....

and I want to produce the list obtained by solving these relations, i.e.

1, 2, 5, 5, ......

How should I go about this? Keep in mind that number of variables, N, will be quite large. To be a little more precise, I would actually like to obtain a list of arbitrary precision real balls, i.e. I want to solve the relations numerically with error bounds.