Well...
sage: var('x tb');
sage: Ra=1/2; Rb=3; ta=pi/2;
sage: Sys = [Ra*cos(ta)+Rb*cos(tb)==x, Ra*sin(ta)+Rb*sin(tb)==0] ; Sys
[3*cos(tb) == x, 3*sin(tb) + 1/2 == 0]
Sage's default solver (i. e. Maxima's) isn't especially good at solving trigonometric systems :
sage: solve(Sys, [x, tb])
[3*cos(tb) == x, 3*sin(tb) + 1/2 == 0]
sage: solve(Sys, [x, tb], to_poly_solve=True)
[3*cos(tb) == x, 3*sin(tb) + 1/2 == 0]
sage: solve(Sys, [x, tb], to_poly_solve="force")
[3*cos(tb) == x, 3*sin(tb) + 1/2 == 0]
but Sympy's can solve this one :
sage: solve(Sys, [x, tb], algorithm="sympy")
[{tb: pi + arcsin(1/6), x: -1/2*sqrt(35)}, {tb: -arcsin(1/6), x: 1/2*sqrt(35)}]
(and, FWIW, so can the gratis Wolfram engine :
sage: mathematica.Solve(Sys, [x, tb])
{{x -> -Sqrt[35]/2, tb -> ConditionalExpression[-Pi + ArcTan[1/Sqrt[35]] +
2*Pi*C[1], Element[C[1], Integers]]},
{x -> Sqrt[35]/2, tb -> ConditionalExpression[-ArcTan[1/Sqrt[35]] +
2*Pi*C[1], Element[C[1], Integers]]}}
but that's hardly surprising...).
More interesting is the general case (i. e. non-constant Ra, Rb, ta) :
sage: var("Ra, Rb, ta");
sage: Sys = [Ra*cos(ta)+Rb*cos(tb)==x, Ra*sin(ta)+Rb*sin(tb)==0]
Maxima can't solve this (no surprise...) :
sage: solve(Sys, [x, tb])
[Ra*cos(ta) + Rb*cos(tb) == x, Ra*sin(ta) + Rb*sin(tb) == 0]
sage: solve(Sys, [x, tb], to_poly_solve="force")
[Ra*cos(ta) + Rb*cos(tb) == x, Ra*sin(ta) + Rb*sin(tb) == 0]
but Sympy (and Mathematica) can :
sage: solve(Sys, [x, tb], algorithm="sympy")
[{tb: pi + arcsin(Ra*sin(ta)/Rb),
x: Ra*cos(ta) - sqrt(-Ra^2*sin(ta)^2/Rb^2 + 1)*Rb},
{tb: -arcsin(Ra*sin(ta)/Rb),
x: Ra*cos(ta) + sqrt(-Ra^2*sin(ta)^2/Rb^2 + 1)*Rb}]
sage: mathematica.Solve(Sys, [x, tb])
{{x -> Ra*Cos[ta] - Sqrt[Rb^2 - Ra^2*Sin[ta]^2],
tb -> ConditionalExpression[ArcTan[-(Sqrt[Rb^2 - Ra^2*Sin[ta]^2]/Rb),
-((Ra*Sin[ta])/Rb)] + 2*Pi*C[1], Element[C[1], Integers]]},
{x -> Ra*Cos[ta] + Sqrt[Rb^2 - Ra^2*Sin[ta]^2],
tb -> ConditionalExpression[ArcTan[Sqrt[Rb^2 - Ra^2*Sin[ta]^2]/Rb,
-((Ra*Sin[ta])/Rb)] + 2*Pi*C[1], Element[C[1], Integers]]}}
EDIT : Coaxing Maxima's default solver to give a solution.
You have a system of two equations with three unknowns ; one of the has to become a parametter of the solution(s). Choosing ta
as a parameter allows us to write :
sage: S1 = Sys[1].solve(tb) ; S1
[tb == -arcsin(Ra*sin(ta)/Rb)]
sage: Sol = S1+Sys[0].subs(S1).solve(x) ; Sol
[tb == -arcsin(Ra*sin(ta)/Rb),
x == Ra*cos(ta) + sqrt(-Ra^2*sin(ta)^2/Rb^2 + 1)*Rb]
The (almost) equivalence of this answer and those given by Sympy ant the Wolfram engine is left as an (interesting !) exercise to the reader...
HTH,
Sorry I don't seem able to format the paste from save
The code is the following (brad.can, please confirm)
Yes correct. But the sage result is:
[{3.0cos(tb): x}, {3.0sin(tb) + 0.5: 0.0}]
The numerical result should be x=2.958 and tb = -0.167 (MathCAD solutions) If I substitute tb 3.0cos(-0.167) is indeed 2.958 and 3.0sin(-0.167)+0.5 is 0.0
So we seem to have a partial result in the dict but key and value of the first is swopped and the second says zero equals zero!
It's clear that solve does not like these particular equations perhaps because the second could just be rearanged for tb. So in this case we don't need solve at all.
No. the result is a re-statement of your original system, meaning that Sage's default solver (i.e. Maxima's) can't solve it.
But there are solutions : see my answer below...