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
5
votes
3 answers

How do I pass a script to Sage before running it in interactive mode?

In my Python workflow, I commonly use the -i flag to open a Python interpreter which first executes the script I am working on, then allows me to interact with it. For example, in test.py: #!/usr/bin/env python print("Hello World") x=2 When I run…
Phro
  • 375
  • 2
  • 11
5
votes
1 answer

Differents way to define a function in sagemath

I would like to know why these two "programs" produce different output f(x)=x^2 f(90).mod(7) and def f(x): return(x^2) f(90).mod(7) Thanks
mathlife
  • 171
  • 1
  • 3
5
votes
1 answer

K. notation in Python 2

In one example of Sage math (search for octahedral) there is this line: K. = sage.groups.matrix_gps.finitely_generated.CyclotomicField(10) What does this . do?
Martin Ueding
  • 8,245
  • 6
  • 46
  • 92
5
votes
1 answer

jupyter notebook vs jupyter console: display of markdown (and latex, html, etc) objects

i would like to be able to run a jupyter notebook as a regular python file (using a standard python interpreter) as well. the problem i'm facing is that in python i can not render markdown objects in a usable from: running the code below renders as…
hiro protagonist
  • 44,693
  • 14
  • 86
  • 111
5
votes
2 answers

How do you import sagemath in Google Colaboratory?

Can I have an example of how to import sagemath in Google Colaboratory? This doesn't work: !pip install sage from sage.all import *
Giovanni Funchal
  • 8,934
  • 13
  • 61
  • 110
5
votes
3 answers

How can I do regression analysis in Sage?

I tried this unsuccessfully: find_fit(data, quadratic_residues) I am trying to find the best-fit for data about water flow rates: http://dl.getdropbox.com/u/175564/rate.png ---edit after the comment--- The new code: var('x') model(x) =…
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
5
votes
0 answers

difficulties solving recursive integrals with sage

I have recently asked a question on math.stackexchange concerning how to compute volumes of intersecting hypercubes and hyperspheres to which I got an extremely helpful answer. Now, I'm trying to utilize sage to generate some analytic solution for…
carsten
  • 1,315
  • 2
  • 13
  • 27
5
votes
2 answers

Integrate and plot a piecewise function in Sagemath

I'm trying to integrate a piecewise function using Sagemath, and finding it to be impossible. My original code is below, but it's wrong due to accidental evaluation described here. def f(x): if(x < 0): return 3 * x + 3 else: …
user2662812
5
votes
2 answers

NameError when using Sage polynomials

I read here how to work with polynomials. But when I try this R = QQ['t'] poly = (t+1) * (t+2); poly Sage gives me the following error: NameError: name 't' is not defined What can I do about it?
principal-ideal-domain
  • 3,998
  • 8
  • 36
  • 73
5
votes
1 answer

auto activating embedded sage cell

I'm trying to embed a small sage cell/program into my webpage. However, the cell only activates when the user presses a activation button. I would like the cell to show up automatically on the page so the user does not have to press the activate…
Hans.Gundlach
  • 431
  • 1
  • 6
  • 11
5
votes
3 answers

How to properly import sage?

Edit: I need to clarify, I want to import sage as a library to use in Python scripts OUTSIDE of the sage shell because I need it to run as a server on Django. Do I have to compile sage from source? I have been trying to use sage for my python…
user2391236
5
votes
1 answer

Binary field inversion using SAGE

I am quite frustrated about the SAGE documentations on Finite field operations. What I want to do is the following: In GF(2^8) with irreducible polynomial x^8+x^4+x^3+x+1, I would like to find the inverse of element x^8+1. How can I do that in SAGE?
drdot
  • 3,215
  • 9
  • 46
  • 81
4
votes
1 answer

how can I call Sage from R?

From searching, I see that calling R from Sage is pretty seamless. However, I cannot find information on calling Sage from R. For example, suppose that I have an R expression that I would like to differentiate, say temp <- expression(x + x^2) How…
Xu Wang
  • 10,199
  • 6
  • 44
  • 78
4
votes
2 answers

taking function as an input in SageMath

How do you make a function that takes a function as input? What I want to do is something like: f(x) = log(x) g(f, x) = x^2 * f(x) g(f, 2) # Symbolic expression of x^2 * log(x) I think I am looking for the way to create higher order function.
Ikuyasu
  • 441
  • 1
  • 4
  • 8
4
votes
1 answer

How to import a Python's regular package into Sage?

I'm writing Sage scripts with the aid of the Jupyter notebook. It's all fine until I try to import regular Python packages/libraries, things I installed with pip or otherwise and sit under /usr/local/lib/python3.8/dist-packages/. Say, CoolProp, a…
1 2
3
62 63