Ask Your Question

jonny_d's profile - activity

2019-02-08 23:46:03 +0200 commented answer Solving Sytem of Equations with Trig

Good solution. Thanks!

2019-02-08 23:45:33 +0200 received badge  Scholar (source)
2018-11-26 00:17:36 +0200 received badge  Editor (source)
2018-11-25 15:55:54 +0200 asked a question 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.0*cos(theta)

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

eq4 = 0 == Nb - 6.0*cos(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.

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

2018-11-25 15:55:54 +0200 asked a question Solving Systems of Equations with Trig

Looking for some help. Just trying to a solve a system of equations with approximate results, but I am getting a key error.

My 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]

Any advice??