Contents
view
Description
Sage provides a wide range of tools for performing symbolic and numerical computations, solving problems in algebra, differential calculus, number theory, and much more. Sage integrates multiple systems for symbolic and numerical computation, thus providing a unified platform to address a wide variety of mathematical needs. Sage serves as a tool for exploring and solving complex mathematical problems.
Set up the environment and version
ml utils/apptainer
apptainer run /opt/ohpc/pub/apps/math/sage/sagemath-10.6.sif
Available versions : 10.6
Tutorials
Lancement
- Load the
math/sagemath
module then typ the commandsage
- The DeprecationWarning does not affect the proper functioning of the software.
- To exit, typ the command
quit
Addition et factorisation
$ sage
...
sage: 2+3
5
sage: factor(1234567891011121314151617181920212223242526272829303132333435363738
….: )
2 * 3 * 86893956354189878775643 * 2367958875411463048104007458352976869124861
Example of a script solving a system of equations
- Example file solving_equations.sage
var('x y p q')
eq1 = p+2*q==9
eq2 = q*y+p*x==-6
eq3 = q*y^3+p*x^2==24
print(solve([eq1,eq2,eq3,p==1],p,q,x,y))
- Note the print function to display the results
Running a Sage calculation
- Job launch script sage_job.sh
#!/bin/sh
#SBATCH --job-name=sage
#SBATCH --partition=normal # submission queue
#SBATCH --output=job_sage%j.out
#SBATCH --error=job_sage%j.err
module load utils/apptainer
apptainer exec /opt/ohpc/pub/apps/math/sage/sagemath-10.6.sif equations.sage
- Launching the computation
sbatch sage_job.sh