Questions tagged [sage]

SageMath, the Sage Mathematical Software System: free software for Computational Mathematics, based on Python. See longer description for links to other similar-sounding tags.

SageMath

SageMath, formerly SAGE, then Sage, is computational mathematics free software. It includes

SageMath uses the Python language, with a tiny bit of syntactic sugar to ease definition of mathematical objects such as symbolic functions, number fields, polynomial rings. Some parts are written in or C/C++ for speed, but a typical user would only use Python syntax. Python wrappers help call other software included in SageMath pythonically.

It is possible to use SageMath using .

External links

Similar-sounding but unrelated tags

Many other things are called Sage. Please use the appropriate tags.

Only use the tag for questions about SageMath, the Sage mathematics software system.

The TeX.SE website has a [sagetex] tag for SageTeX questions.

MathOverflow also has a [sage] tag for Sage questions.

Note also that Ask Sage, SageMath's questions-and-answers site, and sage-support, the user support mailing list, are very active and that questions asked there typically get answered faster than on the StackExchange network.

934 questions
4
votes
0 answers

In Sympy is there a way to get a representation of Groebner basis in terms of defining polynomials?

In Sympy one can obtain the representation of a polynomial's reduction by a Grobner basis: from sympy import groebner, expand from sympy.abc import x, y f = 2*x**4 - x**2 + y**3 + y**2 G = groebner([x**3 - x, y**3 - y]) Q, r = G.reduce(f) assert f…
4
votes
0 answers

How to speedup Pytest startup (which is too slow) on loading huge library

Suppose we have installed huge library like SageMath. Let consider trivial test file: from sage.all_cmdline import * # import sage library class TestClass: def test_method(self): assert True It runs for about 1.5 sec…
petRUShka
  • 9,812
  • 12
  • 61
  • 95
4
votes
2 answers

How do you get the python colour scheme while using sage on VS code?

Currently, I name my files as .py while working on them, and then change them to .sage when I need to execute. Is there a way to get the python colour scheme for sage files on VS code? There is an extension called SAGE enterprise management that…
Mahathi Vempati
  • 1,238
  • 1
  • 12
  • 33
4
votes
1 answer

memoryerror using nauty_geng in Sage

I am trying to get Sage to generate all graphs with 11 vertices, 30 edges, and clique number 4. I typed in the following: g11=[g for g in graphs.nauty_geng('11 30') if g.clique_number()==4] After a while I see the following message: MemoryError …
Sarah
  • 141
  • 1
4
votes
0 answers

Jupyter Sagemath horizontal scroll output

I have a large matrix and when I print the matrix in Sage, the Jupyter notebook is wrapping the rows of the matrix, which makes visualizing the matrix very difficult. Instead, I want to enable horizontal scrolling. I've seen various solutions about…
Pistol Pete
  • 1,027
  • 2
  • 12
  • 25
4
votes
0 answers

Conflicting Sage vs Wolfram evaluation of a limit?

Why are the following computed limits different (1 by Sage, 0 by Wolfram), and which (if either) is correct? EDIT: Revised per @Bill's suggestion to increase the numerical precision in Wolfram. (I don't know how to do the same in Sage.) The…
r.e.s.
  • 227
  • 3
  • 11
4
votes
1 answer

How to install SageMath kernel in Anaconda?

I'm trying to use Sage in Anaconda 3 but it looks that the libraries are not imported. I firstly created a new environment 'ipykernel_py2' and then installed Python 2 as explained in here. With this I can have both Python 3 and Python 3 up and…
J. Serra
  • 440
  • 1
  • 4
  • 13
4
votes
1 answer

sagemath: convert R Element to float

How can I extract a numerical part of an R Element? I'm using the R interface in sagemath. And I would like to get float or int values. I have an R Element, that is an object of class sage.interfaces.r.RElement, that contains a value that I would…
kjl
  • 311
  • 3
  • 13
4
votes
1 answer

How to save table output in an exportable manner in Sage

I am a sage novice trying to export a table output to some image format (so that it might be shared). I tried using the .save() function as so: my_table1 = table(my inputs) result = my_table1.transpose() result.save('here') My table outputs properly…
4
votes
0 answers

How to provide a Jacobian to SciPy curve_fit

I want to fit a sigmoidal curve to some data. Since SageMath's included find_fit function failed, I'm trying to use scipy.optimize.curve_fit directly. It's not doing a very good job and the outcome is extremely sensitive to the initial guess, often…
jaia
  • 304
  • 1
  • 2
  • 8
4
votes
2 answers

Generate X random integers between Y and Z?

Is there a function in Python (I'm working with SageMath) to get 10 random integers between 0 and 30, for instance, without repeating them?
vandermies
  • 183
  • 3
  • 14
4
votes
2 answers

Display polynomials in reverse order in SageMath

So I would like to print polynomials in one variable (s) with one parameter (a), say a·s^3 − s^2 - a^2·s − a + 1. Sage always displays it with decreasing degree, and I would like to get something like 1 - a - a^2·s - s^2 + a·s^3 to export it to…
iipr
  • 1,190
  • 12
  • 17
4
votes
1 answer

Syntax highlighting for .sage in sublime

I started to write some code for sagemath having extension .sage. I write those on sublime text editor. However there is no syntax highlighting for .sage documents. Sage is mostly based on Python. So is there any way that I can tell sublime to use…
4
votes
1 answer

Multivariate polynomial division in sage

I try to do a simple division of polynomials in two variables using sage. Unfortunately, I get an unexpected result, as is illustrated in the code below. I tried several different ways to instantiate the ring and its variables, but the result stays…
Jesper Freesbug
  • 415
  • 4
  • 11
4
votes
1 answer

How to get a prime of a given length in Sage?

How can I get a random prime of a given bit length in Sage? For example, to get a 512-bit prime, I tried p = random_prime(2^512) but according to the documentation: The command random_prime(a, True) will return a random prime between 2 and a so…
Chin
  • 19,717
  • 37
  • 107
  • 164