Open c13a4060-9513-4188-9d47-dacb5011e673 opened 2 years ago
Description changed:
---
+++
@@ -1,3 +1,6 @@
-Implement the solid angle measure (the plane angle) of a two-dimensional cone, using the dot-product formula. Later we will add methods for three-dimensional and higher-dimensional cones.
+Implement the solid angle measure (the plane angle) of a two-dimensional cone, using the dot-product (trigonometry) formula.
-Examples to be added.
+For example, the solid angle of the first orthant `solid_angle_simplicial_2d([[0,1],[1,0]])`
+is 1/4.
+
+Later we will add methods for three-dimensional and higher-dimensional cones.
a typo in the file description: qudrant --> quadrant
Branch pushed to git repo; I updated commit sha1. New commits:
e52c2d9 | fixed typos |
Branch pushed to git repo; I updated commit sha1. New commits:
5cc0586 | change doctests output type |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
b3832eb | check nonzero row |
Two comments:
Otherwise LGTM.
Reviewer: Travis Scrimshaw
I don't think solid_angle_simplicial_2d
should really be imported in the global namespace.
It would be better to expose it to the user only via a method of ConvexRationalPolyhedralCone
.
(as suggested in https://groups.google.com/g/sage-devel/c/K6Cd81dpbPA/m/Q44JFzI5AwAJ)
Thanks for the feedback! Revised accordingly.
I don't think that ConvexRationalPolyhedralCone
is the main use case for solid angle computations. It would be pretty useless to go through the ToricLattice
but not able to compute the angle of a equilateral triangle.
I agree, it would not be good to restrict to the case of rational cones.
In https://groups.google.com/g/sage-devel/c/K6Cd81dpbPA/m/Q44JFzI5AwAJ, I also suggest to create methods such as tangent_cone_solid_angle
and normal_cone_solid_angle
in the class PolyhedronFace
(defined in src/sage/geometry/polyhedron/face.py
).
When P.is_exact() or isinstance(P, sage.rings.abc.SymbolicRing)
, the return type should be SymbolicConstantsSubring
element
Branch pushed to git repo; I updated commit sha1. New commits:
3c9aa58 | modified output type and added tests to docstring |
+ sage: solid_angle_simplicial_2d(A).parent()
+ Symbolic Ring
+
+ sage: A = matrix([[0, sqrt(18)], [0, -sqrt(pi)]])
+ sage: solid_angle_simplicial_2d(A)
+ 0
+ sage: solid_angle_simplicial_2d(A).parent()
+ Symbolic Constants Subring
If the input is in a symbolic ring, like sqrt(18)
is, then the output should be in the same symbolic ring, I think, not the Symbolic Constants Subring.
Symbolic Constants Subring is the right choice when the inputs in an exact ring.
Also this:
+ P = A[0][0].parent()
can be replaced by P = A.base_ring()
.
Branch pushed to git repo; I updated commit sha1. New commits:
9d5ab98 | change output type for input in symbolic ring |
Thanks for the feedback. Please see the recent changes.
The patchbot is showing the following: src/sage/geometry/solid_angle.py:194:9 'sage.rings.abc' imported but unused
. Does that seem right?
Branch pushed to git repo; I updated commit sha1. New commits:
1381c23 | remove unnecessary line |
The parent of the result should only depend on the parent of the input, not the value of the input. So because solid_angle_simplicial_2d(matrix([[0, sqrt(18)], [0, -sqrt(pi)]])
is the 0 of Symbolic Constants Subring, also solid_angle_simplicial_2d(matrix([[0, sqrt(18)], [1, -sqrt(pi)]])
should return a value of Symbolic Constants Subring.
Branch pushed to git repo; I updated commit sha1. New commits:
4673707 | wip |
New commits:
c48941b | output in Symbolic Constants Subring when input is exact |
How about regrouping the doctests for A and B like this:
sage: [solid_angle_simplicial_2d(matrix(QQ, M)).parent() for M in [A, B]]
[Symbolic Constants Subring, Symbolic Constants Subring]
Branch pushed to git repo; I updated commit sha1. New commits:
6535715 | regroup the doctests for A and B with exact and inexact base rings. |
+ on the parent of the input, but not the value of the input.
This needs ::
Branch pushed to git repo; I updated commit sha1. New commits:
d8a5f5a | fix doctests typo |
Implement the solid angle measure (the plane angle) of a two-dimensional cone, using the dot-product (trigonometry) formula.
For example, the solid angle of the first orthant
solid_angle_simplicial_2d([[0,1],[1,0]])
is 1/4.Later we will add methods for three-dimensional and higher-dimensional cones.
CC: @yuan-zhou @mkoeppe
Component: geometry
Keywords: solid angle
Author: Allison Fitisone, Yuan Zhou
Branch/Commit: u/yzh/implement_solid_angle_measure_for_two_dimensional_simplicial_cones @
d8a5f5a
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/33656