Ask Your Question

Revision history [back]

In a system of 5 nonlinear equations with 5 unknowns using the solve command, Sage gives 5 lists of 5 solutions. Is it possible to print only one list with the 5 third solutions?

For example: var('a,b,c,d,e,f,g,h,i,j,k,l,x,y,p,q,r,s,t,u,v,A,B,C,D,E,F,G,H,T,K,L,M,N') solve([A - E, AE - B, BE - C, CE - D - 10, DE + 2], A,B,C,D,E, solution_dict=true)

[{A: 1.724306472919419, B: 2.973232669869595, C: 5.126764621146644, D: -1.159886628876292, E: 1.724306472919419}, {A: -0.04961250951920438 - 1.781741795058672I, B: -3.172142423158106 + 0.1767933635362254I, C: 0.4723780710666982 + 5.643167572788117I, D: 0.03123165940893102 - 1.121627457212148I, E: -0.04961250951919667 - 1.781741795058679I}, {A: -0.04961250951920438 + 1.781741795058672I, B: -3.172142423158106 - 0.1767933635362254I, C: 0.4723780710666982 - 5.643167572788117I, D: 0.03123165940893102 + 1.121627457212148I, E: -0.04961250951919667 + 1.781741795058679I}, {A: -1.825113562621674, B: 3.331039229181005, C: -6.079524680073126, D: 1.095822281167109, E: -1.825113562621674}, {A: 0.2000320307495195, B: 0.04001281142046625, C: 0.008003843719970937, D: -9.99839871897518, E: 0.2000320307495195}]

But I only need to print the list of the C solutions. Say:

[ C: 5.126764621146644, C: 0.4723780710666982 + 5.643167572788117I, C: 0.4723780710666982 - 5.643167572788117I, C: -6.079524680073126, C: 0.008003843719970937]

Or something like that.

In a system of 5 nonlinear equations with 5 unknowns using the solve command, Sage gives 5 lists of 5 solutions. Is it possible to print only one list with the 5 third solutions?

For example: example:

var('a,b,c,d,e,f,g,h,i,j,k,l,x,y,p,q,r,s,t,u,v,A,B,C,D,E,F,G,H,T,K,L,M,N')
solve([A - E, AE A*E - B, BE B*E - C, CE C*E - D - 10, DE D*E + 2], A,B,C,D,E, solution_dict=true)

solution_dict=true) [{A: 1.724306472919419, B: 2.973232669869595, C: 5.126764621146644, D: -1.159886628876292, E: 1.724306472919419}, {A: -0.04961250951920438 - 1.781741795058672I, 1.781741795058672*I, B: -3.172142423158106 + 0.1767933635362254I, C: 0.4723780710666982 + 5.643167572788117I, 0.1767933635362254*I, C: 0.4723780710666982 + 5.643167572788117*I, D: 0.03123165940893102 - 1.121627457212148I, 1.121627457212148*I, E: -0.04961250951919667 - 1.781741795058679I}, 1.781741795058679*I}, {A: -0.04961250951920438 + 1.781741795058672I, 1.781741795058672*I, B: -3.172142423158106 - 0.1767933635362254I, C: 0.4723780710666982 - 5.643167572788117I, 0.1767933635362254*I, C: 0.4723780710666982 - 5.643167572788117*I, D: 0.03123165940893102 + 1.121627457212148I, 1.121627457212148*I, E: -0.04961250951919667 + 1.781741795058679I}, 1.781741795058679*I}, {A: -1.825113562621674, B: 3.331039229181005, C: -6.079524680073126, D: 1.095822281167109, E: -1.825113562621674}, {A: 0.2000320307495195, B: 0.04001281142046625, C: 0.008003843719970937, D: -9.99839871897518, E: 0.2000320307495195}]

0.2000320307495195}]

But I only need to print the list of the C solutions. Say:

[ C: 5.126764621146644,
  C: 0.4723780710666982 + 5.643167572788117I,
  C: 0.4723780710666982 - 5.643167572788117I,
5.643167572788117*I,
  C: 0.4723780710666982 - 5.643167572788117*I,
  C: -6.079524680073126,
  C: 0.008003843719970937]

0.008003843719970937]

Or something like that.