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

Computing the cardinality of an elliptic curve group over the finite field

My objective is to get the number of points on a curve over Fp with prime p being at least 160 bit and then print it out into a textBox in Winform. y^2= x^3 + Ax + B mod p After some research, I stumbled upon SageMath, which I have downloaded…
-1
votes
3 answers

Defining Matrix in Jupiter Notebook

I'm quite new on Jupiter Notebook and I don't really know phyton, could someone tell me how to define a matrix? I mean, what should I write after: A = [···] I've tried "A=Matrix(QQbar, 2, 2, [1,2],[3,4])" and some similiar options but it always…
ORIOL BF
  • 11
  • 2
-1
votes
1 answer

Output the index of an item in a set in Python/Sage

This is what I have so far. def f(n): my_list=[] while n not in my_list: my_list.append(n) if n % 2 == 0: n = n / 2 else: n = 3 * n + 1 my_list.append(n) return my_list The…
Echo7154
  • 3
  • 2
-1
votes
1 answer

How to remove this error in python ? no module sage all

i installed sagemath .i added this line in my pyhton file .but when i run python myfile.py it takes this error : from sage.all import * error: no module named sage.all
Ramin Najafi
  • 13
  • 1
  • 5
-1
votes
1 answer

Is there a Sage function for finding the length of a matrix?

I have a matrix (in Sage) in a notebook - through Jupyter. How do I find the size of this matrix in Sage? I know in Python I can find the length of a list with len(list) Is there, in Sage, a function that does this, but with a matrix? Kinda…
William Martens
  • 753
  • 1
  • 8
  • 27
-1
votes
2 answers

Nuimberof intersection in a graph

I am doing a project in sagemath, where I have a list like this [(0, 2), (1, 3), (2, 1), (3, 0)]. Which creates a graph below and using that graph it calculates the number of intersecting point as 5(marked in purple color) How do I count this…
VMaz
  • 49
  • 3
-1
votes
1 answer

sagetex: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

On Windows 10, when trying to execute the following command "C:/Program Files/SageMath 9.1/runtime/bin/bash" -l "C:/Program Files/SageMath 9.1/runtime/opt/sagemath-9.1/sage" -c "os.chdir('C:\Users\Diaa\Desktop\Test');…
Diaa
  • 135
  • 1
  • 10
-1
votes
2 answers

'NoneType' object is not iterable - where is an error?

My aim is to take a triple (A, B, C), compute three "neighbours", and then output the maximum of each of those neighbours to a list. For example, the neighbours of (sqrt(6), 4*sqrt(3), 9*sqrt(2)) are (sqrt(3)*sqrt(2), 3*sqrt(2),…
user404920
  • 115
  • 3
-1
votes
1 answer

Solution for coupled non linear differential equation in Python or SageMath?

How to solve four first order coupled non-linear differential equations using python or SageMath? Please suggest some references if available. Thank you very much for answering.
cb vaswar
  • 7
  • 2
-1
votes
1 answer

set of n objects, and show k-element subsets in python

Suppose you have a set of n objects, and you want to list its k-element subsets (that is, its subsets with exactly m elements) solved by Recursive functions without using list(itertools.combinations) for example k_subsets({1,2,3},2 ) show the [{1,…
Amin Amin
  • 13
  • 3
-1
votes
1 answer

Output of a sequence (Collatz) in Display and as a Textfile

The following snippet gives me a comma-separated list in the display: X = 19 # Start N = 7 # Length def f(x, n): yield x for k in range(0, n): if x % 2 == 0: x = x / 2 else: x = 3*x + 1 …
cis
  • 135
  • 6
-1
votes
1 answer

How to convert external data into an array?

I am loading some external data that looks like: [[1 0 0][1 1 1][0 1 1]] (no commas) into my code that requires arrays to run. I would like the code to look like: np.array([[1 0 0],[1 1 1],[0 1 1]]) I'm not sure how to covert this to an array.…
Bobert
  • 31
  • 4
-1
votes
1 answer

How to use atexit in Cython?

I am trying to make the following code in cython to compile from cython_gsl cimport * import atexit cdef gsl_rng_type * rng_T = gsl_rng_default cdef gsl_rng * rng_r gsl_rng_env_setup() rng_r = gsl_rng_alloc(rng_T) @atexit.register def…
faceclean
  • 3,781
  • 8
  • 39
  • 58
-1
votes
1 answer

Euler's method sage math don't know where to sart

enter image description here I don't know where to start with this program
-1
votes
1 answer

Computing a function on many variables including duplicates

I have a lot of variables. Say for example, I wanted to print each variable everytime it was computed with. How would I do this. I will illustrate below: def mul(a,b): return a*b a = mul(1,2) b = mul(1,3) c = mul(1,4) b = mul(1,5) How would I…
AdilRay
  • 1
  • 1