Okay, I’m still thinking about
my constrained version of the traveling salesmen problem. Here is an easy little geometry problem:
Triangle ABC has sides:
AB = p
BC = q
CA = r
Triangle ABD has sides
AB = p (duh)
BD = s
AD = t
Express the two possible lengths of DC in terms of p, q r, s and t
I’ve done it one way, but it looks like a big mess.
Comments 2
Reply
CD = [ r2 + t2 - 2rt * cos( ÐCAB +/- ÐBAD ) ]1/2
where:
cos( CAB +/- BAD ) = [ cos( ÐCAB ) * cos( ÐBAD ) ] -/+ [ sin( ÐCAB ) * sin( ÐBAD ) ]
and:
cos( ÐCAB ) = (r2 + p2 - q2) / 2rp
cos( ÐBAD ) = (t2 + p2 - s2) / 2tp
sin( ÐCAB ) = [ 1 - cos2( ÐCAB ) ]1/2
sin( ÐBAD ) = [ 1 - cos2( ÐBAD ) ]1/2
Just Plug-n-Chug™ with the first equation above - not pretty!
While a nice trig exercise, an easier way to do this would probably be to set up a coordinate system and use linear algebra - all of this mess is just a clunky way to express simple vector addition.
Reply
Leave a comment