Tag: SageMath

Cryptic Cython Error Message – ASKSAGE: Sage Q&A Forum

I have been coding a basic algorithm to compute infinite dimensional path integrals in cython cell in sagemath and have received an error message I am completely baffled by. Despite a good amount of effort I can not reproduce this in a short code sequence. I don’t expect anyone to…

Continue Reading Cryptic Cython Error Message – ASKSAGE: Sage Q&A Forum

Jupyter Sagemath Kernel With Code Examples

Jupyter Sagemath Kernel With Code Examples In this session, we are going to try to solve the Jupyter Sagemath Kernel puzzle by using the computer language. The code that follows serves as an illustration of this point. mkdir -p /usr/local/share/jupyter/kernels ln -nsf /opt/SageMath/local/share/jupyter/kernels/sagemath /usr/local/share/jupyter/kernels/sagemath The Jupyter Sagemath Kernel was solved…

Continue Reading Jupyter Sagemath Kernel With Code Examples

python – Sagemath as daemon service – name ‘e’ is not defined”

I have been using Sagemath as a daemon service following the Python code presented here: ask.sagemath.org/question/23431/running-sage-from-other-languages-with-higher-performance/ That code sets up Sagemath as a daemon service using python sockets I make sockets calls via php sockets to connect with this sagemath daemon, and it works fine, except that it does not…

Continue Reading python – Sagemath as daemon service – name ‘e’ is not defined”

SageMath Download – upstream/polytopes_db

SageMath Download – upstream/polytopes_db Current Directory: upstream/polytopes_db = Reflexive Polytopes Databases = == Description == This package includes lists of 2- and 3-dimensional reflexive polytopes. The list of polygons is quite easy to get and it has been known for a while. The list of 3-polytopes was originally obtained by…

Continue Reading SageMath Download – upstream/polytopes_db

Computing with the residue in Sagemath

I have done the following computation to calculate $W12(z1,z2)$ I am expecting the result $$ \begin{aligned} W_{1,2}(z_1 , z_2) &= Res_{z =0}\, K(z)\frac{1}{z-z_1} \left( W_{0,3}(z,-z,z_2) + W_{0,2}(z,z_2)W_{1,1}(-z)+ W_{0,2}(-z,z_2)W_{1,1}(z)\right) \\ &= 1/8\, {\frac { \left( 2\,a{{\it z1}}^{2}+5\,{a}^{2} \right) {{\it z2}}^ {4}+ \left( 2\,a{{\it z1}}^{4}+3\,{a}^{2}{{\it z1}}^{2} \right) {{\it z2}}^{2}+5\,{a}^{2}{{\it z1}}^{4}}{{{\it z1}}^{6}{{\it z2}}^{6}}}…

Continue Reading Computing with the residue in Sagemath

is_real vs. in RR for variables

OK, this explanation seems to be reasonable. But maybe the site doc.sagemath.org/html/en/tutorial/tour_rings.html should be edited (adding “An approximation to the field of real numbers using floating point numbers with any specified precision”). Currently there is: “the real numbers, called RR in Sage”. Ok, x is not a number but a…

Continue Reading is_real vs. in RR for variables

[Solved] How can I translate this SageMath code to run in Python?

The first error is RuntimeError: Use ** for exponentiation, not ‘^’, which means xor in Python, and has the wrong precedence. Once that is fixed, there are various missing imports. Find each of them with Sage’s import_statements function. sage: import_statements(x) from sage.calculus.predefined import x sage: import_statements(sum) from sage.misc.functional import symbolic_sum…

Continue Reading [Solved] How can I translate this SageMath code to run in Python?

How to install SageMath in Ubuntu Linux?

SageMath is a free and open-source software for mathematical computation. It is built on top of many existing open-source libraries which include NumPy, SciPy, Matplotlib, SymPy, Maxima, etc. SageMath provides a command-line interface, browser-based notebooks, and tools for embedding formulas in other documents. Its syntax is similar to Python. In…

Continue Reading How to install SageMath in Ubuntu Linux?

Accepted sagemath 9.5-4 (source) into unstable

—–BEGIN PGP SIGNED MESSAGE—– Hash: SHA256 Format: 1.8 Date: Fri, 15 Apr 2022 17:38:10 +0100 Source: sagemath Architecture: source Version: 9.5-4 Distribution: unstable Urgency: medium Maintainer: Debian Math Team <team+m…@tracker.debian.org> Changed-By: Tobias Hansen <than…@debian.org> Closes: 1009241 Changes: sagemath (9.5-4) unstable; urgency=medium . * Remove armel, armhf, mips64el and mipsel from…

Continue Reading Accepted sagemath 9.5-4 (source) into unstable

Two polynomials multiply incorrectly only on my computer

I am using Docker Desktop on Windows 11 to run Sagemath with Macaulay package. The polynomials “F[0]” and “xd” below multiply into “dat” incorrectly (when compared to the correct result on another computer.) I tried to obtain a minimal example illustrating my problem: Source Code import numpy as np import…

