# Revision history [back]

Give a name to the solutions:

sage: var('A3 A4 K l qzc')
(A3, A4, K, l, qzc)
sage: eq1 = -A3-A4*K*l+A3*cos(K*l)+A4*sin(K*l)+((qzc*l^2)/(2*K^2)) == 0
sage: eq2 = -A3*K^2*cos(K*l)-A4*K^2*sin(K*l)+(qzc/(K^2)) == 0
sage: solutions = solve([eq1, eq2], A3, A4)


This is now a list of solutions, with just one element, solutions[0].

This element is a list of two values described as equations: A3 == ..., A4 = ....

So we can get A3 and A4 as follows:

sage: sol = solutions[0]
sage: sol_A3 = sol[0].rhs()
sage: sol_A4 = sol[1].rhs()
sage: sol_A3
1/2*(2*K*l - (K^2*l^2 + 2)*sin(K*l))*qzc/(K^5*l*cos(K*l) - K^4*sin(K*l))
sage: sol_A4
1/2*((K^2*l^2 + 2)*cos(K*l) - 2)*qzc/(K^5*l*cos(K*l) - K^4*sin(K*l))


Another way is to tell solve to return each solution as a dictionary.

sage: sol_dict = solve([eq1, eq2], A3, A4, solution_dict=True)
sage: sol_dict
[{A3: 1/2*(2*K*l - (K^2*l^2 + 2)*sin(K*l))*qzc/(K^5*l*cos(K*l) - K^4*sin(K*l)),
A4: 1/2*((K^2*l^2 + 2)*cos(K*l) - 2)*qzc/(K^5*l*cos(K*l) - K^4*sin(K*l))}]


Then we can get the individual solutions:

sage: sol_A3 = sol_dict[0][A3]
sage: sol_A4 = sol_dict[0][A4]
sage: sol_A3
1/2*(2*K*l - (K^2*l^2 + 2)*sin(K*l))*qzc/(K^5*l*cos(K*l) - K^4*sin(K*l))
sage: sol_A4
1/2*((K^2*l^2 + 2)*cos(K*l) - 2)*qzc/(K^5*l*cos(K*l) - K^4*sin(K*l))