sage | Main repository of SageMath | Math library

 by   sagemath Python Version: 10.0 License: Non-SPDX

kandi X-RAY | sage Summary

kandi X-RAY | sage Summary

sage is a Python library typically used in Utilities, Math applications. sage has no bugs, it has no vulnerabilities and it has high support. However sage build file is not available and it has a Non-SPDX License. You can download it from GitHub, GitLab.

"Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, and MATLAB". Copyright (C) 2005-2021 The Sage Development Team. The Sage Library is free software released under the GNU General Public Licence GPLv2+, and included packages have compatible software licenses. Over 800 people have contributed code to Sage. In many cases, documentation for modules and functions list the authors.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              sage has a highly active ecosystem.
              It has 426 star(s) with 171 fork(s). There are 5 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 4900 open issues and 30039 have been closed. On average issues are closed in 606 days. There are 137 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of sage is 10.0

            kandi-Quality Quality

              sage has 0 bugs and 0 code smells.

            kandi-Security Security

              sage has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              sage code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              sage has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              sage releases are available to install and integrate.
              sage has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions, examples and code snippets are available.
              It has 1802594 lines of code, 169491 functions and 9903 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed sage and discovered the below as its top functions. This is intended to give you an instant insight into sage implemented functionality, and help decide if they suit your requirements.
            • Create a plot to plot .
            • Performs a branching rule .
            • Generate a matroid from the ground set .
            • Verify BSD .
            • Returns the self - bonded binary codes .
            • Generate random points .
            • Performs a recursion .
            • Performs branching rule for a branching rule .
            • Generates a contour of the contour
            • Returns the integral points of the integral model .
            Get all kandi verified functions for this library.

            sage Key Features

            No Key Features are available at this moment for sage.

            sage Examples and Code Snippets

            SAGE,Usage
            Pythondot img1Lines of Code : 18dot img1License : Permissive (MIT)
            copy iconCopy
            import sage
            
            # Get data
            x, y = ...
            feature_names = ...
            
            # Get model
            model = ...
            
            # Set up imputer for missing features
            imputer = sage.MarginalImputer(model, x[:512])
            
            # Set up estimator
            estimator = sage.PermutationEstimator(imputer, 'mse')
            
            # Calcula  
            Sage SVG,Usage,Helper
            PHPdot img2Lines of Code : 11dot img2License : Permissive (MIT)
            copy iconCopy
            # Relative path
            $image = get_svg('images.logo');
            
            # Absolute path from webroot with `w-32 h-auto` CSS classes
            $image = get_svg('app/uploads/2019/07/logo.svg', 'w-32 h-auto');
            
            # WordPress attachment (e.g. ACF field) with `my-logo` CSS class
            $image =   
            Blade SVG for Sage,Configuration
            PHPdot img3Lines of Code : 10dot img3License : Permissive (MIT)
            copy iconCopy
            add_filter('bladesvg', function () {
                return [
                    'svg_path' => 'resources/svg',
                    'spritesheet_path' => 'resources/svg/spritesheet.svg',
                    'spritesheet_url' => '',
                    'sprite_prefix' => '',
                    'inline' =>  
            dgl - main-pytorch-ogb-cluster sage
            Pythondot img4Lines of Code : 247dot img4License : Non-SPDX (Apache License 2.0)
            copy iconCopy
            import argparse
            import time
            import traceback
            from functools import partial
            
            import numpy as np
            import torch as th
            import torch.multiprocessing as mp
            import torch.nn as nn
            import torch.nn.functional as F
            import torch.optim as optim
            import tqdm
            from og  
            pytorch_geometric - bipartite sage
            Pythondot img5Lines of Code : 125dot img5License : Permissive (MIT License)
            copy iconCopy
            import os.path as osp
            
            import torch
            import torch.nn.functional as F
            from torch.nn import Embedding, Linear
            
            import torch_geometric.transforms as T
            from torch_geometric.datasets import MovieLens
            from torch_geometric.nn import SAGEConv
            from torch_geome  
            pytorch_geometric - ogbn products sage
            Pythondot img6Lines of Code : 123dot img6License : Permissive (MIT License)
            copy iconCopy
            # Reaches around 0.7870 ± 0.0036 test accuracy.
            
            import os.path as osp
            
            import torch
            import torch.nn.functional as F
            from ogb.nodeproppred import Evaluator, PygNodePropPredDataset
            from tqdm import tqdm
            
            from torch_geometric.loader import NeighborSamp  

            Community Discussions

            QUESTION

            How do I evaluate an expression with trignometric functions & also complex numbers in Sagemath?
            Asked 2022-Mar-25 at 09:27

            I wanted to verify if n-th roots of unity are actually the n-th roots of unity?

            i.e. if (root)^n = 1

            I was trying to use sagemath to do this.

            For e.g. for regular expressions sage seems to evaluate stuff

            For e.g.

            ...

            ANSWER

            Answered 2022-Mar-25 at 09:27

            A sage expression has several methods to manipulate it, including expanding, factoring and simplifying:

            Source https://stackoverflow.com/questions/71614452

            QUESTION

            Formula to iterate through complex JSON string, script erroring after second recursion
            Asked 2022-Mar-09 at 19:07

            I have a function I was trying to build in PowerShell to explore an unknown JSON structure and am having trouble with the recursion failing after the second run.

            Here is my code:

            ...

            ANSWER

            Answered 2022-Mar-09 at 19:07

            Regarding your code, I can see several issues, which I already highlighted in the 2 comments I left to your question.

            Here is a simple function I made while looking at yours to produce the desired result.

            Source https://stackoverflow.com/questions/71406139

            QUESTION

            What does `mode='c'` do in numpy.ndarray[..., mode='c'] do?
            Asked 2022-Feb-14 at 20:55

            I am modifying cython code that makes plots of complex-valued functions. This code includes something equivalent to the following:

            ...

            ANSWER

            Answered 2022-Feb-14 at 20:00

            My guess is it's an equivalent to the order argument in the numpy ndarray docs.

            Source https://stackoverflow.com/questions/71116760

            QUESTION

            Insert Image using variable name in Kotlin
            Asked 2022-Feb-12 at 10:55

            I currently am working on an app that has a list of characters and images associated with each of them.

            I want to insert images for all the characters using a for loop without actually hardcoding their image names:

            Example:

            ...

            ANSWER

            Answered 2022-Feb-12 at 10:54

            You can use string name to get drawable resource identifier:

            Source https://stackoverflow.com/questions/71090970

            QUESTION

            Evaluate polynomials with imaginary numbers
            Asked 2022-Feb-09 at 22:44

            I'm trying to calculate 19v^2 + 49v + 8 to the 67th power over the finite field Z/67Z using Sage where v = sqrt(-2).

            Here's what I have so far (using t instead of v):

            ...

            ANSWER

            Answered 2022-Feb-09 at 22:44

            Computing with a square root of -2 amounts to working modulo the polynomial t^2 + 2.

            The function power_mod can be used for that.

            Instead of first powering and then reducing modulo t^2 + 2, which would be wasteful, it performs the whole powering process modulo t^2 + 2, which is a lot more efficient.

            Here are two ways to write the (same) computation.

            Source https://stackoverflow.com/questions/71042077

            QUESTION

            user table not created on django deployment but superuser created on heroku bash
            Asked 2022-Jan-18 at 21:06

            I'm trying to upload my first django app and I've been struggle with this issue for sometime, help is appreciated.

            I already set up my project to be on heroku, I followed this tutorial: https://www.youtube.com/watch?v=6DI_7Zja8Zc in which django_heroku module is used to configure DB, here is the link to library https://pypi.org/project/django-heroku/

            The app throws the error on login as if user tables didn't exist but I already create a super user using the heroku bash feature, after apply migrations using "heroku run python manage.py migrate". When I run "ls" command on heroku bash this is my directory:

            manage.py Procfile requirements.txt runtime.txt smoke staticfile

            "smoke" is my folder app, should I could see the db in this directory? if the db was not created how could I create a superuser using heroku bash feature?

            This is the DB configuration that django gives me on server:

            ...

            ANSWER

            Answered 2022-Jan-18 at 21:06

            If you look at the django-heroku repository on GitHub I think you'll find that it has been abandoned. It has a banner saying

            This repository has been archived by the owner. It is now read-only.

            and has not had a new commit on the master branch since October, 2018.

            The heroku-on-django library aims to be an updated replacement for django-heroku:

            This has been forked from django-heroku because it was abandoned and then renamed to django-on-heroku because old project has been archived.

            It is also somewhat stagnant (the most recent commit to master at the time of writing is from October, 2020) but it should work better than django-heroku.

            In either case, make sure to put this at the bottom of your settings.py as indicated in the documentation:

            Source https://stackoverflow.com/questions/70761811

            QUESTION

            What does a double caret in Sage do?
            Asked 2022-Jan-16 at 19:06

            Sage math uses a single caret (^) for exponentiation, unlike Python which uses it for XOR.

            I'm studying a file crypto.sage which has a double caret:

            ...

            ANSWER

            Answered 2022-Jan-16 at 19:06

            This is the bitwise xor operator like ^ in python:

            Source https://stackoverflow.com/questions/70733182

            QUESTION

            running r script in AWS
            Asked 2021-Dec-19 at 14:41

            Looking at this page and this piece of code in particular:

            ...

            ANSWER

            Answered 2021-Dec-19 at 14:41

            This is Python code mixed with shell script magic calls (the !commands).

            Magic commands aren't unique to this platform, you can use them in Jupyter, but this particular code is meant to be run on their platform. In what seems like a fairly convoluted way of running R scripts as processing jobs.

            However, the only thing you really need to focus on is the R script, and the final two cell blocks. The instruction at the top (don't change this line) creates a file (preprocessing.R) which gets executed later, and then you can see the results.

            Just run all the code cells in that order, with your own custom R code in the first cell. Note the line plot_key = "census_plot.png" in the last cell. This refers to the image being created in the R code. As for other output types (eg text) you'll have to look up the necessary Python package (PIL is an image manipulation package) and adapt accordingly.

            Try this to get the CSV file that the R script is also generating (this code is not validated, so you might need to fix any problems that arise):

            Source https://stackoverflow.com/questions/70411715

            QUESTION

            Elastic Beanstalk - Docker/Flask App - 502 Gateway Error
            Asked 2021-Dec-07 at 06:59

            I am creating a simple Docker/Flask app that I wanted to deploy to elastic beanstalk but am unable to get it working.

            The code for the backend app (including docker config) can be found here: https://github.com/rogebrd/sage/tree/move_to_docker/backend

            For code deployment, I am pushing my code to s3 via a zip; script to do that can be found here: https://github.com/rogebrd/sage/blob/move_to_docker/scripts/bundle_to_zip.sh

            The Elastic Beanstalk instance is pretty much in it's default configuration (only thing I changed was enabling logs)

            • setup using Docker running on 64bit Amazon Linux 2/3.4.9

            The error I am getting when I hit the resource is - 502 - Gateway Error

            Looking in var/log/eb-docker/containers/eb-current-app/stdouterr.log I am able to see the app is successfully spun up listening on port http://192.168.0.2:5000/

            At this point, I don't really know where the issue could be originating from. My suspicion is that the ports aren't properly being mapped to which I have tried the .ebextensions that are in place now, using a Dockerrun.aws.json file instead of docker-compose, removing docker-compose entirely, and changing the server port to 8080 and 80 with no success.

            Looking for any resources to point me in the right direction!

            ...

            ANSWER

            Answered 2021-Dec-07 at 06:59

            You are using wrong ports in docker compose. Please change to:

            Source https://stackoverflow.com/questions/70255837

            QUESTION

            Sagemath: Is there a way to print out all the elements of a Group or a Ring?
            Asked 2021-Nov-17 at 10:26

            How do I print out all the elements of a Group or Ring in Sagemath?

            I am unable to find any command/function in the docs which do this. So I tried through a Python for & I am unable to understand the output

            I tried this with a field

            ...

            ANSWER

            Answered 2021-Nov-17 at 10:26

            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 of whose elements are None, and that list does get displayed.

            To avoid that, use a for loop without building a list.

            Source https://stackoverflow.com/questions/70001117

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install sage

            If you downloaded a binary (i.e. a version of SageMath prepared for a specific operating system), Sage is ready to start -- just open a terminal in the directory where you extracted the binary archive and type:. (Note that the first run will take more time, as Sage needs to get itself ready.). If you downloaded the sources, please read below on how to build Sage and work around common issues. If you have questions or encounter problems, please do not hesitate to email the sage-support mailing list or ask on the Ask Sage questions and answers site.
            Like many other software packages, Sage is built from source using ./configure, followed by make. However, we strongly recommend to read the following step-by-step instructions for building Sage. The instructions cover all of Linux, macOS, and Cygwin. More detailed instructions are contained in the Installation Guide.
            Decide on the source/build directory (SAGE_ROOT): On personal computers, any subdirectory of your :envvar:HOME directory should do. For example, you could use SAGE_ROOT=~/sage/sage-x.y, which we will use as the running example below, where x.y is the current Sage version. You need at least 10 GB of free disk space. The full path to the source directory must contain no spaces. After starting the build, you cannot move the source/build directory without breaking things. You may want to avoid slow filesystems such as network file systems (NFS) and the like. [macOS] macOS allows changing directories without using exact capitalization. Beware of this convenience when compiling for macOS. Ignoring exact capitalization when changing into :envvar:SAGE_ROOT can lead to build errors for dependencies requiring exact capitalization in path names. [Cygwin] Avoid building in home directories of Windows domain users or in paths with capital letters.
            Download/unpack the sources. Go to https://www.sagemath.org/download-source.html, select a mirror, and download the file :file:sage-x.y.tar.gz. This compressed archive file contains the source code for Sage and the source for all programs on which Sage depends. After downloading the source tarball sage-x.y.tar.gz into ~/sage/: $ cd ~/sage/ $ tar xf sage-x.y.tar.gz # adapt x.y; takes a while This creates the subdirectory sage-x.y. Now change into it: $ cd sage-x.y/ # adapt x.y [Git] Alternatively, clone the Sage git repository: $ ORIG=https://github.com/sagemath/sage.git $ git clone -c core.symlinks=true --branch develop --tags $ORIG This will create the directory sage. Change into it and pick the branch you need, typically the latest development branch: $ cd sage $ git checkout develop [Windows] The Sage source tree contains symbolic links, and the build will not work if Windows line endings rather than UNIX line endings are used. Therefore it is crucial that you unpack the source tree from the Cygwin (or WSL) bash using the Cygwin (or WSL) tar utility and not using other Windows tools (including mingw). Likewise, when using git, it is recommended (but not necessary) to use the Cygwin (or WSL) version of git.
            [Git] If you cloned the Sage repository using git, bootstrap the source tree using: $ make configure
            Optionally, decide on the installation prefix (SAGE_LOCAL): Traditionally, and by default, Sage is installed into the subdirectory hierarchy rooted at SAGE_ROOT/local/. This can be changed using ./configure --prefix=SAGE_LOCAL, where SAGE_LOCAL is the desired installation prefix, which must be writable by the user. Note that in Sage's build process, make builds and installs (make install is a no-op). Therefore the installation hierarchy must be writable by the user. See the installation manual for options if you want to install into shared locations such as /usr/local/. Do not attempt to build Sage as root.
            [Linux, Cygwin] Install the required minimal build prerequisites. Compilers: gcc, gfortran, g++ (a recent enough matching set of these three will avoid building Sage-specific compilers). See the Installation Manual for a discussion of suitable compilers. Build tools: GNU make, GNU m4, perl (including ExtUtils::MakeMaker), ranlib, git, tar, bc. Python 3.4 or later, or Python 2.7, a full installation including urllib; but ideally version 3.7.x, 3.8.x, or 3.9.x, which will avoid having to build Sage's own copy of Python 3. We have collected lists of system packages that provide these build prerequisites. See, in the folder build/pkgs/_prereq/distros, the files arch.txt, cygwin.txt, debian.txt (also for Ubuntu, Linux Mint, etc.), fedora.txt (also for Red Hat, CentOS), opensuse.txt, slackware.txt, and void.txt.
            Optional: It is recommended that you have both LaTeX and the ImageMagick tools (e.g. the "convert" command) installed since some plotting functionality benefits from them.
            Optionally, review the configuration options, which includes many optional packages: $ ./configure --help
            Optional, but highly recommended: Set some environment variables to customize the build. For example, the MAKE environment variable controls whether to run several jobs in parallel. On a machine with 4 processors, say, typing export MAKE="make -j4" will configure the build script to perform a parallel compilation of Sage using 4 jobs. On some powerful machines, you might even consider -j16, as building with more jobs than CPU cores can speed things up further. To reduce the terminal output during the build, type export V=0. (V stands for "verbosity".) Some environment variables deserve a special mention: CC, CXX and FC. These variables defining your compilers can be set at configuration time and their values will be recorded for further use at build time and runtime. For an in-depth discussion of more environment variables for building Sage, see the installation guide.
            Type ./configure, followed by any options that you wish to use. For example, to build Sage with gf2x package supplied by Sage, use ./configure --with-system-gf2x=no. At the end of a successful ./configure run, you may see messages recommending to install extra system packages using your package manager. For a large list of Sage packages, Sage is able to detect whether an installed system package is suitable for use with Sage; in that case, Sage will not build another copy from source. Sometimes, the messages will recommend to install packages that are already installed on your system. See the earlier configure messages or the file config.log for explanation. Also, the messages may recommend to install packages that are actually not available; only the most recent releases of your distribution will have all of these recommended packages.
            Optional: If you choose to install the additional system packages, a re-run of ./configure will test whether the versions installed are usable for Sage; if they are, this will reduce the compilation time and disk space needed by Sage. The usage of packages may be adjusted by ./configure parameters (check again the output of ./configure --help).
            Type make. That's it! Everything is automatic and non-interactive. If you followed the above instructions, in particular regarding the installation of system packages recommended by the output of ./configure (step 10), and regarding the parallel build (step 9), building Sage takes less than one hour on a modern computer. (Otherwise, it can take much longer.) The build should work fine on all fully supported platforms. If it does not, we want to know!
            Type ./sage to try it out. In Sage, try for example 2 + 2, plot(x^2), plot3d(lambda x, y: x*y, (-1, 1), (-1, 1)) to test a simple computation and plotting in 2D and 3D. Type Ctrl+D or quit to quit Sage.
            Optional: Type make ptestlong to test all examples in the documentation (over 200,000 lines of input!) -- this takes from 10 minutes to several hours. Don't get too disturbed if there are 2 to 3 failures, but always feel free to email the section of logs/ptestlong.log that contains errors to the sage-support mailing list. If there are numerous failures, there was a serious problem with your build.
            The HTML version of the documentation is built during the compilation process of Sage and resides in the directory local/share/doc/sage/html/. You may want to bookmark it in your browser.
            Optional: If you want to build the PDF version of the documentation, run make doc-pdf (this requires LaTeX to be installed).
            Optional: Install optional packages of interest to you: get a list by typing ./sage --optional or by visiting the packages documentation page.
            Optional: Create a symlink to the sage executable somewhere in your PATH, so you can start Sage by typing sage from anywhere rather than having to either type the full path or navigate to the Sage directory and type ./sage. This can be done by running: $ ln -s $HOME/sage/sage-x.y/sage /usr/local/bin The $HOME/sage/sage-x.y/ part may need adapting. One way to decide how to adapt it is to run print(SAGE_ROOT) in a Sage session.
            This is a brief summary of the Sage software distribution's build system. There are two components to the full Sage system--the Sage Python library and its associated user interfaces, and the larger software distribution of Sage's main dependencies (for those dependencies not supplied by the user's system). Sage's Python library is built and installed using a setup.py script as is standard for Python packages (Sage's setup.py is non-trivial, but not unusual). Most of the rest of the build system is concerned with building all of Sage's dependencies in the correct order in relation to each other. The dependencies included by Sage are referred to as SPKGs (i.e. "Sage Packages") and are listed under build/pkgs. The main entrypoint to Sage's build system is the top-level Makefile at the root of the source tree. Unlike most normal projects that use autoconf (Sage does as well, as described below), this Makefile is not generated. Instead, it contains a few high-level targets and targets related to bootstrapping the system. Nonetheless, we still run make <target> from the root of the source tree--targets not explicitly defined in the top-level Makefile are passed through to another Makefile under build/make/Makefile. The latter build/make/Makefile is generated by an autoconf-generated configure script, using the template in build/make/Makefile.in. This includes rules for building the Sage library itself (make sagelib), and for building and installing each of Sage's dependencies (e.g. make gf2x). The configure script itself, if it is not already built, can be generated by running the bootstrap script (the latter requires GNU autotools being installed). The top-level Makefile also takes care of this automatically.
            make python3
            run ./bootstrap if configure needs updating
            run ./configure with any previously configured options if build/make/Makefile needs updating
            change directory into build/make and run the install script--this is little more than a front-end to running make -f build/make/Makefile python3, which sets some necessary environment variables and logs some information
            build/make/Makefile contains the actual rule for building python3; this includes building all of python3's dependencies first (and their dependencies, recursively); the actual package installation is performed with the sage-spkg program

            Support

            Sage attempts to support all major Linux distributions, recent versions of macOS, and Windows (using Cygwin, Windows Subsystem for Linux, or virtualization). Detailed information on supported platforms for a specific version of Sage can be found in the section "Availability and installation help" of the release tour for this version. We highly appreciate contributions to Sage that fix portability bugs and help port Sage to new platforms; let us know at the sage-devel mailing list.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/sagemath/sage.git

          • CLI

            gh repo clone sagemath/sage

          • sshUrl

            git@github.com:sagemath/sage.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link