/r/sagemath

This is a subreddit for links and general discussions about the *Sage Mathematical Software System*.

You can find the documentation for Sage here.

If you are looking for answers to specific questions related to Sage usage, please go to Ask Sagemath.

/r/sagemath

1

1 Comment

2024/03/30

16:07 UTC

16:07 UTC

0

1 Comment

2024/01/07

04:50 UTC

04:50 UTC

1

1 Comment

2023/11/24

03:39 UTC

03:39 UTC

0

1 Comment

2023/02/25

13:32 UTC

13:32 UTC

5

Let's look back at some memorable moments and interesting insights from last year.

**Your top 6 posts:**

0 Comments

2022/12/04

18:22 UTC

18:22 UTC

5

I have a sparse Graph on ~40 nodes. Still the weighted tsp seems to run for ever. Any hints? Here's my code.

3 Comments

2022/01/12

15:47 UTC

15:47 UTC

5

I am relatively new to Sage but after reading the documentation I am unsure what's the best way to proceed when defining new algebraic structures. Is there a direct way in which I could define something like a ternary magma (i.e. a set T with a ternary operation ( , , ) : T x T x T -> T) from scratch in Sage? I am interested in studying different axioms like associativity, semiheaps, etc. and checking long calculations symbolically with the aid of Sage.

0 Comments

2021/12/30

23:36 UTC

23:36 UTC

7

Hi guys, can anyone help me?

I've never worked with sage, but I decided to use it to get some simple results in my research.

The problem is the following: I end up with a equation which depends on variable 'a' and 't', what I need is to isolate variable 'a' so I will get a(t), I've tried using solve command but it didn't work. Does anyone know how to do it?

3 Comments

2021/12/16

15:11 UTC

15:11 UTC

7

Let's look back at some memorable moments and interesting insights from last year.

**Your top 10 posts:**

- "Intro to Graph Theory with SageMath" by u/MCCPyTutorials
- "Intro to SageMath for Non-Programmers" by u/MCCPyTutorials
- "Mathematics behind cryptography l homomorphism and modulo group applicat..." by u/Siva_915544
- "Happy Cakeday, r/sagemath! Today you're 9" by u/AutoModerator
- "Sorry to bother you all with this question, but I broke typeset output by setting the renderer to SVG and now I can't figure out how to revert it." by u/SirMiba
- "macOS Big Sur Compatability and Download" by u/facearo
- "Writing a proof in Sage Math" by u/jssmith42
- "OEIS Sequence with SageMath (YouTube Short)" by u/MCCPyTutorials
- "How to take a generator of a polynomial ring in Sage? and specify an arbitrary ring polynomial?" by u/GPineda17
- "How do I find the zeros of a function in Sage Math?" by u/hwoodice

0 Comments

2021/12/04

18:22 UTC

18:22 UTC

3

error shown in the console is as following (when launching):

sage math Error: Could not fork child process: Resource temporarily unavailable (-1). DLL rebasing may be required; see 'rebaseall / rebase --help'.

looking this error up appears to provide no solutions, am I missing something?

I should mention this has never worked, even when removing and re-installing. Am I missing a prerequisite?

0 Comments

2021/12/01

18:35 UTC

18:35 UTC

1

Hi I'm a telecomunications engineer and I need help with a proyect that has to be made with an extension of sage called "notebook sage" and I have no idea of doing it. It´s about encryption.A monetary reward is offered. The work literally says “ Write an encryption and decryption protocol using hash functions, public-key cryptography and private-key cryptography, in which all cases are clearly specified. and private key cryptography, in which all cases are clearly specified”. We have used cases like vignere, cesar..and so on.

1 Comment

2021/11/24

16:17 UTC

16:17 UTC

9

I’d like to write proofs in a math programming language as a way of processing them, making sure I understand them, harnessing the power of computers to ensure the proof is valid, and studying the proof in more detail by having automatic functions for examining some of the relevant objects in the proof.

Is this a common use of Sage, to write proofs?

1 Comment

2021/11/20

01:20 UTC

01:20 UTC

5

Title. I right-clicked on a result and had some options for renderers. I chose SVG just to see how it would look, and it returns nothing, and I can't even right click any result to revert it, as I don't have any results to click on. This was on SageMath 9.1(using jupyter notebook) installed on Win 10. I have frantically tried to search for a config file, but with no luck.

4 Comments

2021/09/29

13:03 UTC

13:03 UTC

3

I've been trying to figure out how to permits rows and columns of a matrix in Sage. It might sound very stupid, but seriously, how is it done?

3 Comments

2021/09/28

18:12 UTC

18:12 UTC

4

Hello,

I'm wondering how I can introduce arbitrary variables in a polynomial ring i.e:

R.<x1,...,xn> = PolynomialRing(k)

where k is a finite field given.

And I also want to take the specific elements [x1,...,xn] of the ring, do you have some idea?

7 Comments

2021/09/27

19:27 UTC

19:27 UTC

3

How do I find the zeros of a function in Sage Math ?

For example, on a TI CAS calculator, it would be `zeros(x^2-2,x)`

.

And in GeoGebra CAS, it would be `Root(x^2-2)`

.

2 Comments

2021/09/05

17:00 UTC

17:00 UTC

1

I usually use the python interpreter in pycharm. after upgrading to 9.4 i cant find the python interpreter in the sage files. Does anyone know where it is?

2 Comments

2021/08/23

