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

How to assign equation-expression to variable then sent to solve()?

I am using both SageMath and Wolfram Alpha to entertain myself over the weekend. I found this SageMath demo of solving simultaneous equations: var('x y p q') eq1 = p+q==9 eq2 = q*y+p*x==-6 eq3 = q*y^2+p*x^2==24 solve([eq1,eq2,eq3,p==1],p,q,x,y) And…
user3676943
  • 913
  • 1
  • 13
  • 27
-1
votes
1 answer

Issue with substitution

I have a list L = [a13 == a10, a14 == a11, a15 == a12, a16 == a7, a17 == a8, a18 == a9] I then have a running through a loop giving it these values a = 1 a = 2*a15*a16 + 2*a13*a17 + 2*a13*a18 +1849 etc I have print(a) a.subs(L) print(a) and it…
Anom
  • 1
  • 1
-1
votes
1 answer

Function randint() does not return an integer

I faced a curious problem while taking the writing of an integer in bits in Python (I am working in Sage) I first tried to run the code m=7 m.bits() Everything worked fine there. Then, I wanted to do this with a random integer. Thus, I tried to…
H. Potter
  • 119
  • 7
-1
votes
1 answer

Convert Sage List of list of list to R list of list of list

I have a sage list of list of list that is the result of some function applied over an R list of list of list (converted to sage format) The code goes like this: %r my_r_list<-load("my_r_list.RData") for d in range(D): for s in range(S): …
-1
votes
2 answers

error in "if" loop (Sage)

I'm using "Sage," but I do not think that it is relevant for this question. I have made the following definitions, and attempted to implement an if loop: Q = DiagonalQuadraticForm(ZZ,[1,1,1,1]) L = Q.representation_number_list(10) for i in…
Andres Mejia
  • 221
  • 2
  • 8
-1
votes
1 answer

How to derive a matrix form of quadratic equation using Sympy or other

Is there a way to convert that? For example from this equation: To this matrix form: We especially would like to get thos matrices circled-red. This is the code I have at the moment: from sympy import * x, y = symbols('x y') expr = 0.5 * (x**2) +…
neversaint
  • 60,904
  • 137
  • 310
  • 477
-1
votes
1 answer

how to use symbolic execution to find bug, for example SAGE,KLEE,S2E

just as the title,anyone knows the difference of the ways that those tool use to find bug? kLEE and SAGE maybe can find out-of-bound access and buffer overflow, KLEE can use assertions ,but any other ways?
valiant wang
  • 75
  • 10
-1
votes
2 answers

Printing a table with sage math

The assignment is to construct a two-column table that starts at x= -4 and ends with x= 5 with one unit increments between consecutive x values. It should have column headings ‘x’ and ‘f(x)’. I can't find anything helpful on html.table(), which is…
PsylentKnight
  • 149
  • 14
-2
votes
1 answer

IndexError: list index out of range using nested for loops

I'm programming in CoCalc (Sage which is Python 2.7 with some extras added) for doing very simple stuff and I am having trouble. I must admit I am not a frequent programmer so probably I am missing something which should be fairly obvious. to put…
D1811994
  • 99
  • 3
-2
votes
2 answers

local variable 'B' referenced before assignment

def fun(p,q,x=x): p=p*x^0 q=q*x^0 t=diff(q) u=p.degree(x)+1 s=p.degree(x)-t.degree(x) o=s+1 if s<0: print('The integral does not undertake in elementary functions') else: if s==0: …
Vad
  • 11
  • 1
-2
votes
1 answer

Sequence of Commands in Sage

Sage programing write a sequence of commands that will randomly generate an integer a between 1 and 6 and another integer between 1 and 6 and compute the following: (a)the sum of the two integers as an integer. (b) the sum of the two integers as…
ADAM
  • 105
  • 1
  • 7
-2
votes
1 answer

Invalid Syntax Error at the end of a concatenated list

I have concatenated a list together and then while trying to load it into SAGE using %attach (filename) , I keep getting an error: File "/projects/f6f895ae-ee58-4e39-9ebc-34b6285d9dec/regs_180k_200k_conca.py", line 5484 SyntaxError: invalid…
Haikal Yeo
  • 247
  • 1
  • 12
-2
votes
1 answer

Is it possible to use Sage to compute results from data

I have set of data point (x_i,y_i) from a text file. How can I write a C-program that reads those data, send the data to Sage, computes the Pearson correlation and send the result back to C. I have no idea how can I use C to give input to some…
Jaakko Seppälä
  • 744
  • 2
  • 7
  • 21
-2
votes
2 answers

Issues Specific to Programming on Sage

There are these certain question bothering me and my friend. How do you use the gcc compiler in sage? How do you know if compilation has been successful? What happens when a source file is recompiled?
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
-3
votes
2 answers

Write a function that to sum the result of rolling two random dice n times

Write a function DiceRoll(n) that inputs an integer n and produces n random numbers between 1 and 6. Test your program for n = 12. I got this for that : import random def DiceRoll(n): x=[random.randint(1,6) for _ in range(n)] return…
ADAM
  • 105
  • 1
  • 7
1 2 3
62
63