Re: ideas about representing degrees as Maxima expressions

Stavros Macrakis <[email protected]> Wed, 29 Apr 2026 12:19:23 -0400
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <CACLVabX5YB2pRJD+wGWMj_P9u6+AgCD7AYq4Pa7zX=AAVY6JeA@mail.gmail.com>
Very nice!

I understand that this is version 0 and that you or anyone else can improve
and extend it, so please don't interpret what follows as criticism of what
you've already done, but ideas for future development.

In playing with it quickly, here are some things I noticed.

I was thinking it would be nice to define syntax for °, ′, ″, but then I
realized that very few users will want to go to the trouble of inputting
those characters. Still, could be nice to have output in that form and then
input it back. If we can do it for the various clauses of *do*, it would
seem that we can do it for these operators, as long as we require °, e.g., 0
°30′, not simply 30′.

2*degrees(10) => degrees(20) <<< OK
(-1)*degrees(10) => -degrees(10)  <<< why not degrees(-10)?

degrees(5/2) == degrees(5)/2 => degrees(5/2) <<< shouldn't this be
degrees(2,30)? (maybe under control of a switch)
Similarly for degrees(2.5)  => degrees(2,30.0)

My guess is that some users will want to work in decimal degrees and others
will want to see degrees/minutes/seconds, at least as the final form.

Is there any reason the user needs to write degrees(from_radians(...))
rather than degrees_from_radians(...)?

sin(degrees(x+45))
trig_with_degrees(%) => sin((%pi*(x+45))/180)
trigexpand(expand(%)) => sin((%pi*x)/180)/sqrt(2)+cos((%pi*x)/180)/sqrt(2)

Very nice. How do I put this back in degree form?

radians(from_degrees(degrees(10)^2)) << doesn't change
radians(from_degrees(degrees(10))^2) << doesn't change
radians(from_degrees(degrees(10)))^2
    => %pi^2/324 (steradians)

Why do the first three not work, and how do I convert to square degrees?

           -s


On Wed, Apr 29, 2026 at 1:57 AM Robert Dodier <[email protected]>
wrote:

> Inspired by recent discussions, I put together a proof of concept of a
> representation of degrees as Maxima expressions. You can see the
> result here:
>
>
> https://github.com/maxima-project-on-github/maxima-packages/tree/master/robert-dodier/degrees
>
> I chose to represent degrees apart from trig functions, so trig
> functions are unchanged. If you want sin of x degrees, you write
> sin(degrees(x)).
>
> Trig functions of degrees by default don't simplify; I think that's
> preferable since otherwise you get a mess with factors of %pi/180
> floating around. Degrees are changed into radians by calling a
> function, trig_with_degrees, which changes all the degrees in an
> expression into radians, and therefore enables further simplifications
> of the trig functions.
>
> Degrees can have optional minutes and seconds, e.g. degrees(45),
> degrees(45, 30), degrees(45, 30, 22).
>
> Degrees are displayed by the pretty printer with postfix Unicode
> operators, e.g. 134° 56′ 12″ for degrees(134, 56, 12).
>
> Arithmetic is allowed on degrees, although I haven't worked out how to
> handle subtraction; it turns out that's a bit subtle. I'll think about
> it some more.
>
> The output from degrees.demo is shown in the README for that package.
>
> For the record,
> https://github.com/maxima-project-on-github/maxima-packages is a
> package-parking place that I started a few years ago, in hope of
> promoting something like the package ecosystems for other systems such
> as R and Python.
>
> All in good fun,
>
> Robert
>
>
> _______________________________________________
> Maxima-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>

_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss