OpenSource For You

Variable eliminatio­ns and equation solving

-

Very often, we come across ‘N’ sets of equations in ‘M’ sets of unknowns, where M >= N. If M = N, then it’s most likely that a unique solution exists. However, if M > N, then there may be many possible solutions, but with some constraint­s. In such a case, it would be helpful to deduce some simpler set of expression­s. This can be achieved using eliminate() of Maxima. Let’s have two polynomial expression­s in the three variables x, y and z to demonstrat­e this: $ maxima -q (%i1) p1: x^2 + 2*x*y + z^2$ (%i2) p2: x + y + z$ (%i3) string(eliminate([p1, p2], [x])); (%o3) [2*z^2-y^2] (%i4) string(eliminate([p1, p2], [y])); (%o4) [-z^2+2*x*z+x^2] (%i5) string(eliminate([p1, p2], [z])); (%o5) [y^2+4*x*y+2*x^2] (%i6) quit();

Note that in all the above polynomial expression­s, the expression­s are assumed to be equated to zero. A beautiful applicatio­n of the above is solving recurrence relations. Let’s assume that we have a non-linear equation given by Y =r * Y * (1 – Y ). And, we want to solve it for a scenario where as ‘n’ tends to infinity, the value of ‘Y’ oscillates between two distinct values. This means that Y = Y . Hence, we would have two expression­s with three unknowns to solve, namely: 1) Y 2) Y

=r*Y =r*Y * (1 – Y ) * (1 – Y ) So, representi­ng Y with yn1 and Y by yn, we may use

n+1 n solve() to solve for yn and yn1 in terms of r. But, if we want to get a feel of the equation which pops up, in terms of yn, we would have to use eliminate() to eliminate yn1. $ maxima -q (%i1) p1: yn1 = r * yn * (1 - yn)$ (%i2) p2: yn = r * yn1 * (1 – yn1)$ (%i3) string(eliminate([p1, p2], [yn1])); (%o3) [yn*(r^3*yn^3-2*r^3*yn^2+(r^3+r^2)*yn-r^2+1)] (%i4) string(solve([p1, p2], [yn, yn1])); /* Just to show the solution */ (%o4) [[yn = (r-1)/r,yn1 = (r-1)/r],[yn = -(sqrt(r^2-2*r-3)-r-1)/ (2*r),yn1 = (sqrt(r-3)*sqrt(r+1)+r+1)/(2*r)],[yn = (sqrt(r^2-2*r3)+r+1)/(2*r),yn1 = -(sqrt(r-3)*sqrt(r+1)-r-1)/(2*r)],[yn = 0,yn1 = 0]] (%i5) quit();

 ??  ??

Newspapers in English

Newspapers from India