Continue Reading Two polynomials multiply incorrectly only on my computer

Solved Using Cocalc: The Mersenne numbers are the numbers

Engineering Computer Science Computer Science questions and answers Using Cocalc: The Mersenne numbers are the numbers 2^{2^i} +1 where i=0,1,2,3,4,5,.. etc. Find the first one of these numbers that is not a prime number. Use SageMath function called is_prime to help This problem has been solved! See the answerSee the…

Continue Reading Solved Using Cocalc: The Mersenne numbers are the numbers

Sagemath: Is there a way to print out all the elements of a Group or a Ring?

The function print prints its argument and returns None, which is the closest in Python to “not returning anything”. When the return value of a command is None, it does not get displayed. Here however you are building a list of these return values, so you get a list all…

Continue Reading Sagemath: Is there a way to print out all the elements of a Group or a Ring?

/usr/share/sagemath/bin/sage-python: line 2: 96052 Killed sage -python “$@”

It looks the Python gets killed during running a long loop and task didn’t finish. [354, -70, 185, -239] 3.1415926589061544881 j = -48 /usr/share/sagemath/bin/sage-python: line 2: 96052 Killed sage -python “$@” I hope to upload the run-file here… But I just paste it below: eps=2^-52 digits=[2,3,5,7] ndig=len(digits) eran=[ceil(30*log(1/eps)/log(digits[i])) for i…

Continue Reading /usr/share/sagemath/bin/sage-python: line 2: 96052 Killed sage -python “$@”

Solved Lab 06 – Improper Integrals Overview In this lab, we

Transcribed image text: Lab 06 – Improper Integrals Overview In this lab, we will use SageMath to demonstrate the individual steps involved in evaluating improper integrals. Important SageMath Commands Introduced in this Lab Command assume(…) assumptions() forget forget(asmptn) Description Example Stores the given assumption in SageMath assume a > 0,…

Continue Reading Solved Lab 06 – Improper Integrals Overview In this lab, we

Vandermonde Matrix – ASKSAGE: Sage Q&A Forum

Hello! Based on the statement of the question, this seems to be homework. It is important that you do it yourself without any help for two reason: (1) the exercise will show you some very important aspects and functionality of SageMath that you will find very useful in your professional…

Continue Reading Vandermonde Matrix – ASKSAGE: Sage Q&A Forum

Where is numpy, scipy, etc. for Python 3.7 ??

I have Sagemath installed on my Mac with Python versions 2.7 and 3.7 in the package. I’m running sage/python as scripts. For Python 2.7 I use the shebang, #!/Applications/SageMath/local/bin/python2.7 And the code executes correctly including an “import numpy as NP” line. When I switch to Python 3.7 I use the…

Continue Reading Where is numpy, scipy, etc. for Python 3.7 ??

reimann sum sage math code example

Example: riemann sum sagemath sage -t -force_lib devel/sage/doc/en/constructions/calculus.rst ********************************************************************** File “/mnt/usb1/scratch/jdemeyer/merger/sage-4.6.2.alpha2/devel/sage-main/doc/en/constructions/calculus.rst”, line 204: sage: f.trapezoid(4) Expected: Piecewise defined function with 4 parts, [[(0, 1/2), 1/2*x], [(1/2, 1), 9/2*x – 2], [(1, 3/2), 1/2*x + 2], [(3/2, 2), -7/2*x + 8]] Got: doctest:1: DeprecationWarning: _word_content is deprecated, use riemann_sum instead Piecewise…

Continue Reading reimann sum sage math code example

Install SageMath in Ubuntu 22.04

In this article, we would discuss how to install SageMath in Ubuntu 22.04 release. It is basically a free and open-source mathematics application. It combines the functionality of different open-source packages. The application is written in Python and Cython. It was first released on February 24, 2005. And, at the…

Continue Reading Install SageMath in Ubuntu 22.04

File “sage/symbolic/pynac_impl.pxi”, Exception. Unhandled SIGSEGV: A segmentation fault occurred

I am not sure if this is a bug in Python or sagemath. Using sagemath 9.5 on Linux Arch. I’ll describe the problem in words, then given MWE to reproduce it. I have an integrand integrand = “F(x)*(-x^2+x)^(1/2)” as string. I pass it to a subprocess using multiprocessing. When I…

Continue Reading File “sage/symbolic/pynac_impl.pxi”, Exception. Unhandled SIGSEGV: A segmentation fault occurred

Is sagemath removed from Ubuntu 19.10?

I am trying to install sagemath by running : sudo apt install sagemath but it says: Package sagemath is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source I used toi be…

Continue Reading Is sagemath removed from Ubuntu 19.10?

many integrals cause giac crash but work inside giac

Using sagemath 9.5, some integrals in giac return antiderivative which can be used, but giac adds some warning messages before these. But from sagemath instead I get Giac crashed — automatically restarting. sage16*x Is it possible to make sagemath return the antiderivative found? Here is an example sage: var(“x d…

Continue Reading many integrals cause giac crash but work inside giac

Substitute variables in an expression in Sagemath

Somewhat similar to this question, I was trying to evaluate a Boolean expression given the right hand side variables in Sage. For simplicity, say, my Boolean expression is, $y=x_0+x_1$. For each of $(x_0,x_1) in {(0,0),(0,1),(1,0),(1,1)}$, I want to evaluate $y$. This is the basic code block to get started. Note…

Continue Reading Substitute variables in an expression in Sagemath

How to define a matrix using if and for loops in sagemath?

When constructing a matrix in Sagemath, you can pass in a function that computes its entries, which eliminates the need for explicit (and generally inefficient) loops. This function is defined below as xentries: I used the same conditionals as in your post, but grouped them for readability. def xentries(i, j,…

Continue Reading How to define a matrix using if and for loops in sagemath?

How to run C program and use its results in SageMath automatically?

I have a program in SageMath in which I need to use some results obtained from a C program. Let me explain it in more detail. In Sage, I define file1 to be some file. Then I use the following tt3=computePairsOfElementsInSymmetricGroupToBeRunOnCProgramOfGreg(tt2,T1,typ,rank,W,file1) to write results in file1. Then I run a…

Continue Reading How to run C program and use its results in SageMath automatically?

How to add titles, axis label, and legend in sagemath?

myplot = list_plot( zip(range(20), range(20)), color=’red’, legend_label=’legend item 1′) myplot2 = list_plot( zip(range(20), [i*2 for i in range(20)]), color=’blue’, legend_label=’legend item 2′) combined = myplot + myplot2 combined.axes_labels([‘testing x axis’, ‘testing y axis’]) combined.legend(True) combined.show(title=’Testing title’, frame=True, legend_loc=”lower right”) I’m not entirely certain why there’s no title method and why…

Continue Reading How to add titles, axis label, and legend in sagemath?

run-time shared lib not placed in package with proper name

Hi Tobias, * Tobias Hansen <than…@debian.org> [2022-01-10 20:49]: from debian/README.Debian: “The libecl.so file is changing too quickly and is integrated with the ecl binary to such extend that, after consultation with upstream, I will not create a libecl package. If ecl will reach a stable release (1.0 or so) and…

Continue Reading run-time shared lib not placed in package with proper name

Bug#1002849: marked as done (python3-sage: missing Breaks+Replaces: sagemath-common (

Your message dated Sat, 08 Jan 2022 14:36:33 +0000 with message-id <e1n6cpd-0006a9…@fasolo.debian.org> and subject line Bug#1002849: fixed in sagemath 9.4-3 has caused the Debian Bug report #1002849, regarding python3-sage: missing Breaks+Replaces: sagemath-common (<< 9.4) to be marked as done. This means that you claim that the problem has been dealt…

Continue Reading Bug#1002849: marked as done (python3-sage: missing Breaks+Replaces: sagemath-common (

cry from hellman – Github Help

This repository contains a bunch of various crypto-related algorithms implemented in Python 3 and SageMath. Pure Python code is located in cry/py package and can be imported from python code. The other modules must be imported from the SageMath interpreter. The most significant part is formed by S-Box analysis algorithms,…

Continue Reading cry from hellman – Github Help

sagemath/sage-windows – githubmate

Build files and instructions for the Cygwin-compatible build of Sage and its executable installer and auxiliary files. You can find the latest release (for now) at github.com/sagemath/sage-windows/releases Occasionally new versions of SageMath for Windows are released independently of the Sage version (e.g. to make improvements with the Windows installer itself)….

Continue Reading sagemath/sage-windows – githubmate

Accepted sagemath 9.4-2 (source) into unstable

—–BEGIN PGP SIGNED MESSAGE—– Hash: SHA256 Format: 1.8 Date: Wed, 29 Dec 2021 13:17:02 +0000 Source: sagemath Architecture: source Version: 9.4-2 Distribution: unstable Urgency: medium Maintainer: Debian Math Team <team+m…@tracker.debian.org> Changed-By: Tobias Hansen <than…@debian.org> Changes: sagemath (9.4-2) unstable; urgency=medium . [ Tobias Hansen ] * Remove (Build-)Depends: – libfplll-dev *…

Continue Reading Accepted sagemath 9.4-2 (source) into unstable

SageMath Cells ans CSS – githubmate

In the embedded SageMath Cells (see for instance mathifold.org/en/applet_hyperbolic_tessellations.html), the editor is currently hidden {% if page.sage %} <script src=”https://sagecell.sagemath.org/static/embedded_sagecell.js”></script> <script>$(function () { // Make *any* div with class ‘compute’ a Sage cell sagecell.makeSagecell({inputLocation: ‘div.sage’, hide: [“editor”, “evalButton”, “permalink”], autoeval: 1}); }); </script> {% endif %} (github.com/mathifold/mathifold/blob/master/_includes/head.html). However, it is…

Continue Reading SageMath Cells ans CSS – githubmate