acos and the angle between vectors



Did you get a response yet?

On Sun, 2005-30-10 at 13:14 -0800, Fred J. wrote:
> I am trying to figure the angle between vector and
> getting some un-expected answers
> 
> (%i114) magnitude(x) := sqrt(x.x)$
> 
> (%i115) a:[1,0]$ b:[0,1]$ c:[1,2]$
> d:[sqrt(2),sqrt(7)]$
> 
> (%i119) acos((a.b)/(magnitude(a)*magnitude(b)));
> (%o119) %pi/2	 <---- expected
> 		
> (%i120) acos((c.d)/(magnitude(c)*magnitude(d)));
> 
> (%i122) acos((c.d)/(magnitude(c)*magnitude(d)));
> (%o122) acos((2*sqrt(7)+sqrt(2))/(3*sqrt(5))) <--
> pi/??

I'm not a Maxima expert but I know that Maxima likes to keep exact
results and so the output here is the best it can do. You can get a
decimal approximation with 

(%i) acos((c.d)/(magnitude(c)*magnitude(d))),numer;

but will get the result below, ie 0.0272350692885.

> does it need to be hand written in-order to get a
> answer?
> 
> 
> (%i124) e:2*sqrt(7) + sqrt(2) ,numer;
> (%o125) 6.705716184502276
> 
> (%i126) 3*sqrt(5) ,numer;
> (%o126) 6.708203932499369
> 
> (%i127) acos(%o125/%o126);
> (%o127) 0.0272350692885    <--- even now, where is the
> radians answer

This is the radian answer. Your angle is very small, have a look at

plot2d([[parametric,t,2*t,[t,0,1]],[parametric,sqrt(2)*t,sqrt(7)*t,[t,0,1]]],[x,0,3]);

and you will see a very small angle. Why do you think it is not a radian
result?

:-) Bob
-- 
Dr. Robert J. Jerrard, Professor of Mathematics,
Concordia University College of Alberta,
7128 Ada Blvd., Edmonton, Alberta, T5B 4E4, Canada.
Phone: (780) 479-9291, Fax: (780) 474-1933.