janhardo

982 Reputation

13 Badges

12 years, 66 days
B. Ed math

MaplePrimes Activity


These are replies submitted by janhardo

@Ronan 
The code works with all the points you mentioned. 

 

In all these examples, the twin circle does not intersect the zero circle, but there are points of tangency with the zero circle Does this hold true in general? : It should be possible to explain theoretically why this might hold true in hyperbolic geometry.

@Ronan

It's still quite a challence to get those twin circles to work properly..
An ideal triangle in the zero circle does not produce twin circles, because they turn out to coincide.

@Ronan 

 

 

with(UHG):

Info();

Universal Hyperbolic Geometry (UHG) module – quick reference
============================================================
Available commands:

  BilinearForm           Compute the inner product (bilinear form) of two vectors under the given metric.
  BuildConicFromCanonical   Build the conic expression (quadratic form) from a canonical matrix C.
  Centroids              Return the four centroid points (homogeneous) from the canonical matrix C.
  CircumDualPoints       Compute the dual points of the circumlines as a 3x4 matrix.
  CircumJayPoints        Compute the four CircumJay points (intersection of circumline and Jay line).
  CircumWrenPoints       Compute the four CircumWren points.
  Circumcenters          Compute the four circumcenters (points) from the canonical matrix C.
  Circumcircles          Return expressions for the four circumcircles (quadratic forms in x,y,z).
  Circumlines            Return the four circumlines (homogeneous lines) from the canonical matrix C.
  ClassifyPoints         Classify each point of the triangle as inside (-1), on (0), or outside (1) the null conic.
  ClassifyTriangle       Classify the triangle based on vertex positions relative to the null conic.
  DetectGeometry         Determine the type of geometry (Euclidean, Hyperbolic, Elliptic) from the metric matrix J.
  Distance               Compute the distance between two vertices (by index) of a triangle given its canonical matrix C.
  DoubleTriangle         Return the three vertices of the double triangle (polar triangle) from the canonical matrix C.
  DualLine               Compute the dual (polar) of a line with respect to the conic given by matrix C.
  DualPoint              Compute the dual (polar) of a point with respect to the conic given by matrix C.
  FindOddPoint           In a mixed triangle (some points inside, some outside), find the 'odd' point that differs from the other two.
  GetInverseTransform    Compute the inverse of the prepared triangle matrix (from PreparePoints).
  GramMatrixUHG          Compute the Gram matrix G = A * J * A^T for a matrix of points. This is the first step in normalising a triangle.
  Info                   Display this help message. If no argument is given, list all commands with a short summary.
  IntersectionPlot       Plot the intersection curve of a surface F and a plane P in 3D.
  JayLines               Compute the four Jay lines from the canonical matrix C.
  JayWrenPoints          Compute the four JayWren points (intersection of Jay and Wren lines).
  LineFromPoints         Compute the homogeneous line through two points (cross product).
  Medians                Return the three median lines (homogeneous) from the canonical matrix C.
  Midlines               Compute the two midline lines (duals of the midpoints) with respect to the canonical conic.
  Midpoints              Compute the two midpoints (on the line) between vertices i and j of the triangle A.
  NormalizePoints        Normalise a triangle (3x3 matrix) to its canonical form. This is the main function for triangle analysis.
  NormalizePrepared      Normalise a triangle that has already been prepared with PreparePoints. Prints geometry type and triangle location.
  OppositePoints         Return the two points opposite to vertex i (the other two vertices).
  Oppositelines          Return the dual lines of the opposite points.
  PlotAll2D              Generate a 2D plot of the triangle and selected geometric elements in the Klein model (unit disk).
  PlotAll3D              Generate a 3D plot of the triangle and elements in projective or hyperboloid model.
  PlotCircumlinear       Project all objects onto the unit triangle plane x+y+z=1 (circumlinear coordinates).
  PlotConic              Plot a conic in the Klein model together with the null circle.
  PlotConicOnUnitTriangle   Plot the intersection of a conic with the unit triangle plane.
  PlotHierarchy          (Under development) Show the circumcenter hierarchy up to a given depth.
  PlotSteps              Print step‑by‑step instructions to manually build the circumlinear plot for a canonical matrix.
  PlotStepsArray         Generate a column of five plots showing step‑by‑step construction of the triangle analysis.
  PlotUnitTriangle       Plot the unit triangle (the simplex x+y+z=1) in 3D.
  PlotUnitTriangleWithConic3D   Comprehensive 3D plot of the unit triangle with a conic and optional UHG elements.
  PointFromLines         Compute the intersection point of two lines (cross product).
  PointLocation          Determine whether a point lies inside, on, or outside the null conic.
  PreparePoints          Scale and reorder the triangle so that it is ready for canonical normalisation.
  ProjectiveQuadrance    Compute the projective quadrance (an invariant) between two non‑null points.
  Quadrance              Compute the squared norm (quadrance) of a vector, which determines its position relative to the null conic.
  ScalePoints            Scale the triangle so that the quadrances of all points become ±1 (or 0 for ideal points).
  ShowGeometry           Print the detected geometry type and the metric matrix to the console.
  SidePoints             Compute the midpoints on the side opposite to vertex i.
  Sideliness             Compute the sidelines (duals of side points) opposite vertex i.
  SoundConics            Compute the four sound conics as coefficient lists (each list of 6 coefficients).
  SoundPoints            Compute the sound points from the tangent lines as a 3x4 matrix.
  Spread                 Compute the spread (sin² of the angle) between two non‑null vectors.
  Sydlines               Compute the two sydlines (duals of the syndpoints) with respect to the canonical conic.
  Syndpoints             Compute the two syndpoints (orthogonal midpoints) between vertices i and j.
  T_Axis                 Compute the T‑axis (a line) from the canonical matrix C.
  TangentLines           Compute the tangent lines at the circumdual points as a 3x4 matrix.
  TransformConic         Transform a conic matrix under the inverse prepared triangle (used in PlotConic).
  TwinCircumcircles      Return expressions for the four twin circumcircles (quadratic forms in x,y,z).
  U_Axis                 Compute the U‑axis (a line) from the canonical matrix C.
  V_Axis                 Compute the V‑axis (a line) from the canonical matrix C.
  WrenLines              Compute the four Wren lines from the canonical matrix C.

