Using PACE.jl in Maple with UDX.jl
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:
- Maple (version 2020 or later recommended)
- Required Libraries (only for non-Darwin ARM64 systems)
- GMP (GNU Multiple Precision arithmetic) - version 6.3.0
- MPFR (Multiple Precision Floating-point arithmetic with correct rounding) - version 4.2.0
- MPFI (Multiple Precision Floating-point Interval arithmetic) - version 1.5.4
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:
Clone the UDX repository
git clone https://gitlab.inria.fr/frdev/udx.git
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
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 thebin
directory (for Darwin_arm64 architecture). Modify the path if you want to use your own binary file.
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
Load the UDX module:
read "/path/to/UDX/Maple/udx.mpl"; with(UDX);
Set default paths for xterm and Julia, for example:
set_default_paths("/opt/X11/bin/xterm", "/opt/homebrew/bin/julia");
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 fromudx_start_jl_connection
sys
: List of polynomial equationsparallel
: 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 handlesys
: Original polynomial systemtarget_precision
: Desired precision in bits (default: 8)parallel
: Boolean for parallel computation
Process Management
List Active Processes
udx_list_processes();
Cleanup
UDX:-ModuleUnload();
Do not forget to use UDX:-ModuleUnload();
to unload the UDX module after use and to free system resources. The Maple restart
command does the same thing.
Performance Tips
- Use parallel computation when available by setting
parallel = true
- Adjust target precision based on your needs (higher precision = slower computation)
- Use appropriate thread count in
udx_start_jl_connection
based on your system - 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
- UDX Repository: https://gitlab.inria.fr/frdev/udx