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
0
votes
1 answer

Import skitlean module in python with sage

I would like to import sage and sklearn modules, but when I try to import them both sage show ImportError: $ sage -python temp.py Traceback (most recent call last): File "temp.py", line 2, in from sklearn import * ImportError: No…
Demyanov
  • 901
  • 2
  • 10
  • 15
0
votes
2 answers

How to get a set of outputs of a command to use them one by one later

This is what I am trying to achieve while using Sage worksheet interface. Assume that I wrote a code and it gave, for example, for each i in a range of lists, list[0]. (First element of each list) So I have multiple outputs. Now I want to use these…
S.B.
  • 165
  • 1
  • 8
0
votes
1 answer

typing exponents on trig functions from sage latex command

the command print(latex(sin(x)*sin(x))) returns something like this $$\sin(x)^2$$. However, I would like it to return something like this instead $$\sin^2(x)$$ I am new to sage and I am guessing there is a correct way to do this. Any help is…
userX
  • 309
  • 2
  • 11
0
votes
1 answer

Why doesn't this Sage program work properly (Project Euler 23)?

This is my solution to problem 23 of Project Euler, which is: "A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28,…
Reed Oei
  • 1,427
  • 2
  • 13
  • 19
0
votes
1 answer

sage writing and reading from files; spesific example

As I am new in programming with SAGE, I wonder whether anyone can help me in this topic which I think is a matter of writing results to a file first, and then taking them from there. In particular, I have a command like this; n = 11 K =…
S.B.
  • 165
  • 1
  • 8
0
votes
1 answer

Modulo in sage returning a negative value

I am new to SAGE and am having a problem with something very simple. I have the following code: delay = float(3.5) D = delay%1.0 D But this returns the value -0.5 instead of the expected 0.5. What am I doing wrong? If I change delay to be delay =…
toozie21
  • 341
  • 2
  • 6
  • 15
0
votes
0 answers

Trying to parallelize Sage code creates "thread_suspend failed" and "Unhandled SIGABRT" errors, using the @parallel decorator or multiprocessing.Pool

I have some Sage code I am trying to parallelize, but am running into trouble with issues with "thread_suspend failed" and "Unhandled SIGABRT" errors being raised. I had tried using Python's multiprocessing.Pool class, but then modified things to…
cjohnson
  • 149
  • 3
0
votes
1 answer

sage: problems with product of vector of symbols with square matrix

I am trying to do some experiments with symbols (variable vector) and multiplications with a coefficient matrix. The code is the following: A = matrix(QQ,[ [2,1,2,-6], [-1,2,1,7], [3,-1,-3,-1], [1,5,6,0] ]) k =…
fstab
  • 4,801
  • 8
  • 34
  • 66
0
votes
2 answers

create matrix as having a subset of columns from another matrix

I need to get a new matrix generated by selecting a subset of columns from another matrix, given a list (or tuple) of column indices. The following is the code I am working on (there is a bit more than just the attempt to create a new matrix, but…
fstab
  • 4,801
  • 8
  • 34
  • 66
0
votes
1 answer

Python Overloading List Index Error

I am trying to overload the [] operator for a list to work like a circular list. class circularList(list): def __init__(self, *args): list.__init__(self,args) def __getitem__(self, key): return list.__getitem__(self,…
Guy Person
  • 13
  • 4
0
votes
1 answer

Sage: Sum of divisors of an integer

I would like to use sage to compute the following sum: sum of the divisors of (D-b^2)/4 where b is an integer satisfying; absolute value of b is less than D and b is equivalent to D modulo 2. This is what I tried: def bqfs(d): answer=[] for b in…
sophie668
  • 3
  • 2
0
votes
0 answers

How to import sage into a .py file?

I have downloaded sage and the notebook works properly as well as in the terminal, but how do I import it into a .py file? I've tried from sage.all import * but I just get an output of from sage.all import * ImportError: No module named…
bynx
  • 760
  • 2
  • 8
  • 19
0
votes
1 answer

finding my sage install location

So I installed Sage by downloading the .dmg and dragging the sage folder onto my desktop. I am confused. How did sage install Python 2.7 during this process? Or must I have already had it installed? Where is sage actually installed in my system? I…
user2391236
0
votes
2 answers

Sage cell installation not working, extreme frustration

I have spent all day trying to install the Sage Cell package and have been quite frustrated. I have been following the instructions at:https://github.com/sagemath/sagecell Seems pretty reasonable, huh? First problem occurred at step 4, in the…
user2391236
0
votes
2 answers

How to properly evaluate sage code from within a Python script

I've been trying to evaluate a simple "integrate(x,x)" statement from within Python, by following the Sage instructions for importing Sage into Python. Here's my entire script: #!/usr/bin/env sage -python from sage.all import * def main(): …
user2391236