### Installing SageMath on Gentoo Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/index.rst These commands install SageMath on Gentoo Linux from the `sage-on-gentoo` overlay. The first command sets up the repository, and the second command performs the actual installation of the `sage` package. ```Shell $ emerge --noreplace eselect-repository && eselect repository enable sage-on-gentoo && emerge --sync $ emerge -av sage ``` -------------------------------- ### Meson Build and Install for Package Maintainers Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/meson.rst This set of commands demonstrates how package maintainers can configure, compile, and install SageMath using Meson with advanced options. The `meson setup` command allows specifying custom prefixes and library directories, `meson compile` builds the project, and `DESTDIR` with `meson install` facilitates staging the installation to a temporary root for packaging purposes. ```shell-session meson setup builddir --prefix=/usr --libdir=... -Dcpp_args=... meson compile -C builddir DESTDIR=/path/to/staging/root meson install -C builddir ``` -------------------------------- ### Creating a KDE Launcher Script for SageMath (bash) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This bash script is designed for KDE users to launch SageMath within a new Konsole terminal. It sets the terminal title to 'sage' and executes the SageMath main script, providing a convenient way to start Sage from a desktop environment. ```bash #!/usr/bin/env bash konsole -T "sage" -e /sage ``` -------------------------------- ### Setting SageMath Alias in .bashrc (Bash) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This snippet shows how to create a shell alias for the SageMath executable in your `.bashrc` file. This allows you to start SageMath by simply typing `sage` in the terminal. Remember to replace `` with the actual path to your SageMath installation. ```bash alias sage=/sage ``` -------------------------------- ### Installing Optional SageMath Packages (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst These commands are used to manage optional SageMath packages. `sage --optional` lists available optional packages, and `sage -i ` downloads and installs a specified package. An internet connection is required for installation. ```shell sage --optional ``` ```shell sage -i ``` -------------------------------- ### Creating SageMath Installation Directory (Multi-User) - Shell Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command creates the base installation directory for SageMath in a multi-user environment. It uses `sudo` to ensure appropriate permissions and creates parent directories if they don't exist. `SAGE_LOCAL` is a placeholder for the chosen installation path, e.g., `/opt/sage/sage-x.y`. ```Shell sudo mkdir -p SAGE_LOCAL ``` -------------------------------- ### Running Local Jupyter Server for Sage Live Documentation (Bash) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This Bash command demonstrates how to start a local Jupyter server configured to work with Sage's live documentation. It sets the token, origin, disables XSRF checks, specifies the port, and prevents the browser from opening automatically. This server can be used when SAGE_JUPYTER_SERVER is set to its URL. ```bash ./sage --notebook=jupyterlab \ --ServerApp.token='secret' \ --ServerApp.allow_origin='null' \ --ServerApp.disable_check_xsrf=true \ --ServerApp.port=8889 \ --ServerApp.open_browser=false ``` -------------------------------- ### Installing SageMath on Nix Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/index.rst This command installs SageMath on Nix-based systems using `nix-env`. It specifically installs the `sage` package from the `nixpkgs` collection. ```Shell $ nix-env -iA nixpkgs.sage ``` -------------------------------- ### Installing SageMath on Void Linux Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/index.rst This command installs SageMath on Void Linux using the `xbps-install` package manager. It requires superuser privileges to run. ```Shell $ xbps-install -S sagemath ``` -------------------------------- ### Factoring Integers in SageMath (ipycon) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This example illustrates how to use SageMath's `factor` function to find the prime factorization of an integer. It showcases a slightly more advanced mathematical operation available in the interactive console. ```ipycon sage: factor(2005) 5 * 401 ``` -------------------------------- ### Initializing Sphinx Project for Documentation Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/thematic_tutorials/sws2rst.rst This command initiates the Sphinx quickstart process, guiding the user through a series of prompts to set up a new Sphinx documentation project. It's used to configure the basic structure and settings for compiling ReStructuredText files into various output formats, such as HTML. ```shell-session $ sphinx-quickstart ``` -------------------------------- ### Installing Python 3 and Setuptools (Shell) Source: https://github.com/sagemath/sage/blob/develop/build/pkgs/python3/distros/homebrew.txt This snippet lists the core Python 3 interpreter and the `python-setuptools` package, which is essential for building and distributing Python packages. These items are typically installed via a package manager or a similar system setup process. ```Shell python3 python-setuptools ``` -------------------------------- ### Building and Installing Sage in Editable Mode (Quick Start) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/walkthrough.rst Installs Sage from the current directory in editable mode, allowing changes to the source code to be reflected without reinstallation. The `--no-build-isolation` flag prevents isolation during the build process. ```shell-session pip install --no-build-isolation --editable . ``` -------------------------------- ### Installing macOS Command Line Tools Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command initiates the installation of Apple's Command Line Tools, which provide essential development utilities and compilers required for building software on macOS, including SageMath. It opens a pop-up dialog for user confirmation. ```Shell xcode-select --install ``` -------------------------------- ### Configuring SageMath Build in Worktree (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command initiates the configuration step for building SageMath within the current worktree. It's the first step in a fresh build process for the new SageMath version, independent of other installations. ```Shell make configure ``` -------------------------------- ### Example Dockerfile for Sage Build Environment - Dockerfile Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/portability_testing.rst This snippet shows parts of a generated `Dockerfile` for building a Sage environment. It defines a base image, installs system dependencies using `apt-get`, sets up the Sage directory, adds necessary source files, and runs the Sage bootstrap script. ```Dockerfile # Automatically generated by SAGE_ROOT/.ci/write-dockerfile.sh # the :comments: separate the generated file into sections # to simplify writing scripts that customize this file ... ARG BASE_IMAGE=ubuntu:latest FROM ${BASE_IMAGE} ... RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -qqq --no-install-recommends --yes binutils make m4 perl python3 ... libzmq3-dev libz-dev && apt-get clean RUN mkdir -p /sage WORKDIR /sage ADD Makefile VERSION.txt README.md bootstrap configure.ac sage ./ ADD src/doc/bootstrap src/doc/bootstrap ADD m4 ./m4 ADD build ./build RUN ./bootstrap ADD src/bin src/bin ``` -------------------------------- ### Creating Symbolic Link for SageMath Executable (Multi-User) - Shell Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This optional command creates a symbolic link from the installed SageMath executable (`SAGE_LOCAL/bin/sage`) to a common directory in users' PATH, such as `/usr/local/bin`. This allows users to run `sage` directly from any shell without specifying the full path. ```Shell sudo ln -s SAGE_LOCAL/bin/sage /usr/local/bin/sage ``` -------------------------------- ### Running Tox for sagemath-objects Distribution (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/packaging_sage_library.rst This command bootstraps SageMath and then uses 'tox' to install and test the 'sagemath-objects' distribution in a virtual environment. Unlike previous examples, this command finds dependencies on PyPI, building and installing the distribution without relying on Sage build wheels. ```Shell ./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-objects && SAGE_NUM_THREADS=16 tox -v -v -v -e sagepython)' ``` -------------------------------- ### Interactive Program Startup Notice Example Source: https://github.com/sagemath/sage/blob/develop/src/LICENSE.txt This snippet illustrates a short notice that an interactive program should output when it starts in interactive mode, as per GPL guidelines. It informs users about the program's copyright, lack of warranty, and redistribution conditions, directing them to specific commands for more details. ```Plain Text Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. ``` -------------------------------- ### Performing a Full Rebuild of SageMath (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command sequence performs a full cleanup and rebuild of the SageMath installation. It's a time-consuming but reliable method to fix issues caused by indiscriminate system package upgrades that break shared libraries. ```Shell make distclean && make build ``` -------------------------------- ### Getting Example Algebra with Basis in SageMath Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/thematic_tutorials/tutorial-implementing-algebraic-structures.rst This command retrieves and displays an example of an algebra with basis over the Rational Field, serving as a reference for implementing new algebras. ```SageMath E = AlgebrasWithBasis(QQ).example(); E ``` -------------------------------- ### Starting Sage Library in sagemath-standard Virtual Environment (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/packaging_sage_library.rst After the 'tox' command finishes, this command allows starting the separate installation of the Sage library within its dedicated virtual environment created for the 'sagemath-standard' distribution. It directly executes the 'sage' executable from the '.tox' directory. ```Shell pkgs/sagemath-standard/.tox/sagepython-sagewheels-nopypi/bin/sage ``` -------------------------------- ### Creating a Symbolic Link for SageMath (bash) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command creates a symbolic link to the SageMath executable in a common system binary directory. This allows users to launch SageMath simply by typing `sage` from any directory in their terminal, without needing to specify the full path. ```bash ln -s /path/to/sage_root/sage /usr/local/bin/sage ``` -------------------------------- ### Installing Miniforge (Conda Installer) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/walkthrough.rst Downloads the latest Miniforge installer script for the current system architecture and then executes it to install Miniforge, which includes Conda. This is a prerequisite for managing Sage's dependencies with Conda. ```shell-session curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" bash Miniforge3-$(uname)-$(uname -m).sh ``` -------------------------------- ### Fetching a Specific SageMath Version from Upstream (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command fetches a specific tag or branch, in this case, '10.3.beta8', from the 'upstream' remote repository. This prepares the new version for use in a separate Git worktree without affecting the main installation. ```Shell git fetch upstream 10.3.beta8 ``` -------------------------------- ### Installing SageMath Wheelhouse Packages and sage_setup (Bash) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command installs all Python wheel packages found in the SageMath wheelhouse, along with the `sage_setup` package, into the active virtual environment using pip. This step prepares the environment for the main SageMath library. ```bash (sage-venv) $ python3 -m pip install $(sage-config SAGE_SPKG_WHEELS)/*.whl sage_setup ``` -------------------------------- ### Making a SageMath Launcher Script Executable (bash) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command changes the permissions of the previously created SageMath launcher script, making it executable by all users. This is a necessary step to allow the operating system to run the script as a program. ```bash chmod a+x sage ``` -------------------------------- ### Launching SageMath (Bash) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command executes the SageMath shell, allowing users to interact with the SageMath system. It's the primary way to start using Sage after a successful build. ```Bash ./sage ``` -------------------------------- ### Changing Directory to Sage Repository (Quick Start) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/walkthrough.rst Navigates into the newly cloned 'sage' directory, which contains the SageMath source code. This is a prerequisite for subsequent build and development steps. ```shell-session cd sage ``` -------------------------------- ### Building SageMath (Bash) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command starts the compilation and linking process for SageMath. It's an automatic and non-interactive step that builds all necessary components based on the configuration set by `./configure`. ```Bash make ``` -------------------------------- ### Defining a Basic Sage File (example.sage) - Python Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/tutorial/programming.rst This snippet defines a simple Sage file named `example.sage`. It prints "Hello World" and calculates 2 to the power of 3. This file demonstrates basic Sage syntax that will be preparsed when loaded or attached. ```python print("Hello World") print(2^3) ``` -------------------------------- ### Installing SageMath on Arch Linux/Manjaro Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/index.rst This command installs SageMath on Arch Linux and Manjaro distributions using the `pacman` package manager. It requires superuser privileges to execute successfully. ```Shell $ sudo pacman -S sagemath ``` -------------------------------- ### Iterating with `range(start, stop, step)` in Sage Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/tutorial/tour_help.rst This snippet demonstrates a `for` loop using `range(start, stop, step)` to iterate with a custom step size, printing numbers starting from `start` and incrementing by `step`. ```Python sage: for i in range(1,6,2): ....: print(i) 1 3 5 ``` -------------------------------- ### Configuring SageMath Project with Meson Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/meson.rst This command initializes the Meson build system for the SageMath project. It creates a `builddir` directory, which will store all build-related artifacts and configuration files, preparing the project for compilation. ```shell-session meson setup builddir ``` -------------------------------- ### Installing SageMath via Conda on Windows WSL Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/index.rst These commands facilitate the installation of Miniforge and the creation of a Conda environment named 'sage' with SageMath and Python 3.11 within Windows Subsystem for Linux (WSL). This is the recommended installation method for Windows users. ```Shell $ curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" $ bash Miniforge3-$(uname)-$(uname -m).sh $ conda create -n sage sage python=3.11 ``` -------------------------------- ### Changing Ownership of SageMath Installation to Root (Multi-User) - Shell Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This optional command changes the ownership of the entire SageMath installation directory (`SAGE_LOCAL`) and its contents recursively to the `root` user. This prevents accidental modifications to the installed files by the user who performed the installation, enhancing system stability in a multi-user environment. ```Shell sudo chown -R root SAGE_LOCAL ``` -------------------------------- ### Running Docker Container and Inspecting Build Artifacts Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/portability_testing.rst This sequence of commands shows how to start an interactive shell within a newly built Docker image using its ID. It then demonstrates how to list and inspect the log files and installed libraries for the 'ratpoints' package within the container. ```Bash docker run -it 2d06689d39fa bash root@fab59e09a641:/sage# ls -l logs/pkgs/ root@fab59e09a641:/sage# ls -l local/lib/*rat* ``` -------------------------------- ### Iterating with `range(start, stop)` in Sage Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/tutorial/tour_help.rst This snippet shows a `for` loop using `range(start, stop)` to iterate from a specified start value up to (but not including) the stop value, printing each number. ```Python sage: for i in range(2,5): ....: print(i) 2 3 4 ``` -------------------------------- ### Installing Git on openSUSE (Shell) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command installs Git using the `zypper` package manager on openSUSE. It requires superuser privileges (`sudo`). Git is required to clone the SageMath source code. ```Shell sudo zypper install git ``` -------------------------------- ### Interactive Program Startup GPL Notice Source: https://github.com/sagemath/sage/blob/develop/pkgs/sagemath-standard/LICENSE.txt This snippet shows a sample short notice to be output by an interactive program when it starts. It informs users about the program's copyright, lack of warranty, and free software status, directing them to specific commands (`show w`, `show c`) for full license details. ```Plaintext Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. ``` -------------------------------- ### Building SageMath and Documentation (Make) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst These `make` targets are used to build SageMath and its documentation. `make` (or `make doc`) builds both Sage and its HTML documentation. `make build` compiles Sage packages without building documentation. `make doc-pdf` builds PDF documentation, and `make doc-html-no-plot` builds HTML documentation while skipping auto-generated graphics. ```shell make ``` ```shell make build ``` ```shell make doc ``` ```shell make doc-pdf ``` ```shell make doc-html-no-plot ``` -------------------------------- ### Bootstrapping SageMath Source Tree Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command initiates the bootstrapping process for the SageMath source tree. It prepares the build system by generating necessary configuration files. If bootstrapping prerequisites are not met, it will download pre-built bootstrap output. ```Shell $ make configure ``` -------------------------------- ### Installing all SageMath wheelhouse packages using pip Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf/README.rst This command installs all prebuilt wheel files (`.whl`) located in the SageMath wheelhouse. It uses `sage-config` to dynamically get the wheelhouse path, ensuring all necessary dependencies are installed. ```Shell pip install $(sage-config SAGE_SPKG_WHEELS)/*.whl ``` -------------------------------- ### Installing Git on Void Linux (Shell) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command installs Git using the `xbps-install` package manager on Void Linux. It requires superuser privileges (`sudo`). Git is a prerequisite for cloning the SageMath source code. ```Shell sudo xbps-install git ``` -------------------------------- ### Configuring Sage Test Suite Skipping with SAGE_CHECK Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This snippet demonstrates how to configure the SAGE_CHECK environment variable to control which test suites are skipped or always run. Setting it to `!package-name` skips a package's tests, while `package-name` ensures they run. For example, `ppl,!python3` runs PPL tests and skips Python 3 tests. ```Shell SAGE_CHECK="ppl,!python3" ``` ```Shell SAGE_CHECK="!python2,!python3" ``` -------------------------------- ### Configuring SageMath Build (Bash) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command initiates the configuration process for building SageMath. It checks system dependencies and prepares the build environment based on detected system packages and default settings. ```Bash ./configure ``` -------------------------------- ### Enabling Ccache Installation in Sage Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This snippet shows how to enable the installation of ccache, an optional package, by setting the SAGE_INSTALL_CCACHE environment variable. When set to 'yes', Sage will install ccache with a default maximum cache size of 4GB. An internet connection is required during the build process to download ccache sources. ```Shell SAGE_INSTALL_CCACHE=yes ``` -------------------------------- ### Reviewing SageMath Configuration Options Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command displays a comprehensive list of all available configuration options for building SageMath. It allows users to customize the build process, enable or disable optional packages, and set installation prefixes. ```Shell $ ./configure --help ``` -------------------------------- ### Staging, Committing, and Pushing Changes to Git (Quick Start) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/walkthrough.rst Stages all modified and new files for commit, creates a new commit with a specified message, and then pushes the new branch and its commits to the 'origin' remote repository (your GitHub fork). ```shell-session git add . git commit -m "Your commit message here" git push origin my_branch ``` -------------------------------- ### Demonstrating Object References vs. Copies (SageMath) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/prep/Programming.rst Initializes a matrix `A`, then assigns `B` to `A` (creating a reference) and `C` to a `copy` of `A`, setting up a scenario to illustrate the difference between references and independent copies. ```SageMath sage: A = matrix(QQ,[[1,2],[3,4]]) sage: B = A sage: C = copy(A) ``` -------------------------------- ### Installing Tcl/Tk Development Libraries (Linux) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command installs the `tk` and `tk-dev` (or `tk-devel`) packages on Debian/Ubuntu-based Linux systems. These packages provide the Tcl/Tk libraries and their development headers, which are required if SageMath is building its own Python from source and needs Tcl/Tk support. ```Shell sudo apt-get install tk tk-dev ``` -------------------------------- ### Installing Sage Package and Keeping Build Directory Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command shows how to install a specific Sage package (``) using the `sage -i -s` command. This method implicitly keeps the corresponding build directory, overriding the default behavior of deleting it after a successful installation. It's useful for debugging or inspecting the build process. ```Shell sage -i -s ``` -------------------------------- ### Installing Tkinter for System Python (Linux) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command installs the `python3-tk` package on Debian/Ubuntu-based Linux systems, which provides the Tkinter module for Python 3. This is necessary if SageMath is configured to use the operating system's Python 3 and requires Tcl/Tk libraries. ```Shell sudo apt-get install python3-tk ``` -------------------------------- ### Setting Permissions for SageMath Installation Directory (Multi-User) - Shell Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst These commands adjust the ownership and permissions of the SageMath installation directory (`SAGE_LOCAL`). The first command changes ownership to the current user, while the second sets read, write, and execute permissions for the owner, and read and execute permissions for group and others (755), making it writable for the installer and readable by all users. ```Shell sudo chown $(id -un) SAGE_LOCAL sudo chmod 755 SAGE_LOCAL ``` -------------------------------- ### Configuring SageMath with Specific Package Option (Bash) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command configures SageMath, specifically instructing it to build the `gf2x` package from Sage's own source rather than attempting to use a system-provided version. This is useful when a system package is not suitable or not present. ```Bash ./configure --with-system-gf2x=no ``` -------------------------------- ### Checking Conda Environment Status Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command displays information about the current Conda installation, including the active environment. It's used to verify that no Conda environment is active before proceeding with SageMath compilation. ```Shell conda info ``` -------------------------------- ### Compiling SageMath Project with Meson Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/meson.rst This command compiles the SageMath project using Meson. The `-C builddir` option specifies the build directory created during the setup phase, ensuring that the compilation process uses the correct configuration and outputs artifacts to the designated location. ```shell-session meson compile -C builddir ``` -------------------------------- ### Navigating to a Git Worktree Directory (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command changes the current directory to the newly created Git worktree, 'worktree-purple'. This is a necessary step before performing any operations or builds within the context of the new SageMath installation. ```Shell cd worktree-purple ``` -------------------------------- ### Displaying Sage Command Line Help Options Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/faq/faq-general.rst These commands display various help options for the SageMath executable. `./sage --help` provides general command-line options, while `./sage --advanced` shows more advanced or less commonly used options. ```shell-session $ ./sage --help ``` ```shell-session $ ./sage --advanced ``` -------------------------------- ### Demonstrating Subset Algebra Example in SageMath Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/thematic_tutorials/tutorial-implementing-algebraic-structures.rst This snippet shows an example of an algebra with multiple realizations, specifically the subset algebra of {1, 2, 3} over the Rational Field, which the tutorial aims to guide the user in reimplementing. ```SageMath Sets().WithRealizations().example() ``` -------------------------------- ### Installing All SageMath Wheels Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/README.rst This command installs all prebuilt SageMath wheels found in the designated wheelhouse. It leverages `sage-config` to obtain the correct wheelhouse path and then uses `pip install` with a wildcard to install all `.whl` files from that location. ```Shell pip install $(sage-config SAGE_SPKG_WHEELS)/*.whl ``` -------------------------------- ### Performing Basic Computations in SageMath (SageMath) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md These commands demonstrate basic arithmetic, 2D plotting, and 3D plotting within the SageMath interactive shell. They serve as quick tests to verify the functionality of the installed SageMath environment. ```SageMath 2 + 2 plot(x^2) plot3d(lambda x, y: x*y, (-1, 1), (-1, 1)) ``` -------------------------------- ### Installing SageMath Project with Meson Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/meson.rst This command installs the compiled SageMath project. It uses the artifacts from the `builddir` and installs them into the currently active Python environment or the system Python environment if no virtual environment is active. For editable installs, reinstallation after compilation is not required. ```shell-session meson install -C builddir ``` -------------------------------- ### Rebuilding SageMath After Package Uninstallation (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst After uninstalling specific broken packages, this command initiates a rebuild of the SageMath installation. This is a crucial step to ensure the system is in a consistent and working state with the newly uninstalled components re-integrated. ```Shell make build ``` -------------------------------- ### Installing Recommended System Packages for Sage SPKGs (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/portability_testing.rst This snippet represents a suggested apt-get install command provided by Sage's configure script. It recommends installing specific system packages (like libzmq3-dev and libz-dev) that are equivalent to certain Sage Packages (SPKGs), thereby potentially avoiding building them from source. ```Shell sudo apt-get install ... libzmq3-dev libz-dev ``` -------------------------------- ### Adding a New Git Worktree for SageMath (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command creates a new Git worktree named 'worktree-purple' at the 'FETCH_HEAD' commit. This allows users to work on a new SageMath version independently, providing isolation from the main installation. ```Shell git worktree add worktree-purple FETCH_HEAD ``` -------------------------------- ### Installing the SageMath Standard Library Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/README.rst This command installs the `sagemath-standard` package, which represents the core SageMath library. This step is typically performed after `sage_conf` and its associated prebuilt wheels have been successfully installed, ensuring all dependencies are met. ```Shell pip install sagemath-standard ``` -------------------------------- ### Installing Git on Void Linux Source: https://github.com/sagemath/sage/blob/develop/README.md This command installs the Git version control system on Void Linux using the `xbps-install` package manager. Superuser privileges (`sudo`) are required. Git is a prerequisite for cloning the SageMath source repository. ```Shell sudo xbps-install git ``` -------------------------------- ### Adjusting Ccache Max Size in Sage Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command demonstrates how to adjust the maximum cache size for ccache after it has been installed by Sage. The `SIZE` parameter can be specified in gigabytes (G), megabytes (M), or kilobytes (K). This allows users to customize the disk space allocated for the ccache. ```Shell sage -sh -c "ccache --max-size=SIZE" ``` -------------------------------- ### Rebuilding Sage's Python and Dependencies Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst These commands are used to rebuild SageMath's Python 3 and any components that depend on it. This is necessary if Tcl/Tk development libraries were installed *after* SageMath was initially built, ensuring Sage's Python recognizes the new libraries. ```Shell sage -f python3 # rebuild Python3 make # rebuild components of Sage depending on Python ``` -------------------------------- ### Debugging Polymake Installation with Perl Trace (Shell) Source: https://github.com/sagemath/sage/blob/develop/build/pkgs/polymake/SPKG.rst This sequence of commands helps debug polymake installation issues. It starts by installing the 'libdevel-trace-perl' package (assuming an apt-based system), then navigates to the 'src' directory, and finally executes the 'configure.pl' script using 'perl -d:Trace' to enable detailed tracing for debugging purposes. ```Shell # apt-get install libdevel-trace-perl $ cd src $ perl -d:Trace support/configure.pl ``` -------------------------------- ### Installing sagemath-standard Library (Bash) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command installs the core `sagemath-standard` library into the virtual environment using pip. The `--no-build-isolation` flag is used to prevent pip from creating temporary isolated environments during the build process, and `-v` provides verbose output. ```bash (sage-venv) $ python3 -m pip install --no-build-isolation -v sagemath-standard ``` -------------------------------- ### Silencing SageMath Build Output using Make Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command silences the detailed compilation log during the SageMath build process. By setting `V=0`, only a single line of output is shown at the beginning and end of each package installation, reducing verbosity. The `-s` flag further suppresses command echoing. ```Shell make -s V=0 ``` -------------------------------- ### Compiling Sphinx Documentation to HTML Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/thematic_tutorials/sws2rst.rst This command compiles the Sphinx documentation project into HTML format. After configuring the project with `sphinx-quickstart` and adding the `.rst` file to `index.rst`, executing `make html` generates the complete HTML documentation, typically found in the `_build/html` directory. ```shell-session $ make html ``` -------------------------------- ### Starting SageMath in a Docker Container Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/portability_testing.rst This snippet demonstrates how to execute the SageMath environment from within a Docker container. It shows the shell command to launch SageMath and the subsequent console output, including version information and the SageMath prompt, indicating a successful startup. ```Shell root@8055a7ba0607:/sage# ./sage ``` ```SageMath Console ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.6, Release Date: 2022-05-15 │ │ Using Python 3.8.10. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: ``` -------------------------------- ### Configuring Linux Run Level 5 in /etc/inittab (Original) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/faq/faq-usage.rst This snippet shows the typical content of the /etc/inittab file, which directs a Linux distribution to boot into a graphical login screen (run level 5). It serves as a reference before modification to address resource issues during compilation. ```text # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have # networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:5:initdefault: ``` -------------------------------- ### Retaining Sage Package Build Directories Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This snippet demonstrates how to retain the build directories of Sage packages after successful installation by setting SAGE_KEEP_BUILT_SPKGS to 'yes'. By default, these directories are deleted upon success but kept on error. This option ensures they are always preserved, which can consume significant disk space. ```Shell SAGE_KEEP_BUILT_SPKGS=yes ``` -------------------------------- ### Running SageMath Test Suite (Make) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst These `make` targets execute SageMath's comprehensive test suite. Commands like `ptest` and `ptestlong` run tests in parallel, with `ptestlong` including longer tests. Serial execution is available via `test` and `testlong`. The `testall` variants include tests dependent on optional packages and additional software. ```shell make ptest ``` ```shell make ptestlong ``` ```shell make test ``` ```shell make testlong ``` ```shell make testall ``` ```shell make ptestall ``` ```shell make testalllong ``` ```shell make ptestalllong ``` -------------------------------- ### Configuring SAGE_ROOT in Copied Sage Script (bash) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This snippet shows how to correctly set the `SAGE_ROOT` environment variable within a copied SageMath startup script. This modification is crucial for the script to locate the SageMath installation directory when the script is moved to a different location in the system's PATH. ```bash SAGE_ROOT= ``` -------------------------------- ### Generating Lists of Prime Numbers in SageMath Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/constructions/number_theory.rst This snippet demonstrates two methods for generating lists of prime numbers in SageMath: `primes_first_n` to get the first `n` primes, and `primes(start, end)` to get primes within a specified range. The latter requires converting the iterator to a list. ```SageMath primes_first_n(5) [2, 3, 5, 7, 11] list(primes(1, 10)) [2, 3, 5, 7] ``` -------------------------------- ### Enabling Documentation Installation (Shell) Source: https://github.com/sagemath/sage/blob/develop/build/pkgs/modular_resolution/SPKG.rst This shell command sets the `SAGE_SPKG_INSTALL_DOCS` environment variable to 'yes'. When set before installation, it instructs the SageMath package manager to automatically build and install the documentation for the `p_group_cohomology` package into the local Sage documentation directory. ```Shell export SAGE_SPKG_INSTALL_DOCS=yes ``` -------------------------------- ### Forcing Sage Package Reinstallation and Keeping Build Directory Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command demonstrates how to force the reinstallation of a specific Sage package (``) using `sage -f -s`. Similar to `sage -i -s`, this command also ensures that the build directory for the package is retained after the installation, which is helpful for development or troubleshooting. ```Shell sage -f -s ``` -------------------------------- ### Getting Degree of SandpileConfig in SageMath Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/thematic_tutorials/sandpile.rst Describes the `deg` method, which returns the 'degree' of the sandpile configuration. The example demonstrates its usage on a simple configuration on a complete graph. ```Python sage: S = sandpiles.Complete(3) sage: c = SandpileConfig(S, [1,2]) sage: c.deg() 3 ``` -------------------------------- ### Configuring Homebrew Build Environment for SageMath Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command sources a script to make Homebrew "keg-only" packages accessible in the build environment. It's necessary when Homebrew installs packages in non-standard paths, ensuring Sage can find its dependencies during compilation. SAGE_ROOT must be replaced with Sage's home directory. ```Shell source SAGE_ROOT/.homebrew-build-env ``` -------------------------------- ### Calling a Sage Plotting Function Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/prep/Quickstarts/Interact.rst This example demonstrates how to invoke the 'myplot' function without any arguments. When called this way, the function utilizes its default value for 'f' (which is 'x^2') to generate the plot. ```Python sage: myplot() ``` -------------------------------- ### Creating and Activating Conda Environment for Sage Development (Quick Start) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/walkthrough.rst Creates a new Conda environment named 'sage-dev' using a specified environment file (e.g., `environment-3.12-linux.yml`) and then activates it. This isolates Sage's dependencies and development tools. ```shell-session conda env create --file environment-3.12-linux.yml --name sage-dev conda activate sage-dev ``` -------------------------------- ### Deactivating Conda Environment Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command deactivates the currently active Conda environment, returning to the base environment or no active environment. It's a prerequisite for ensuring SageMath builds use system compilers or its own. ```Shell conda deactivate ``` -------------------------------- ### Building SageMath PDF Documentation (Bash) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command compiles the PDF version of the SageMath documentation. It requires LaTeX to be installed on the system and is an optional step for users who prefer offline PDF documentation. ```Bash make doc-pdf ``` -------------------------------- ### Exploring LaTeX Options for Graphs in Sage Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/prep/Quickstarts/Graphs-and-Discrete.rst This example demonstrates how to use the `?` operator in Sage to access the documentation and available options for LaTeX rendering of graphs, specifically through the `GraphLatex.set_option` method. ```Sage sage: sage.graphs.graph_latex.GraphLatex.set_option? ``` -------------------------------- ### Accessing `desolvers` Documentation in SageMath Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/prep/Quickstarts/Differential-Equations.rst This snippet demonstrates how to access the built-in documentation for the `desolvers` function in SageMath. Appending a question mark (`?`) to a function name provides detailed information about its usage, parameters, and examples. ```SageMath desolvers? ``` -------------------------------- ### Installing Sage Build Prerequisites on Debian/Ubuntu (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/faq/faq-usage.rst Installs essential build tools and the 'm4' macro processor on Debian/Ubuntu systems, which are required for compiling Sage from source. ```shell-session $ sudo apt-get install build-essential m4 ``` -------------------------------- ### Running WSL Notebook Launch Script (Bash) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/launching.rst These commands navigate to the user's home directory and then execute the 'sage_nb.sh' script. This initiates the Jupyter or JupyterLab server as configured within the script, opening the starting page in the Windows browser. ```bash cd ~ ./sage_nb.sh ``` -------------------------------- ### Listing Branches in a Git Worktree (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command lists all branches accessible from the current Git worktree, including the detached HEAD state. It demonstrates that all worktrees share the same underlying repository, allowing access to all branches. ```Shell git --no-pager branch -v ``` -------------------------------- ### Verifying Git Repository Structure (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command lists the contents of the '.git' directory to confirm that the current directory is indeed a Git repository. This is a preliminary step before performing Git operations like worktree management. ```Shell ls .git ``` -------------------------------- ### Running Extensive SageMath Tests (Bash) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command executes a comprehensive suite of tests for SageMath, validating over 200,000 lines of examples from the documentation. It's an optional but highly recommended step to ensure the integrity and correctness of the build. ```Bash make ptestlong ``` -------------------------------- ### Performing Basic Arithmetic in SageMath (ipycon) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This snippet demonstrates a basic arithmetic operation within the SageMath interactive console. It shows how to perform a simple addition, verifying the console's responsiveness and basic functionality. ```ipycon sage: 2 + 2 4 ``` -------------------------------- ### Computing Complex Gröbner Bases in SageMath Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/constructions/polynomials.rst This snippet provides a more intricate example of computing a Gröbner basis for an ideal generated by symmetric polynomials. It illustrates the setup of a polynomial ring with multiple variables and the subsequent computation of a complex Gröbner basis. ```Python R = PolynomialRing(QQ, 4, 'abcd', order='lp') a,b,c,d = R.gens() I = (a+b+c+d, a*b+a*d+b*c+c*d, a*b*c+a*b*d+a*c*d+b*c*d, a*b*c*d-1)*R; I B = I.groebner_basis(); B ``` -------------------------------- ### Installing sage_conf with pip (Bash) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command installs the `sage_conf` package, a crucial prerequisite for SageMath, into the active virtual environment using pip. The `-v` flag enables verbose output, showing detailed installation progress. ```bash (sage-venv) $ python3 -m pip install -v sage_conf ``` -------------------------------- ### Listing Optional SageMath Packages (Bash) Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command displays a list of optional packages available for SageMath. Users can use this to identify additional functionalities they might want to install beyond the standard build. ```Bash ./sage --optional ``` -------------------------------- ### Obtaining Vector Presentation of Homomorphism in SageMath Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/thematic_tutorials/steenrod_algebra_modules.rst This example demonstrates how to get the vector space presentation of a homomorphism for a specific degree. The result is a linear transformation represented by a matrix, along with details about its domain and codomain vector spaces. ```Python sage: f_21 = f.vector_presentation(21); f_21 Vector space morphism represented by the matrix: [1 0 0 0 0 0] [0 0 0 0 0 0] [1 0 0 0 0 0] Domain: Vector space quotient V/W of dimension 3 over Finite Field of size 2 where V: Vector space of dimension 20 over Finite Field of size 2 W: Vector space of degree 20 and dimension 17 over Finite Field of size 2 Basis matrix: [1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] ``` -------------------------------- ### Installing Xcode Command Line Tools on macOS Source: https://github.com/sagemath/sage/blob/develop/pkgs/sage-conf_pypi/sage_root/README.md This command initiates the installation of Xcode Command Line Tools on macOS. These tools are essential for compiling various software components, including those required by SageMath, especially if Homebrew is not used. ```Shell xcode-select --install ``` -------------------------------- ### Accessing Documentation for Methods in SageMath Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/prep/Quickstarts/Number-Theory.rst This snippet demonstrates how to access the built-in documentation (docstring) for a specific method in SageMath. Appending a question mark (`?`) to a method name, like `Zp.zeta?`, displays its usage, parameters, and examples. ```SageMath Zp.zeta? ``` -------------------------------- ### Installing Sage Wheelhouse Packages and sage_setup (Bash) Source: https://github.com/sagemath/sage/blob/develop/README.md This command installs all Python wheel packages found in the Sage wheelhouse, along with the `sage_setup` package. It leverages `sage-config SAGE_SPKG_WHEELS` to locate the pre-built wheels, streamlining the installation of core dependencies. ```Bash python3 -m pip install $(sage-config SAGE_SPKG_WHEELS)/*.whl sage_setup ``` -------------------------------- ### Generating an Element of a Steenrod Module at a Specific Degree in SageMath (Python) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/thematic_tutorials/steenrod_algebra_modules.rst This snippet uses the `an_element()` method to generate an arbitrary element of the module `M` at a specified degree `n=5`. This is useful for quickly getting an example element for testing or display. ```Python M.an_element(n=5) ``` -------------------------------- ### Installing All Sage Build Prerequisites (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/developer/portability_testing.rst This snippet executes a single apt-get install command to install a comprehensive set of packages identified as necessary build prerequisites for Sage on Debian/Ubuntu. These packages include development tools, compilers, and utilities. ```Shell apt-get install binutils make m4 perl python3 \ tar bc gcc g++ ca-certificates patch ``` -------------------------------- ### Setting up Conda Environment and Paths (Windows) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/meson.rst This snippet creates and activates a Conda development environment for Sage on Windows, then sets the `LIB` and `INCLUDE` environment variables to point to the Conda library and include directories, which is crucial for compilation. ```shell $ mamba env create --file environment-3.11-win.yml --name sage-dev $ conda activate sage-dev $ set LIB=%CONDA_PREFIX%\Library\lib;%LIB% $ set INCLUDE=%CONDA_PREFIX%\Library\include;%INCLUDE% ``` -------------------------------- ### Launching SageMath via Conda on Windows WSL Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/index.rst These commands activate the 'sage' Conda environment and subsequently launch the SageMath terminal interface within Windows Subsystem for Linux (WSL), providing a basic way to interact with SageMath. ```Shell $ conda activate sage $ sage ``` -------------------------------- ### Referencing Build Configuration in Python Source: https://github.com/sagemath/sage/blob/develop/build/pkgs/tox/version_requirements.txt This comment provides a cross-reference to the 'spkg-configure.m4' file, which likely contains build or packaging configuration details for the SageMath project's spkg system. It guides developers to relevant setup information. ```Python # see spkg-configure.m4 ``` -------------------------------- ### Launching SageMath (Bash) Source: https://github.com/sagemath/sage/blob/develop/README.md Executes the SageMath command-line interface, allowing users to interact with the SageMath system. This is the primary way to start a SageMath session after a successful build. ```bash ./sage ``` -------------------------------- ### Installing SageMath as a New Jupyter Kernel (Bash) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/launching.rst This command installs the SageMath kernel into the user's Jupyter configuration, making it available as a selectable kernel in Jupyter notebooks or JupyterLab. It uses the previously located kernel description path and assigns a custom name like 'sagemath-dev'. ```bash jupyter kernelspec install --user $(sage -sh -c 'ls -d $SAGE_VENV/share/jupyter/kernels/sagemath') --name sagemath-dev ``` -------------------------------- ### Debugging Interactive Sage Functions Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/prep/Quickstarts/Interact.rst This example demonstrates that even after applying the '@interact' decorator, the function can still be called directly with arguments. This capability is highly useful for debugging and testing the function's behavior independently of the interactive widget. ```Python sage: myplot(x^4) ``` -------------------------------- ### Initializing Hotshot Profiler (Sage) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/tutorial/programming.rst This code initializes the hotshot profiler in SageMath, setting up a finite field and a matrix as a profiling target. It creates a hotshot.Profile instance, specifying the output filename and enabling lineevents for detailed line-by-line profiling data. ```Python sage: k,a = GF(2**8, 'a').objgen() sage: A = Matrix(k,10,10,[k.random_element() for _ in range(10*10)]) sage: import hotshot sage: filename = "pythongrind.prof" sage: prof = hotshot.Profile(filename, lineevents=1) ``` -------------------------------- ### Inspecting .git File in Linked Worktree (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command shows that the '.git' entry in a linked worktree is not a directory but a file, pointing to the main repository's '.git' directory. This confirms the shared repository structure of linked worktrees. ```Shell ls -l .git ``` -------------------------------- ### Setting Up and Logging a SageMath Session Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/tutorial/interactive_shell.rst This snippet demonstrates how to start logging a SageMath session to a file named 'setup' and then define several mathematical objects: an elliptic curve E, a rational vector space F, polynomial ring generators x and y, and the generators of the elliptic curve G. It illustrates basic session management and object creation in SageMath. ```Python logstart setup E = EllipticCurve([1,2,3,4,5]).minimal_model() F = QQ^3 x,y = QQ['x,y'].gens() G = E.gens() ``` -------------------------------- ### Checking SageMath Version in Worktree (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst This command displays the content of the 'VERSION.txt' file within the current worktree, confirming the SageMath version being used. It's a quick way to verify that the correct version is active in the new environment. ```Shell cat VERSION.txt ``` -------------------------------- ### Starting a Standalone Sage Script - Python Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/tutorial/programming.rst This snippet provides the initial lines for a standalone Sage script. The shebang `#!/usr/bin/env sage` ensures the script is executed with the Sage interpreter. It includes basic argument parsing to check if exactly one argument is provided, indicating the start of a command-line utility. ```python #!/usr/bin/env sage import sys if len(sys.argv) != 2: ``` -------------------------------- ### Verifying Newly Added Git Worktree (Shell) Source: https://github.com/sagemath/sage/blob/develop/src/doc/en/installation/source.rst After adding a new worktree, this command is used to confirm its successful creation and display its details alongside other existing worktrees. It shows the path and detached HEAD status of the new worktree. ```Shell git worktree list ```