Using PACE.jl in Maple with UDX.jl

Warning

This guide is a work in progress. Current distribution requires user to install the required libraries manually, except for Darwin ARM64 systems.

This guide explains how to use PACE.jl within Maple using the UDX.jl package. UDX.jl (Universal Data eXchange) provides a bridge between Maple and Julia, allowing you to call PACE.jl's functions directly from Maple.

Installation

Required Software:

  1. Maple (version 2020 or later recommended)
  2. Required Libraries (only for non-Darwin ARM64 systems)
Note

For Darwin ARM64 systems, a pre-compiled binary with all required libraries is available in the UDX repository, making manual library installation unnecessary.

Installation Steps:

  1. Clone the UDX repository git clone https://gitlab.inria.fr/frdev/udx.git

  2. For Darwin ARM64 systems: Skip to step 3 as the pre-compiled binary is already available.

    For other systems: Build the UDX library (see the UDX documentation):

    • Create a build directory and configure with the required flags for GMP, MPFR, MPFI and Maple.
    • Build the project using cmake and make
  3. Install the UDX.jl Julia package:

    • Navigate to the Julia/ directory of this repository: cd Julia/

    • Start Julia REPL: julia

    • Enter package mode by pressing ], then add the package to your local environment: pkg> dev .

    • Verify the binary path: Open the src/UDX.jl file and verify that the path on line 12 points to your binary file. The default is the relative path to the binary file in the bin directory (for Darwin_arm64 architecture). Modify the path if you want to use your own binary file.

  4. Verify the Maple binary path: Open the Maple/udx.mpl file and verify that the path on line 38 also points to your binary file. This ensures that both Julia and Maple can properly link to the UDX library. Make sure to use the absolute path to the binary file.

Usage in Maple

Basic Setup

  1. Load the UDX module:

    read "/path/to/UDX/Maple/udx.mpl";
    with(UDX);
  2. Set default paths for xterm and Julia, for example:

    set_default_paths("/opt/X11/bin/xterm", "/opt/homebrew/bin/julia");
  3. Start a Julia connection, by selecting to use xterm or not and the number of threads to use, for example:

    ch := udx_start_jl_connection(use_xterm = true, threads = 8);

Core Functions

System Solving with RUR

The main function for solving polynomial systems is udx_rur:

rur := udx_rur(ch, sys, parallel = true);

Parameters:

  • ch: Connection handle from udx_start_jl_connection
  • sys: List of polynomial equations
  • parallel: Boolean for parallel computation (default: true)

Example:

sys := [4*t*x*y + y^2*z - 2*x - z, 
        4*t*x^2*y + 2*t*y^3 - x^3*z + 4*x*y^2*z - 10*t*y + 4*x^2 + 4*x*z - 10*y^2 + 2, 
        t^2*x + 2*t*y*z - x - 2*z, 
        2*t^3*y + 4*t^2*x*z + 4*t*y*z^2 - x*z^3 - 10*t^2 - 11*t*y + 4*x*z + 4*z^2 + 2];

rur := udx_rur(ch, sys, parallel = true);

Computing Solutions from RUR

To compute actual solutions from the RUR representation:

sols := udx_compute_system_solutions_from_rur(ch, sys, target_precision = 8, parallel = true);

Parameters:

  • ch: Connection handle
  • sys: Original polynomial system
  • target_precision: Desired precision in bits (default: 8)
  • parallel: Boolean for parallel computation

Process Management

List Active Processes

udx_list_processes();

Cleanup

UDX:-ModuleUnload();
Warning

Do not forget to use UDX:-ModuleUnload(); to unload the UDX module after use and to free system resources. The Maple restartcommand does the same thing.

Performance Tips

  1. Use parallel computation when available by setting parallel = true
  2. Adjust target precision based on your needs (higher precision = slower computation)
  3. Use appropriate thread count in udx_start_jl_connection based on your system
  4. Clean up processes after use to free system resources

Available Functions

The UDXExt extension provides the following functions that can be called from Maple:

1. Root Isolation (udx_isolate_uni)

2. Rational Univariate Representation (udx_rur)

3. System Solutions from RUR (udx_compute_system_solutions_from_rur)

4. System Solving in Extension Fields (udx_solve_system_in_extension_field)

References