Use Info("command") for detailed help on a specific command.
Example: Info("NormalizePoints");

 

J := Matrix([[1,0,0],[0,1,0],[0,0,-1]]):
a1 := [2/3, -3/2, 1]:
a2 := [-5/2, -3/2, 1]:
a3 := [1/2, 3, 5]:
A := Matrix([a1, a2, a3]):
res := NormalizePoints(A, J):
C := res["CanonicalMatrix"]:
dstcnc := BuildConicFromCanonical(C):

 

Info("BuildConicFromCanonical");

Purpose: Build the conic expression (quadratic form) from a canonical matrix C.
Parameters:
  C : canonical matrix (from NormalizePoints)
Returns: polynomial expression in x,y,z
Example: dstcnc := BuildConicFromCanonical(C);

 

 

Info("PlotConicOnUnitTriangle");

Purpose: Plot the intersection of a conic with the unit triangle plane.
Parameters:
  conicExpr : polynomial or equation
  curveColor, curveThickness, showSurface, bereik
Returns: a 3D plot object
Example: PlotConicOnUnitTriangle(dstcnc, showSurface=true);

 

 

PlotConicOnUnitTriangle(dstcnc);

 

Info("PlotUnitTriangleWithConic3D");

Purpose: Comprehensive 3D plot of the unit triangle with a conic and optional UHG elements.
Parameters:
  conicExpr, planeExpr (default x+y+z-1),
  colors, transparencies, sizes, thicknesses, ranges,
  show_legend, plot_width, plot_height, legend_width, legend_height,
  elements (same as PlotAll2D plus "conic")
Returns: a 3D plot object (with optional legend).
Example: PlotUnitTriangleWithConic3D(dstcnc, x+y+z-1, elements=["conic","vertices"]);

 

 

 

PlotUnitTriangleWithConic3D(dstcnc, x+y+z-1, elements=["triangle","conic","vertices"],vertexColor ="red");

 

 

 

 

 

 

 

 

 

 

J := Matrix([[1,0,0],[0,1,0],[0,0,-1]]):
a1 := [2/3, -3/2, 1]:
a2 := [-5/2, -3/2, 1]:
a3 := [1/2, 3, 5]:
A := Matrix([a1, a2, a3]):
res := NormalizePoints(A, J):
C := res["CanonicalMatrix"]:
dstcnc := BuildConicFromCanonical(C):

PlotUnitTriangleWithConic3D(dstcnc, x+y+z-1,
                            elements = ["all"],
                           (*showSurface = true,*)
                            show_legend = true);

 

 

 

 

 

 

 

PlotUnitTriangleWithConic3D(dstcnc, x+y+z-1,
                            triangleColor = "yellow",
                            curveColor = "cyan",
                            elements = ["conic","vertices"],
                            showSurface = true,
                            show_legend = true);

 

 

 

 

 

 

PlotUnitTriangleWithConic3D(dstcnc, x+y+z-1,
                            triangleColor = "yellow",
                            curveColor = "cyan",
                            elements = ["triangle","conic","vertices"],
                            (*showSurface = true,*)
                            show_legend = true);

 

 

 

 

 

 

Download UHG_module_versieA_19-8-2026.mw

@Ronan 

You're showing a lot of examples—that's great. Maybe the module could also use them if I make some code adjustments based on your comments?
Yes, everything was created using AI, and I don't know much about this subject, but by working on it, I'm starting to get a feel for it.

L := [1/2,1/3,1/4]:
(`%+`=`+`)(op(L));

better after a analyze 

(`%+`=`+`)(L[]);

The start idea is : can we simplify this integral ? ..even function ?
 to 

Ofcourse Maple can do this 

restart;
# 1. Original integrand
f := sinh((Pi-a)*x)/
     (cosh(Pi*x)*sinh(a*x)):

# 2. Symmetry
simplify(subs(x=-x,f)-f);

# 3. Normalize: t = a*x
g := simplify(subs(x=t/a,f)):

# 4. Introduce b = Pi/a
g := subs(Pi/a=b,g):

# 5. Convert hyperbolic functions
gexp := simplify(convert(g,exp)):

# 6. u = 2*t
K := simplify(subs(t=u/2,gexp)/2):

# 7. Identify the geometric factor
geom := sum((-1)^m*exp(-b*m*u),m=0..infinity):

# 8. Identify the digamma parameters
z := b*(m+1):
w := 1+b*m:

# 9. Digamma term
Dterm := (-1)^m*(Psi(z)-Psi(w)):

# 10. Replace b by Pi/a
Result :=
(2/a)*Sum(
 (-1)^m*
 (
   Psi(Pi*(m+1)/a)
   -Psi(1+Pi*m/a)
 ),
 m=0..infinity
);
                           

restart;
Digits := 30;

f := (x, a) -> piecewise(
    x = 0, (Pi - a)/a,
    sinh((Pi - a)*x) / (cosh(Pi*x) * sinh(a*x))
);

plot_f := proc(a)
    local Lx, Ly, piek, p, tekst;
    Lx := max(2, 10/a);
    Ly := max(1, 5/a);
    piek := (Pi - a)/a;   # hoogte bij x=0

    # Maak een punt op x=0 met een label
    p := plots:-pointplot(
        [[0, piek]],
        symbol = circle,
        symbolsize = 12,
        color = red
    );

    # Voeg een tekstlabel toe bij de piek
    tekst := plots:-textplot(
        [0.1*Lx, piek, sprintf("y = %.4f", piek)],
        align = {above, right},
        font = ["Arial", 12]
    );

    # Plot de functie met de extra elementen
    plot(
        f(x, a),
        x = -Lx .. Lx,
        y = -Ly .. Ly,
        thickness = 2,
        numpoints = 500,
        labels = ["x", "f_a(x)"],
        title = sprintf("Integrand for a = %g\nPiekhoogte = %.4f", a, piek)
    );
    # Combineer de plot met de markeringen
    plots:-display(%, p, tekst);
end proc:

Explore(plot_f(a), parameters = [a = 1 .. 20]);





It is an even function f(x) = f(-x) and the function is reflected across the y-axis
 

@Alfred_F 
Seems there is a stronger result.
 

@C_R 

Why doesn't that work?

Because Maple has to know the local section when the procedure is created.

Maple would first have to evaluate lhs(param) in order to determine what the local variable should be called.

That is not possible: the list of local variables is part of the procedure definition, whereas param only receives a value when the procedure is executed.

foo2 := proc(param)
    local vars, name, value;
    vars := table();
    name := lhs(param);
    value := rhs(param);
    vars[name] := value;
    # Now we can use vars[name] in further calculations
    # For example: vars[name] + 10
    vars[name] + 10;  # or something else
end proc:
foo2(a=1); 
                               11

@C_R 
If you use `local` in a procedure, the scope of the variables is limited to that procedure..

@one man 
Yes, there's more in the codegen package
Good luck! 
 

restart;
foo := proc(
    {
        b::numeric := 2,
        c::numeric := 3,
        d::numeric := 4
    }
)
    print(b, c, d);
end proc:
# Voorbeelden
foo();
foo(b=2, c=3, d=4);
foo(b=2, c=3, d=4);
foo(b=10);
foo(c=20, d=30);
foo(d=40, b=20, c=30);
                            2, 3, 4
                            2, 3, 4
                            2, 3, 4
                            10, 3, 4
                           2, 20, 30
                           20, 30, 40
using keyword parameters...

restart;
foo := proc(b::numeric, c::numeric, d::numeric)
    print(b, c, d);
end proc:
# Voorbeelden
foo(2, 3, 4);
foo(10, 3, 4);
foo(2, 20, 30);
foo(20, 30, 40);
                            2, 3, 4
                            10, 3, 4
                           2, 20, 30
                           20, 30, 40

positonal parameters ( what names (symbols) are for  2, 3 and 4  used for this educational example)in the procedure call ?   
A old problem is solved with using now : keyword parameters, with a procedure made with positional parameters 

 

1 2 3 4 5 6 7 Last Page 1 of 89