[PATCH] fix oblateSpheroidal

4 views
Skip to first unread message

Qian Yun

unread,
Apr 19, 2026, 9:13:07 AM (3 days ago) Apr 19
to fricas-devel
The documentation and implementation of "oblateSpheroidal"
does not match, and the implementation is wrong.

You can verify this by the following snippet from
src/input/coordsys.input:

m(u:DFLOAT,v:DFLOAT):DFLOAT == 1
draw(m,-%pi/2..%pi/2,0..2*%pi,coordinates == oblateSpheroidal(1$DFLOAT))

- Qian

(Disclaimer: this issue is found by LLM, but the analysis and patch
is thoroughly reviewed by me.)

diff --git a/src/algebra/coordsys.spad b/src/algebra/coordsys.spad
index da38d365..4432e340 100644
--- a/src/algebra/coordsys.spad
+++ b/src/algebra/coordsys.spad
@@ -73,9 +73,9 @@
++ oblateSpheroidal(a) transforms from oblate spheroidal
coordinates to
++ Cartesian coordinates: \spad{oblateSpheroidal(a)} is a
function which
++ will map the point \spad{(xi, eta, phi)} to
- ++ \spad{x = a*sinh(xi)*sin(eta)*cos(phi)},
- ++ \spad{y = a*sinh(xi)*sin(eta)*sin(phi)},
- ++ \spad{z = a*cosh(xi)*cos(eta)}.
+ ++ \spad{x = a*cosh(xi)*cos(eta)*cos(phi)},
+ ++ \spad{y = a*cosh(xi)*cos(eta)*sin(phi)},
+ ++ \spad{z = a*sinh(xi)*sin(eta)}.
bipolar : R -> (Pt -> Pt)
++ bipolar(a) transforms from bipolar coordinates to Cartesian
++ coordinates: \spad{bipolar(a)} is a function which will map
@@ -163,7 +163,7 @@
oblateSpheroidal(a) == x +->
pt := copy(x)
xi := elt(x, 1); eta := elt(x, 2); phi := elt(x, 3)
- pt(1) := a*sinh(xi)*sin(eta)*cos(phi)
+ pt(1) := a*cosh(xi)*cos(eta)*cos(phi)
pt(2) := a*cosh(xi)*cos(eta)*sin(phi)
pt(3) := a*sinh(xi)*sin(eta)
pt

Waldek Hebisch

unread,
Apr 19, 2026, 6:27:02 PM (3 days ago) Apr 19
to fricas...@googlegroups.com
On Sun, Apr 19, 2026 at 09:13:03PM +0800, Qian Yun wrote:
> The documentation and implementation of "oblateSpheroidal"
> does not match, and the implementation is wrong.
>
> You can verify this by the following snippet from
> src/input/coordsys.input:
>
> m(u:DFLOAT,v:DFLOAT):DFLOAT == 1
> draw(m,-%pi/2..%pi/2,0..2*%pi,coordinates == oblateSpheroidal(1$DFLOAT))
>
> - Qian
>
> (Disclaimer: this issue is found by LLM, but the analysis and patch
> is thoroughly reviewed by me.)

Thanks, please commit.
> --
> You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/576e96b5-559f-4fc7-b851-d44f0334d727%40gmail.com.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages