Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to make standard procedures use overloaded operators

8 views
Skip to first unread message

Martin

unread,
Nov 4, 2008, 7:32:32 AM11/4/08
to
Dear all,

I was making a small package for dual numbers (dual numbers are
similar to complex number except that the square of the dual unit
epsilon is 0 instead of -1). I used the quaternion package from the
Maple documentation as an example (see ?overload). I overloaded the
`*` operator. So far it works well.

Now I also want to use matrices whose entries are dual numbers.
Problem is that when I try to multiply two such matrices, the `.`
operator uses the standard `*` operator instead of my overloaded one.

I searched this newsgroup and came up with this thread, which explains
that this behaviour is because `.` was defined before I overloaded `*`

http://groups.google.com/group/comp.soft-sys.math.maple/browse_frm/thread/6ac37069accd31b/89b15bc6d957c112?hl=en&lnk=gst&q=application+of+overloaded+operators#89b15bc6d957c112

Is there a way to make the standard `.` operator use my overloaded `*`
operator? Of course I could write my own `.`, but then I would have to
write own versions of lots of standard procedures (I need more than
just `.`).

Best regards,
Martin

Axel Vogt

unread,
Nov 5, 2008, 7:21:16 AM11/5/08
to

May be that is not the way you want to (have not tried it myself):

Why don't work with the algebra A = k[X]/(X^2) = k[eps], eps^2 = 0?
This is the algebraic definition of dual numbers over k, k a field.

0 new messages