# Revision history [back]

The key is to proceed in steps.

We tell Sage exactly what we want to do at each step.

Set up the variables and equations:

sage: A1, A2, A3, A4, K, qz, qzc, l, E, I, A, al, dT, y \
....: = var('A1, A2, A3, A4, K, qz, qzc, l, E, I, A, al, dT, y')
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

Solve:

sage: solutions = solve([eq1,eq2], A3, A4)
sage: sol_A3, sol_A4 = (eq.rhs() for eq in solutions[0])

Check the solutions:

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))

Define a new function:

sage: w2(x) = sol_A3*(cos(K*x) - 1) + sol_A4*(sin(K*x) - K*x) + (qzc*x^2)/(2*K^2)

Define some auxiliary variables and replacement values:

sage: kt = (A*E)/l
sage: literal_values = {
....:     qzc: qz/(E*I),
....:     K: sqrt((al*dT*A*kt*l)/((E*A+kt*l)*I)),
....: }
sage: numerical_values = {
....:     E: 21e4,
....:     I: 349e4,
....:     A: 2120.,
....:     l: 3000.,
....:     al: 11e-6,
....:     qz: 15.,
....:     dT: 100.,
....: }

Substitute:

sage: w2_intermediate = w2(x).subs(literal_values).subs(numerical_values)
sage: w2_intermediate
0.0000306297476108797*x^2 + (2.04666393778142e-11)*(9.80918229551222*sqrt(1/2) - 10.0137535816619*sin(2.45229557387805*sqrt(1/2)))*(cos(0.000817431857959351*sqrt(1/2)*x) - 1)/((1.09491158898182e-12)*sqrt(1/2)*cos(2.45229557387805*sqrt(1/2)) - (4.46484347419151e-13)*sin(2.45229557387805*sqrt(1/2))) - (2.04666393778142e-11)*(0.000817431857959351*sqrt(1/2)*x - sin(0.000817431857959351*sqrt(1/2)*x))*(10.0137535816619*cos(2.45229557387805*sqrt(1/2)) - 4)/((1.09491158898182e-12)*sqrt(1/2)*cos(2.45229557387805*sqrt(1/2)) - (4.46484347419151e-13)*sin(2.45229557387805*sqrt(1/2)))

Deal with the remaining exact sqrt(1/2):

sage: sage: w2_intermediate.subs({1/2: 0.5})
0.0000306297476108797*x^2 - 0.117540775230596*x + 106.403583186866*cos(0.000578011609920976*x) + 203.353657976985*sin(0.000578011609920976*x) - 106.403583186866

The key is to proceed in steps.

We tell Sage exactly what we want to do at each step.

Set up the variables and equations:

sage: A1, A2, A3, A4, K, qz, qzc, l, E, I, A, al, dT, y \
....: = var('A1, A2, A3, A4, K, qz, qzc, l, E, I, A, al, dT, y')
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

Solve:

sage: solutions = solve([eq1,eq2], A3, A4)
sage: sol_A3, sol_A4 = (eq.rhs() for eq in solutions[0])

Check the solutions:

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))

Define a new function:

sage: w2(x) = sol_A3*(cos(K*x) - 1) + sol_A4*(sin(K*x) - K*x) + (qzc*x^2)/(2*K^2)

Define some auxiliary variables and replacement values:

sage: kt = (A*E)/l
sage: literal_values = {
....:     qzc: qz/(E*I),
....:     K: sqrt((al*dT*A*kt*l)/((E*A+kt*l)*I)),
....: }
sage: numerical_values = {
....:     E: 21e4,
....:     I: 349e4,
....:     A: 2120.,
....:     l: 3000.,
....:     al: 11e-6,
....:     qz: 15.,
....:     dT: 100.,
....: }

Substitute:

sage: w2_intermediate = w2(x).subs(literal_values).subs(numerical_values)
sage: w2_intermediate
0.0000306297476108797*x^2 + (2.04666393778142e-11)*(9.80918229551222*sqrt(1/2) - 10.0137535816619*sin(2.45229557387805*sqrt(1/2)))*(cos(0.000817431857959351*sqrt(1/2)*x) - 1)/((1.09491158898182e-12)*sqrt(1/2)*cos(2.45229557387805*sqrt(1/2)) - (4.46484347419151e-13)*sin(2.45229557387805*sqrt(1/2))) - (2.04666393778142e-11)*(0.000817431857959351*sqrt(1/2)*x - sin(0.000817431857959351*sqrt(1/2)*x))*(10.0137535816619*cos(2.45229557387805*sqrt(1/2)) - 4)/((1.09491158898182e-12)*sqrt(1/2)*cos(2.45229557387805*sqrt(1/2)) - (4.46484347419151e-13)*sin(2.45229557387805*sqrt(1/2)))

Deal with the remaining exact sqrt(1/2):

sage: sage: w2_intermediate = w2_intermediate.subs({1/2: 0.5})
sage: w2_intermediate
0.0000306297476108797*x^2 - 0.117540775230596*x + 106.403583186866*cos(0.000578011609920976*x) + 203.353657976985*sin(0.000578011609920976*x) - 106.403583186866