Error while working with: Affine, quaternions and cos/sin



"Marcel Tünnissen"  writes:

> I try to make some calculations with quarternions. As suggested in
> http://www.math.utexas.edu/pipermail/maxima/2003/004142.html I use
> Schelter's `affine' package with the suggested setup:

Perhaps the following setup is nicer:

dotexptsimp:false;
dotscrules:true;
matrix_element_mult:".";
current_variables:[i,j,k];
declare_weights(i,1,j,1,k,1);
order_function:polynomial_monomial_alphalessp;
/* Contains redundant rules */
set_up_dot_simplifications([i.i+1,j.j+1,k.k+1,i.j-k,j.i+k,j.k-i,k.j+i,k.i-j,i.k+j]);

> When I use variables like cos_alpha and sin_alpha, the simplifier
> doesn't work as I would expect.

Your example

declare_scalar_list([cos_alpha,sin_alpha]);
ya:(sqrt(5)+3)*k/(sqrt(3)*sqrt(5)+sqrt(3))+2*i/(sqrt(3)*sqrt(5)+sqrt(3));
Sa:(sqrt(2)*sqrt(5)+3*sqrt(2))*k/(sqrt(3)*sqrt(5)+sqrt(3))
   -j+2*sqrt(2)*i/(sqrt(3)*sqrt(5)+sqrt(3));
dotsimp(expand(Sa . (cos_alpha-ya*sin_alpha)));

should now give the result (which I haven't checked) in terms of a
linear combination of i, j and k:

(d13)/R/ - ((2 sin_alpha + (- sqrt(5) - 3) sqrt(2) cos_alpha) k
 + (sqrt(5) + 1) sqrt(3) cos_alpha j + ((- sqrt(5) - 3) sin_alpha
 - 2 sqrt(2) cos_alpha) i + (- sqrt(5) - 1) sqrt(3) sqrt(2) sin_alpha)
/((sqrt(5) + 1) sqrt(3))

> Now I get an error when using a cos or sin:
> (%i8) dotsimp(expand((cos*i+2*j).(4-6*j)));
> Maxima encountered a Lisp error:
>
> FUNCALL: undefined function FERROR

Hmm, FERROR is defined in affine/compat.lisp and I don't get this
error with CVS Maxima.  Anway, the corresponding error message would
be "doesn't begin with $" and this is due to `cos' being parsed as
%COS, which confuses ADD-NEWVAR in affine/new-rat.lisp.  I have to
take a closer look at this issue.

> I am new with Maxima.

The `affine' package is still not so well integrated with the rest of
Maxima, so there are a lot of rough edges, I am afraid.

Wolfgang