[racket] weirdness with complex numbers

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Mon Aug 6 19:29:07 EDT 2012

Oh, I didn't expect Racket to change and I think when you're teaching
programming you can just say "this is how the language is." My
question is what people might suggest for a system that's geared
toward algebra help, not programming.

On Mon, Aug 6, 2012 at 6:18 PM, J. Ian Johnson <ianj at ccs.neu.edu> wrote:
> The identifier/number grammar is unlikely to change. If it really bugs you, perhaps you can re-provide make-rectangular as c or complex and have students write (complex real imag). You could also use @ notation and have them write @complex[real imag].
> -Ian
> ----- Original Message -----
> From: "Todd O'Bryan" <toddobryan at gmail.com>
> To: "PLT-Scheme Mailing List" <users at lists.racket-lang.org>
> Sent: Monday, August 6, 2012 6:05:31 PM GMT -05:00 US/Canada Eastern
> Subject: [racket] weirdness with complex numbers
>
> I just discovered that the way you enter (and display) a number like
>
> 1/2 + (2/3)i
>
> in Racket (and Scheme, presumably) is 1/2+2/3i.
>
> I understand why that is, and can't think of what else to do, but has
> anyone had students get confused because the form looks like the i is
> in the denominator of the imaginary part?
>
> What's more potentially confusing is that 1/2+2i/3 is a legal
> identifier in its own right.
>
> I'm working on a program that models basic algebra in the way that
> high school students are taught to do it, and one of my self-imposed
> rules has been that "math should look like math." In other words, I'm
> trying to minimize the conversion gymnastics that students have to put
> up with when they enter math in calculators or computer programs. In
> that spirit, I'm not sure if it would be better to allow the
> inconsistency with the way order of operations normally works or just
> have students enter 1/2+(2/3)i (or 1/2+2i/3, maybe) and do the
> conversion behind the scenes.
>
> Anyone have any thoughts or prejudices one way or the other?
>
> Todd
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.