/r/sagemath

Photograph via snooOG

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,968 Subscribers

1

Matrix Transpose and its Properties

1 Comment
2024/07/26
13:42 UTC

3

Matrix inverse and its properties

1 Comment
2024/07/06
22:20 UTC

1

Using Matrix inverse to solve two Linear Systems

1 Comment
2024/03/30
16:07 UTC

0

Solving two Linear Systems using the inverse

1 Comment
2024/01/07
04:50 UTC

1

Find the inverse of a Matrix and solve a Linear System

1 Comment
2023/11/24
03:39 UTC

0

Inverse of a 4x4 Matrix

1 Comment
2023/02/25
13:32 UTC

5

Happy Cakeday, r/sagemath! Today you're 11

0 Comments
2022/12/04
18:22 UTC

4

Small TSP

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

4

How to implement a ternary algebra in Sage?

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

6

Trouble with sage

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

0 Comments
2021/12/04
18:22 UTC

3

HELP DEV/ADMIN - Windows SageMath Launch Error

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

1

HELP WITH SAGE PROGRAM

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

8

Writing a proof in Sage Math

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

5

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.

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

3

Permutation in matrices

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

4

How to take a generator of a polynomial ring in Sage? and specify an arbitrary ring polynomial?

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

3

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

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

1

Python interpreter location

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

2

Latest version PPA w/ Ubuntu

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

1

Running Sage on a Mac

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

2

Solving CRT in Sagemath

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

https://preview.redd.it/1zeblazoume71.png?width=242&format=png&auto=webp&s=167d08b769ef5c2fba1cb8eabc624c44400edae2

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

3 Comments
2021/07/31
23:29 UTC

2

Importing .M code into Sage

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

4

Finding function that is its own Laplace transform

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

2

I would appreciate some help for ODE solving and graphing

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

https://preview.redd.it/55ion7tavs871.png?width=1066&format=png&auto=webp&s=9691c9a46c9767a887a22dd2b6031b5971df4325

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 :

https://preview.redd.it/885njfu2zs871.png?width=465&format=png&auto=webp&s=3ee067850f9127bee94a5b648086440118980a32

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

https://preview.redd.it/upi8mu1vys871.png?width=847&format=png&auto=webp&s=2792026c3f07ef6a98113555844ff8859fd46867

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

4

OEIS Sequence with SageMath (YouTube Short)

1 Comment
2021/06/28
01:45 UTC

2

Mutliplying symbolic expressions/polynomials

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.

Expression obtained

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

9

Mathematics behind cryptography l homomorphism and modulo group applicat...

0 Comments
2021/06/03
11:16 UTC

2

Tips for Symbolic Integration of Rational Functions

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

18

Intro to Graph Theory with SageMath

0 Comments
2021/04/27
00:58 UTC

Back To Top