16:54 UTC

16:54 UTC

2

Hi!

I am using Ubuntu 20.04 *Focal* and need some Sage functionalities that were introduced in v. 9.1. However, the Sage version available on repository *universe* is 9.0.
Is there any PPA for the latest versions of SageMath or is my only chance to manually update SageMath?

Thanks a lot.

4 Comments

2021/08/02

13:31 UTC

13:31 UTC

1

Hi, does anyone know how I can get Sage to run on a Mac without having to run as root? In the terminal, when I just type "sage", I get an error. I can however get it to run fine with "sudo sage". Seems a bit strange to me, and I've seen it work perfectly fine without having to specify root for other people.

Anyone know a way around this to allow me to run sage just by inputing "sage" to the terminal -- whether that be a change to the config of sage to allow it to run without root or even just a way to create a symlink to sage which runs it as root without me having to specify if need be. Thanks :)

1 Comment

2021/08/02

12:33 UTC

12:33 UTC

2

Hello All, I am quite new to sage math and working on verifying an answer of mine using the Chinese Remainder theorem.

Could anyone help me structure the equation for it to work in SageMath?

3 Comments

2021/07/31

23:29 UTC

23:29 UTC

2

Hello, I'm fairly new to Sage. I have a question regarding importing my code. I have a .M file I would like to import into my sage console. I tried looking on the sage handbook for the command, but I can't seem to do it. It appears the console cannot even see the file even when I give it a specific path name. For example,

load('/Users/Username/OneDrive/Desktop/a2tworder2.m')

results in an error, because Sage cannot find the file to load or attach. I'm trying to implement this code into sage so that I can do more things with symmetric functions. Am I doing something wrong?

Thank you in advance.

Edit: I'm running windows 10

1 Comment

2021/07/28

06:36 UTC

06:36 UTC

3

I am trying to find the function that is its own Laplace transform in Sagemath. How should I go about this? The answer is supposed to be a Gaussian.

0 Comments

2021/07/17

18:32 UTC

18:32 UTC

2

For a school project, I would like to solve the following differential equation :

As you can see, this is an equation of motion, with a set of initial conditions.

h, m, ω, k, E are constants. but the cos(ωt) is a function of time.

I would like to solve this ODE numerically or get the expression of the solution as a function of time, eventually plot y and t .

In order to simplify the expression, I define a, b and c :

Since this is a second order equation, I create a system of two first order equations :

Here is what I coded :

```
E = 1 # without unit
k = 200 # N/m
h = 8 # without unit
m = 1 # kg
f = 20 # Hz
omega = 2*pi*f #rad/s
# a,b, and c used to simplify
a = h/m
b = k/m
def c(t):
return E*(omega**2)*cos(omega*t)
# Variables
var('t,ydot,y')
eom1 = y.diff(t) == ydot
eom2 = ydot.diff(t) == c(t) - a*ydot(t) - b*y(t)
# Initial conditions
y0 = 0
ydot0 = 0
# Solving and plotting the solutions
sol = desolve_system_rk4([eom1, eom2], ivar=t, vars=[y, ydot], ics = [0, y0, ydot0], end_points=20, step=1)
S = [(t, y) for t, y, ydot in sol]
list_plot(S)
```

But this isn't properly working.

If you know how to help me, feel free.

Thanks a lot.

4 Comments

2021/07/02

13:40 UTC

13:40 UTC

6

1 Comment

2021/06/28

01:45 UTC

01:45 UTC

2

I'm a noob in Sage, and I was trying to do some computations for matrices in it.

I have a matrix that contains elements that are powers of a symbolic variable ω.

After doing some multiplication of similar matrices, and finding the trace, I find that the trace of the matrix is not simplified to a single polynomial, and instead, written in a factorized form.

How can I obtain this result (after multiplying the factors) as a single expression?

Thanks in advance for any help!

6 Comments

2021/06/18

06:03 UTC

06:03 UTC

7

0 Comments

2021/06/03

11:16 UTC

11:16 UTC

2

I am doing some work that requires me to do a lot of symbolic integration of rational functions over the interval [-1, 1]. These rational functions end up containing the integration variable, plus a few real symbolic parameters t1,...,tn. The issue is, as I add more parameters and things get more complicated, Sage's integrate function slows down a lot, and even occasionally seems to get completely stuck.

I am reasonably new to Sage, and I have gotten my code to work for the simpler cases, so it might just be that these functions are too complicated to integrate as I add more parameters. But I'm wondering, are there any general things I could do that might make the integration a little easier/faster? For example, I tried calling .partial_fractions() on the integrand before passing it to the integrate function, but I didn't really notice much of an effect. If you can think of anything that might help speed up these computations, I would appreciate it.

1 Comment

2021/05/08

17:16 UTC

17:16 UTC

18

0 Comments

2021/04/27

00:58 UTC

00:58 UTC

1

I want to install sagemath in Pop OS but it says sagemath has no installation candidates

1 Comment

2021/04/26

12:20 UTC

12:20 UTC

2

If I have a list
`[1,5,4,5,22,0,0,1]`

And I need to generate a 7th degree polynomial from this, how should I proceed?

I tried using the methods given online, but it either crashes or gives me a clearly wrong answer ( I'm trying to find all the real roots by using `real_roots()`

or `roots()`

)

Any help would be appreciated.

5 Comments

2021/04/17

18:13 UTC

18:13 UTC