3
$\begingroup$

How to do this trigonometric calculation with Mathematica or Wolframalpha? $$\frac{\sin a+\sin b}{\sin \left( a+b \right)}=m,\frac{\cos a-\cos b}{\sin \left( a-b \right)}=n,a\pm b\ne k\pi ,k\in \mathcal{Z} \\ \mathrm{Calculate}: \sin \frac{a+b}{2}$$

I have tried Solve[{(sin[a]+sin[b])/sin[a+b]=m, (cos[a]+cos[b])/sin[a-b]=n}, {sin[(a+b)/2]}] but it gives errors:

Set::write: Tag Times in 2 (sin[a]+sin[b]) is Protected.
Set::write: Tag Times in (cos[a]+cos[b])/sin[a-b] is Protected.
Solve::naqs: m&&n is not a quantified system of equations and inequalities.

Update: After correcting the most obvious "sins" I got to:

Solve[{(Sin[a] + Sin[b])/Sin[a + b] == 
   m, (Cos[a] - Cos[b])/Sin[a - b] == n}, {Sin[(a + b)/2]}]

It still returns no result. The thing is I have solved this exercise manually on paper and I want to use Mathematica to verify it, this is the actual goal... the result I got on paper is $$\frac{\pm \boldsymbol{mn}}{\sqrt{\boldsymbol{m}^{\boldsymbol{2}}\boldsymbol{n}^{\boldsymbol{2}}+\boldsymbol{1}}}$$ I have tried this:

SolveAlways[(Sin[a]+Sin[b])/Sin[a+b]==m &&(Cos[a]+Cos[b])/Sin[a-b]==n && Sin[(a+b)/2]== \[PlusMinus] (m n)/Sqrt[m m n n+1]  ,{a,b}]

but it simply returns SolveAlways[Csc[a+b] (Sin[a]+Sin[b])==m&&(Cos[a]+Cos[b]) Csc[a-b]==n&&Sin[(a+b)/2]==±(m n)/Sqrt[1+m^2 n^2],{a,b}] so I guess it is confused by the input

New contributor
G J is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
6
  • 3
    $\begingroup$ Welcome to Mathematica StackExchange! I suggest you read through some introductory tutorials, like Mathematica & Wolfram Language Fast Introduction for Math Students. You will learn there the basics, namely that you should use Sin instead of sin, and == for equations instead of = ... After that, please edit your question if you still encounter problems. $\endgroup$
    – Domen
    Commented 2 days ago
  • $\begingroup$ See mathematica.stackexchange.com/questions/18393/… for one "sin" you committed. :) $\endgroup$
    – Michael E2
    Commented 2 days ago
  • $\begingroup$ And mathematica.stackexchange.com/questions/11982/… for misused = (should be ==) $\endgroup$
    – Michael E2
    Commented 2 days ago
  • $\begingroup$ Ok let's correct the sins: Solve[{(Sin[a] + Sin[b])/Sin[a + b] == m, (Cos[a] + Cos[b])/Sin[a - b] == n}, {Sin[(a + b)/2]}] It still returns no result. The thing is I have solved this exercise manually on paper and I want to use Mathematica to verify it... the result I got is $$\frac{\pm \boldsymbol{mn}}{\sqrt{\boldsymbol{m}^{\boldsymbol{2}}\boldsymbol{n}^{\boldsymbol{2}}+\boldsymbol{1}}}$$ $\endgroup$
    – G J
    Commented 2 days ago
  • $\begingroup$ @GJ Please check your equations. Latex and Mathematica code are different! $\endgroup$ Commented 2 days ago

3 Answers 3

7
$\begingroup$
  • We set p == Sin[(a + b)/2] and using Solve to eliminate {a,b}.
Clear[m, n, p];
Solve[{m == (Sin[a] + Sin[b])/Sin[a + b], 
   n == (Cos[a] - Cos[b])/Sin[a - b], p == Sin[(a + b)/2]}, {p}, {a, 
   b}, Reals]

enter image description here

$\endgroup$
4
  • $\begingroup$ beautiful. In the documentation I see Solve[expr,vars,dom]. Are both {p} and {a,b} part of vars? $\endgroup$
    – G J
    Commented yesterday
  • 1
    $\begingroup$ @GJ It in undocument. Solve[eqns,{p},{a,b},dom] means that we solve the eqns with variables {p} and eliminate the variables {a,b} in dom. $\endgroup$
    – cvgmt
    Commented yesterday
  • 1
    $\begingroup$ @cvgmt how do you find out about such features if they're undocumented? $\endgroup$ Commented yesterday
  • 3
    $\begingroup$ @infinitezero: My usual way to find out about undocumented features is to hang out on this website :-) $\endgroup$ Commented yesterday
4
$\begingroup$

Try a slightly corrected and expanded form of Ulrich Neumann's answer

gln = {(Sin[a] + Sin[b])/Sin[a + b] == 
  m, (Cos[a] - Cos[b])/Sin[a - b] == n} /. {a -> 2 ArcTan[ua], 
 b -> 2 ArcTan[ub]} // TrigExpand // Simplify
 solu = Solve[gln, {ua, ub}][[1]] // Simplify

 Power[Sin[(a + b)/2] /. {a -> 2 ArcTan[ua], b -> 2 ArcTan[ub]} /. 
     solu // FullSimplify, 2] // TrigToExp // FullSimplify // 
 Together // PowerExpand // Sqrt // PowerExpand
$\endgroup$
0
4
$\begingroup$

modified gln

You get a simple solution with Weierstrass-substitution assuming -Pi<a,b<Pi

gln = {(Sin[a] + Sin[b])/Sin[a + b] ==m, (Cos[a] - Cos[b])/Sin[a - b] == n}/. {a -> 2 ArcTan[ua] ,b -> 2 ArcTan[ub]} // TrigExpand // Simplify
solu = Solve[gln, {ua, ub}] // Simplify

Sin[(a + b)/2] /. {a -> 2 ArcTan[ua] , b -> 2 ArcTan[ub]} /. solu
(*{-((2 m n)/((1 + m) Sqrt[
1 + (-m n + Sqrt[1 + m^2 (-1 + n^2)])^2/(1 + m)^2] Sqrt[
1 + (m n + Sqrt[1 + m^2 (-1 + n^2)])^2/(1 + m)^2])), -((
2 m n)/((1 + m) Sqrt[
1 + (-m n + Sqrt[1 + m^2 (-1 + n^2)])^2/(1 + m)^2] Sqrt[
1 + (m n + Sqrt[1 + m^2 (-1 + n^2)])^2/(1 + m)^2]))}*)

1. addendum

Further simplification (similar to @Andreas's answer)

sinab=(Sin[(a + b)/2] /. {a -> 2 ArcTan[ua], b -> 2 ArcTan[ub]} /. solu)^2//FullSimplify // Sqrt // Together
(*{Sqrt[(m^2 n^2)/(1 + m^2 n^2)], Sqrt[(m^2 n^2)/(1 + m^2 n^2)]} *)

2. addendum

Perhaps it is of interest, for which n,m solution (Sin[(a + b)/2] is real

RegionPlot[Element[sinab, Reals], {n, -5, 5}, {m, -5, 5},FrameLabel -> {n, m}]

enter image description here

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.