ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 18 Sep 2022 12:25:50 +0200Batch processinghttps://ask.sagemath.org/question/64076/batch-processing/So far I have used sagemath one command at once.
I need solve hundreds of equations, with coefficients from text file and print output to text file.
Sage enables environment like Python?
I want create input.sage file with equations like
eqA1 =1.754223-1.189676*x-0.908315*y+0.686618*x^2-0.725235*x*y-1.352818*y^2 == 0
eqB1 =1.463137-0.511047*x-0.297305*y-1.671951*x^2-0.100824*x*y-1.717723*y^2 == 0
eqA2 =
eqB2 =
.........
in main command/file do load('input.sage')
and in loop solve its, and save results to text fileAndrSun, 18 Sep 2022 12:25:50 +0200https://ask.sagemath.org/question/64076/Batch file and Sagehttps://ask.sagemath.org/question/47997/batch-file-and-sage/Hi,
I am using SLURM (https://slurm.schedmd.com/) to run a batch process on a cluster of computers. Here is the following .slrm file that I have:
#!/bin/bash
#SBATCH --time=1:59:00
#SBATCH --ntasks=1
#SBATCH --mem=3820
#SBATCH -O
#SBATCH --output=/data/scratch/kbari/slrmbt_%A_%a.out
#SBATCH --array=1-50
sage --nodotsage /data/scratch/kbari/slurmbatchtest.py $SLURM_ARRAY_TASK_ID
I get an error that: "Error: HOME directory '/u/grad/kbari' does not exist.
Error setting environment variables by sourcing '/usr/local/SageMath/src/bin/sage-env';
possibly contact sage-devel (see http://groups.google.com/group/sage-devel)."
I understand the error to be that it is trying to access sage from a different directory, which it does not have access to and cannot find as a result. So how can I change the environment variable to just tell it to run Sage not from that directory?
Thanks for your time!BarkFri, 20 Sep 2019 22:25:00 +0200https://ask.sagemath.org/question/47997/help with a maxima functionhttps://ask.sagemath.org/question/10732/help-with-a-maxima-function/I have a number of maxima batch files (*.mac) for doing symbolic matrix work. I can sort of batch these in sage by calling maxima(line) for each line in the file. When I am done, I want to dump the results to a text file that I can convert to valid fortran code or code for numeric python evaluation using numpy and friends. Someone on the Maxima mailing list wrote a function for me for converting a Maxima expression to fortran code while collecting common sub expressions. However, I don't seem to be able to get this code to work with maxima. Here is the Maxima code:
optimprefix : 'a_ ; /* default is %, which isn't OK for python variables */
fortran_optimize (e) := block ([o : optimize (e)],
if atom (o) or op (o) # 'block then fortran (apply ("=", ['RESULT, e]))
else block ([a : args (o)],
for x in rest(a) do
if atom (x) then print ("Hey, whence this atom", x, "??")
else if op (x )= ":" then fortran (apply ("=", args(x)))
else fortran (apply ("=", ['RESULT, x]))));
It is in my ~/.maxima/maxima-init.mac file and sage seems to load this file. I say that because under my tab completion options, I have a maxima.fortran_optimize. But the function doesn't do anything:
sage: a, b = var('a','b')
sage: a,b,c = var('a','b','c')
sage: d = a^3+b*c*a^5
sage: maxima.fortran_optimize(d)
fortran_optimize(a^5*b*c+a^3)
Is there something else I need to do to get maxima to recognize this function from the sage maxima interface? Does the function need to be altered to get it to return the lines of fortran code? FYI, my maxima batch files end in lines like this for dumping the results to a file:
with_stdout ("maxima_bode0.f", fortran_optimize (bode0))
Thanks,
Ryan
ryanGTWed, 13 Nov 2013 16:49:04 +0100https://ask.sagemath.org/question/10732/Sage error in batch jobhttps://ask.sagemath.org/question/10608/sage-error-in-batch-job/I'm trying to submit an LSF batch job containing a Sage script on a cluster, but in the output file I'm receiving the following Sage error:
> Unhandled SIGILL: An illegal
> instruction occurred in Sage. This
> probably occurred because a *compiled*
> component of Sage has a bug in it and
> is not properly wrapped with sig_on(),
> sig_off(). You might want to run Sage
> under gdb with 'sage -gdb' to debug
> this. Sage will now terminate.
>----------
>/home/raltman/sage-5.10/local/bin/sage-python:
> line 2: 29634 Illegal instruction
> (core dumped) sage -python "$@"
On the other hand, running the script on its own without submitting it as a job works perfectly.
I'm not sure what this "illegal instruction" is referring to. The "@" makes me recall that I used the @parallel decorator in my script, but I have no idea if this is in any way related. Can anyone please help me out?R AltmanTue, 15 Oct 2013 05:49:01 +0200https://ask.sagemath.org/question/10608/