On 10/26/07, Eligio Ricardo Cerval-Pe?a <cervale at for.mat.bham.ac.uk> wrote:
> (1) However, now when I use 2?3*%i it gives [2+3,2-3]*%i rather than
> [2+3*%i,2-3*%i], can this be fixed somehow?
> (2) Is it possible to have this working and get it to return, for
> "y=2?3*%i, [y=2+3*%i,2-3*%i] instead?
Maybe you want to set the right & left binding power (i.e.
operator precedence) to be the same as for ordinary addition
? syntax
shows a table of binding powers. Maybe infix("?", 100, 100)
has the effect you want. If not, try adjusting the numbers up or down.
Incidentally maybe you want the ? function to return a two-element set
instead of a two-element list, e.g.: "?"(a, b) := {a - b, a + b}
> (3) I'm still intrigued by lpos, rpos and pos, if anyone has any answers
> on how they work?
POS = part of speech. Maxima infix, prefix, postfix etc recognize
3 kinds of POS, namely Boolean, algebraic, and anything.
The Maxima parser can detect some errors by comparing the
declared POS with actual expressions, but the parser actually
doesn't try very hard to do that.
HTH
Robert Dodier