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
2 answers

Generating an ordered selection with repetition of designated length of entry

I am writing a function kind of mimicking unordered_tuple from the sage combinatorial functions available in python. It differs, though, in that the input set I am using is always [10, 9, 8, 7, 6], and only the number of entry varies (not larger…
Eric
  • 2,635
  • 6
  • 26
  • 66
0
votes
1 answer

Symbolic Function In Sage

I want define a symbolic function var('x') f(x)=(x+1)%8 but I get the follow error TypeError: unable to convert x (=x) to an integer How I will be able to fix this?
Juan
  • 2,073
  • 3
  • 22
  • 37
0
votes
1 answer

Binary Vector in GF(2) to integer

I am using the CAS SAGE. I have a vector v belonging GF(2). How I will be able to find the integer representation of this vector? Any example please? aux = random_matrix(GF(2), n,2*n) for i in range(2*n): x = ZZ(list(aux[:,i]), base=2)
Juan
  • 2,073
  • 3
  • 22
  • 37
0
votes
2 answers

integrate cos(x)*cos(2x)*...*cos(mx) via SAGE

I'm going to find $I_m=\int_0^{2\pi} \prod_{k=1}^m cos(kx){}dx$, where $m=1,2,3\ldots$ Simple SAGE code: x=var('x') f = lambda m,x : prod([cos(k*x) for k in range(1,m+1)]) for m in range(1,15+1): print m, numerical_integral(f(m,x), 0,…
0
votes
1 answer

Strange list outputs in Sage

Consider the following two lines of code: For t a dictionary, t = {1: (1, 0, 0, 0, 0, 0, 0, 0, 0), 2: (1, 1, 1, 1, 1, 1, 1, 1, 0)}, when I try to do: list(t[1]) to convert the tuple to a list, it gives me the output [(0,1)]. But when I do…
Moderat
  • 1,462
  • 4
  • 17
  • 21
0
votes
1 answer

SAGE + right_kernel() + basis matrix

I executed the right_kernel() instruction for any binary matrix H. Why always I get a basis matrix in this form [I|A] (Where I:identity matrix)?
Juan
  • 2,073
  • 3
  • 22
  • 37
0
votes
2 answers

How to express variable through other in SAGE

Is there way to express mathematical expression through variable defined earlier in SAGE? For example if I have variable a = b + c, I want SAGE rewrite expression b + c + d as a + d. Thank you.
0
votes
1 answer

Getting user input in sage-python

Sage maths gives me an easy way of launching a multi-user python scripting site for my students with a gotcha. That is, I can't figure out how to get user input into scripts. i.e. lines like guess = int(raw_input('Take a guess: ')) Is this not…
nerak99
  • 640
  • 8
  • 26
0
votes
2 answers

pow(a,e,n) doesn't work for input pow(1,3,3)

why do I get this error message, when I'm using these parameters(pow(1,3,3)) ?: sage: pow(1,3,3) 3 3/2 3/2 --------------------------------------------------------------------------- ZeroDivisionError …
Kai Steffes
  • 23
  • 1
  • 5
0
votes
2 answers

adapt the method with a dynamic number of parameters

I'm using sage to print diffrent graphs with a script written in python. I'm trying to write a generic code that allows me to print all the graphs. For example I have : g1 = graphs.BarbellGraph(9, 4) g2 = graphs.RandomNewmanWattsStrogatz(12, 2,…
user850287
  • 401
  • 1
  • 6
  • 11
0
votes
1 answer

Previously working SAGE install broke

Sage was working for me about a month ago. I had not used it until yesterday, and when I tried using the sage command in my Ubuntu 12.04 terminal I receive the following error /usr/bin/sage: line 118: cd: /usr/lib/sage: No such file or…
Daniel
  • 170
  • 2
  • 11
0
votes
1 answer

Force class reloading when the module is reloaded

In my client code I have: import sys import os YAP_PATH = "/package/src/python" if YAP_PATH not in sys.path: sys.path.append(YAP_PATH) if 'yap' in sys.modules: reload(yap) import yap print "working dir", os.getcwd() (it's a development…
Flavius
  • 13,566
  • 13
  • 80
  • 126
0
votes
1 answer

Python, generate prime twins

I tried to write a python program to generate the prime twins in sage. However I can't quite seem to get it to work. Code: http://pastebin.com/PRnvJsf3 Sage is giving me the following error message: Traceback (most recent call last): y = 1 File…
Susan
  • 301
  • 1
  • 5
  • 17
0
votes
2 answers

Euclidean algorithm on Sage for more than 2 elements

I'm trying to make an exercise which gets a list of numers, an shows a list of elements like this: if A=[a0,a1,a2] then there is U=[u0,u1,u2], knowing that a0*u0 + a1*u1 + a2*u2 = d and d is the gcd of A. For 2 elements is a pretty simple thing, as…
Zasito
  • 281
  • 1
  • 7
  • 17
0
votes
1 answer

Change R default path (.libPaths) in sage

I want to use the same directory for my addon R-packages that I use in standalone R. The following works from within sage: r(".libPaths('/home/USERNAME/R/my-libraries')") But when I include this line in ~/.sage/sagerc or ~/.sage/sage.init it…
lambu0815
  • 311
  • 1
  • 2
  • 9