Ask Your Question

Revision history [back]

Solving Sytem of Equations with Trig

Just trying to solve a system with approximate results, but I am getting an error.

Code:

Fs, Na, Nb, theta = var('Fs Na Nb theta') eq1 = 0 == Fs + 0.16Na - 10.0sin(theta) eq2 = 0 == Na - 10.0cos(theta) eq3 = 0 == 0.26Nb - 6.0sin(theta) - Fs eq4 = 0 == Nb - 6.0cos(theta) solns = solve([eq1,eq2,eq3,eq4],Fs, Na, Nb, theta, solution_dict=True) [[s[Fs].n(30), s[Na].n(30), s[Nb].n(30), s[theta].n(30)] for s in solns]

Error:

KeyError Traceback (most recent call last) <ipython-input-27-8201f1ef9ddf> in <module>() ----> 1 [[s[Fs].n(Integer(30)), s[Na].n(Integer(30)), s[Nb].n(Integer(30)), s[theta].n(Integer(30))] for s in solns]

KeyError: Fs

Any advice?? I am new to Sage.

Solving Sytem of Equations with Trig

Just trying to solve a system with approximate results, but I am getting an error.

Code:

Fs, Na, Nb, theta = var('Fs Na Nb theta') theta')

eq1 = 0 == Fs + 0.16Na - 10.0sin(theta) sin(theta)

eq2 = 0 == Na - 10.010.0*cos(theta)

eq3 = 0 == 0.26cos(theta) eq3 = 0 == 0.26Nb - 6.0sin(theta) - Fs eq4 = 0 == Nb - 6.0cos(theta) sin(theta) - Fs

eq4 = 0 == Nb - 6.0*cos(theta)

solns = solve([eq1,eq2,eq3,eq4],Fs, Na, Nb, theta, solution_dict=True) solution_dict=True)

[[s[Fs].n(30), s[Na].n(30), s[Nb].n(30), s[theta].n(30)] for s in solns]

Error:

KeyError Traceback (most recent call last) <ipython-input-27-8201f1ef9ddf> in <module>() ----> 1 [[s[Fs].n(Integer(30)), s[Na].n(Integer(30)), s[Nb].n(Integer(30)), s[theta].n(Integer(30))] for s in solns]

KeyError: Fs

Any advice?? I am new to Sage.

EDIT: Fixed the code I posted so it is more readable. Still looking for help on this. Thanks!