I'm working on this math homework and I'm trying to find out why my code
doesn't work....
I need to solve a 7 equations system with 7 variables and 3 parameters
(angles). Once this is done, I want to be able to put all those
solutions in one fonction to which I can parse my three angles...
So if anyone can help me, here's the code which doesn't seem to work
correctly (angles don't get parsed correctly):
Resolution....
> s:=solve({T[1]*cos(teta1)=T[3]*cos(teta2)+T[4],
> T[1]*sin(teta1)+T[3]*sin(teta2)+6=0,
> T[2]+T[3]*cos(teta2)=T[5]*cos(teta3)+T[6],
> 6=T[3]*sin(teta2)+T[5]*sin(teta3),
> T[4]+T[5]*cos(teta3)=T[7]*cos(Pi/6),
> T[5]*sin(teta3)+T[7]*sin(Pi/6)+6=0,
> T[6]+T[7]*cos(Pi/6)=0},
> {T[1],T[2],T[3],T[4],T[5],T[6],T[7]}):
> assign(s);
> Cout:=(teta1,teta2,teta3)-> 1000*(T[1]^2+T[2]^2+T[3]^2+T[4]^2+T[5]^2+T
[6]^2+T[7]^2);
Testing (doesn't give me a numerical answer)....
>
> evalf(Cout(2,3,4));
>
TIA!
Ps: Please respond to my email.... (just replace <NOSPAM> by @ )
-Yop83
That is wrong. Here is a correct way of doing that,
> Cout:=unapply(1000*(T[1]^2+T[2]^2+T[3]^2+T[4]^2+T[5]^2+T[6]^2+T[7]^2),
> teta1,teta2,teta3):
> evalf(Cout(2,3,4));
7
0.5928155576 10
Also, theta instead of teta would look better in the output.
Alec Mihailovs
http://webpages.shepherd.edu/amihailo/
Hi,
You should assign variables teta1,teta2,teta3 in advance,
for example: > teta1,teta2,teta3:=2,3,4:
Then run just count()...
Or you may try the revised one which I wrote below:
> count2:=proc(theta1,theta2,theta3)
local T1,T2,T3,T4,T5,T6,T7,s;
s:=solve
(
{
T1*cos(theta1)=T3*cos(theta2)+T4,
T1*sin(theta1)+T3*sin(theta2)+6=0,
T2+T3*cos(theta2)=T5*cos(theta3)+T6,
6=T3*sin(theta2)+T5*sin(theta3),
T4+T5*cos(theta3)=T7*cos(Pi/6),
T5*sin(theta3)+T7*sin(Pi/6)+6=0,
T6+T7*cos(Pi/6)=0
},
{T1,T2,T3,T4,T5,T6,T7}
):
assign(s):
evalf(1000*(T1^2+T2^2+T3^2+T4^2+T5^2+T6^2+T7^2));
end proc:
> count2(2,3,4);
7
The result should be 0.5928147802 10 (under Digits:=10)
I hope this will give you some help. Good luck.
Ken Lin
"Yop83
This system is equivalent to :
{cos(teta3) = -(T[4]+T[6])/T[5], sin(teta3) =
1/3*3^(1/2)*(T[6]-6*3^(1/2))/T[5], sin(teta2) =
-1/3*3^(1/2)*(T[6]-12*3^(1/2))/T[3], cos(teta1) = -1/T[1]*T[2], cos(teta2) =
-(T[4]+T[2])/T[3], sin(teta1) = 1/3*3^(1/2)*(T[6]-18*3^(1/2))/T[1]}