Using Octave and Sagemath on Taito

Total Page:16

File Type:pdf, Size:1020Kb

Using Octave and Sagemath on Taito Using Octave and SageMath on Taito Sampo Sillanpää 17 October 2017 CSC – Finnish research, education, culture and public administration ICT knowledge center Octave ● Powerful mathematics-oriented syntax with built- in plotting and visualization tools. ● Free software, runs on GNU/Linux, macOS, BSD, and Windows. ● Drop-in compatible with many Matlab scripts. ● https://www.gnu.org/software/octave/ SageMath ● SageMath is a free open-source mathematics software system licensed under the GPL. ● Builds on top of many existing open-source packages: NumPy, SciPy, matplotlib, Sympy, Maxima, GAP, FLINT, R and many more. ● http://www.sagemath.org/ Octave on Taito ● Latest version 4.2.1 module load octave-env octave Or octave --no-gui ● Interactive sessions on Taito-shell via NoMachine client https://research.csc.5/-/nomachine Octave Forge ● A central location for development of packages for GNU Octave. ● Packages can be installed on Taito module load octave-env octave --no-gui octave:> pkg install -forge package_name octave:> pkg load package_name SageMath on Taito ● installed version 7.6. module load sagemath sage ● Interactive sessions on Taito-shell via NoMachine client. ● Browser-based notebook sage: notebook() Octave Batch Jobs #!/bin/bash -l #mytest.sh #SBATCH --constraint="snb|hsw" #SBATCH -o output.out #SBATCH -e stderr.err #SBATCH -p serial #SBATCH -n 1 #SBATCH -t 00:05:00 #SBATCH --mem-per-cpu=1000 module load octave-env octave --no-gui/wrk/user_name/example.m used_slurm_resources.bash [user@taito-login1]$ sbatch mytest.sh SageMath Batch Jobs #!/bin/bash -l #mytest.sh #SBATCH --constraint="snb|hsw" #SBATCH -o output.out #SBATCH -e stderr.err #SBATCH -p serial #SBATCH -n 1 #SBATCH -t 00:05:00 #SBATCH --mem-per-cpu=1000 module load sagemath sage /wrk/user_name/example.sage used_slurm_resources.bash [user@taito-login1]$ sbatch mytest.sh Instrucons and Documentaon ● Octave – https://research.csc.5/-/octave – https://www.gnu.org/software/octave/doc/interp reter/ ● SageMath – https://research.csc.5/-/sagemath – http://doc.sagemath.org/ [email protected].
Recommended publications
  • Sagemath and Sagemathcloud
    Viviane Pons Ma^ıtrede conf´erence,Universit´eParis-Sud Orsay [email protected] { @PyViv SageMath and SageMathCloud Introduction SageMath SageMath is a free open source mathematics software I Created in 2005 by William Stein. I http://www.sagemath.org/ I Mission: Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab. Viviane Pons (U-PSud) SageMath and SageMathCloud October 19, 2016 2 / 7 SageMath Source and language I the main language of Sage is python (but there are many other source languages: cython, C, C++, fortran) I the source is distributed under the GPL licence. Viviane Pons (U-PSud) SageMath and SageMathCloud October 19, 2016 3 / 7 SageMath Sage and libraries One of the original purpose of Sage was to put together the many existent open source mathematics software programs: Atlas, GAP, GMP, Linbox, Maxima, MPFR, PARI/GP, NetworkX, NTL, Numpy/Scipy, Singular, Symmetrica,... Sage is all-inclusive: it installs all those libraries and gives you a common python-based interface to work on them. On top of it is the python / cython Sage library it-self. Viviane Pons (U-PSud) SageMath and SageMathCloud October 19, 2016 4 / 7 SageMath Sage and libraries I You can use a library explicitly: sage: n = gap(20062006) sage: type(n) <c l a s s 'sage. interfaces .gap.GapElement'> sage: n.Factors() [ 2, 17, 59, 73, 137 ] I But also, many of Sage computation are done through those libraries without necessarily telling you: sage: G = PermutationGroup([[(1,2,3),(4,5)],[(3,4)]]) sage : G . g a p () Group( [ (3,4), (1,2,3)(4,5) ] ) Viviane Pons (U-PSud) SageMath and SageMathCloud October 19, 2016 5 / 7 SageMath Development model Development model I Sage is developed by researchers for researchers: the original philosophy is to develop what you need for your research and share it with the community.
    [Show full text]
  • A Comparative Evaluation of Matlab, Octave, R, and Julia on Maya 1 Introduction
    A Comparative Evaluation of Matlab, Octave, R, and Julia on Maya Sai K. Popuri and Matthias K. Gobbert* Department of Mathematics and Statistics, University of Maryland, Baltimore County *Corresponding author: [email protected], www.umbc.edu/~gobbert Technical Report HPCF{2017{3, hpcf.umbc.edu > Publications Abstract Matlab is the most popular commercial package for numerical computations in mathematics, statistics, the sciences, engineering, and other fields. Octave is a freely available software used for numerical computing. R is a popular open source freely available software often used for statistical analysis and computing. Julia is a recent open source freely available high-level programming language with a sophisticated com- piler for high-performance numerical and statistical computing. They are all available to download on the Linux, Windows, and Mac OS X operating systems. We investigate whether the three freely available software are viable alternatives to Matlab for uses in research and teaching. We compare the results on part of the equipment of the cluster maya in the UMBC High Performance Computing Facility. The equipment has 72 nodes, each with two Intel E5-2650v2 Ivy Bridge (2.6 GHz, 20 MB cache) proces- sors with 8 cores per CPU, for a total of 16 cores per node. All nodes have 64 GB of main memory and are connected by a quad-data rate InfiniBand interconnect. The tests focused on usability lead us to conclude that Octave is the most compatible with Matlab, since it uses the same syntax and has the native capability of running m-files. R was hampered by somewhat different syntax or function names and some missing functions.
    [Show full text]
  • Running Sagemath (With Or Without Installation)
    Running SageMath (with or without installation) http://www.sagemath.org/ Éric Gourgoulhon Running SageMath 9 Feb. 2017 1 / 5 Various ways to install/access SageMath 7.5.1 Install on your computer: 2 options: install a compiled binary version for Linux, MacOS X or Windows1 from http://www.sagemath.org/download.html compile from source (Linux, MacOS X): check the prerequisites (see here for Ubuntu) and run git clone git://github.com/sagemath/sage.git cd sage MAKE=’make -j8’ make Run on your computer without installation: Sage Debian Live http://sagedebianlive.metelu.net/ Bootable USB flash drive with SageMath (boosted with octave, scilab), Geogebra, LaTeX, gimp, vlc, LibreOffice,... Open a (free) account on SageMathCloud https://cloud.sagemath.com/ Run in SageMathCell Single cell mode: http://sagecell.sagemath.org/ 1requires VirtualBox; alternatively, a full Windows installer is in pre-release stage at https://github.com/embray/sage-windows/releases Éric Gourgoulhon Running SageMath 9 Feb. 2017 2 / 5 Example 1: installing on Ubuntu 16.04 1 Download the archive sage-7.5.1-Ubuntu_16.04-x86_64.tar.bz2 from one the mirrors listed at http://www.sagemath.org/download-linux.html 2 Run the following commands in a terminal: bunzip2 sage-7.5.1-Ubuntu_16.04-x86_64.tar.bz2 tar xvf sage-7.5.1-Ubuntu_16.04-x86_64.tar cd SageMath ./sage -n jupyter A Jupyter home page should then open in your browser. Click on New and select SageMath 7.5.1 to open a Jupyter notebook with a SageMath kernel. Éric Gourgoulhon Running SageMath 9 Feb. 2017 3 / 5 Example 2: using the SageMathCloud 1 Open a free account on https://cloud.sagemath.com/ 2 Create a new project 3 In the second top menu, click on New to create a new file 4 Select Jupyter Notebook for the file type 5 In the Jupyter menu, click on Kernel, then Change kernel and choose SageMath 7.5 Éric Gourgoulhon Running SageMath 9 Feb.
    [Show full text]
  • GNU Guix Cookbook Tutorials and Examples for Using the GNU Guix Functional Package Manager
    GNU Guix Cookbook Tutorials and examples for using the GNU Guix Functional Package Manager The GNU Guix Developers Copyright c 2019 Ricardo Wurmus Copyright c 2019 Efraim Flashner Copyright c 2019 Pierre Neidhardt Copyright c 2020 Oleg Pykhalov Copyright c 2020 Matthew Brooks Copyright c 2020 Marcin Karpezo Copyright c 2020 Brice Waegeneire Copyright c 2020 Andr´eBatista Copyright c 2020 Christine Lemmer-Webber Copyright c 2021 Joshua Branson Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License". i Table of Contents GNU Guix Cookbook ::::::::::::::::::::::::::::::: 1 1 Scheme tutorials ::::::::::::::::::::::::::::::::: 2 1.1 A Scheme Crash Course :::::::::::::::::::::::::::::::::::::::: 2 2 Packaging :::::::::::::::::::::::::::::::::::::::: 5 2.1 Packaging Tutorial:::::::::::::::::::::::::::::::::::::::::::::: 5 2.1.1 A \Hello World" package :::::::::::::::::::::::::::::::::: 5 2.1.2 Setup:::::::::::::::::::::::::::::::::::::::::::::::::::::: 8 2.1.2.1 Local file ::::::::::::::::::::::::::::::::::::::::::::: 8 2.1.2.2 `GUIX_PACKAGE_PATH' ::::::::::::::::::::::::::::::::: 9 2.1.2.3 Guix channels ::::::::::::::::::::::::::::::::::::::: 10 2.1.2.4 Direct checkout hacking:::::::::::::::::::::::::::::: 10 2.1.3 Extended example ::::::::::::::::::::::::::::::::::::::::
    [Show full text]
  • Introduction to GNU Octave
    Introduction to GNU Octave Hubert Selhofer, revised by Marcel Oliver updated to current Octave version by Thomas L. Scofield 2008/08/16 line 1 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 8 6 4 2 -8 -6 0 -4 -2 -2 0 -4 2 4 -6 6 8 -8 Contents 1 Basics 2 1.1 What is Octave? ........................... 2 1.2 Help! . 2 1.3 Input conventions . 3 1.4 Variables and standard operations . 3 2 Vector and matrix operations 4 2.1 Vectors . 4 2.2 Matrices . 4 1 2.3 Basic matrix arithmetic . 5 2.4 Element-wise operations . 5 2.5 Indexing and slicing . 6 2.6 Solving linear systems of equations . 7 2.7 Inverses, decompositions, eigenvalues . 7 2.8 Testing for zero elements . 8 3 Control structures 8 3.1 Functions . 8 3.2 Global variables . 9 3.3 Loops . 9 3.4 Branching . 9 3.5 Functions of functions . 10 3.6 Efficiency considerations . 10 3.7 Input and output . 11 4 Graphics 11 4.1 2D graphics . 11 4.2 3D graphics: . 12 4.3 Commands for 2D and 3D graphics . 13 5 Exercises 13 5.1 Linear algebra . 13 5.2 Timing . 14 5.3 Stability functions of BDF-integrators . 14 5.4 3D plot . 15 5.5 Hilbert matrix . 15 5.6 Least square fit of a straight line . 16 5.7 Trapezoidal rule . 16 1 Basics 1.1 What is Octave? Octave is an interactive programming language specifically suited for vectoriz- able numerical calculations.
    [Show full text]
  • A Tutorial on Reliable Numerical Computation
    A tutorial on reliable numerical computation Paul Zimmermann Dagstuhl seminar 17481, Schloß Dagstuhl, November 2017 The IEEE 754 standard First version in 1985, first revision in 2008, another revision for 2018. Standard formats: binary32, binary64, binary128, decimal64, decimal128 Standard rounding modes (attributes): roundTowardPositive, roundTowardNegative, roundTowardZero, roundTiesToEven p Correct rounding: required for +; −; ×; ÷; ·, recommended for other mathematical functions (sin; exp; log; :::) 2 Different kinds of arithmetic in various languages fixed precision arbitrary precision real double (C) GNU MPFR (C) numbers RDF (Sage) RealField(p) (Sage) MPFI (C) Boost Interval (C++) RealIntervalField(p) (Sage) real INTLAB (Matlab, Octave) RealBallField(p) (Sage) intervals RIF (Sage) libieeep1788 (C++) RBF (Sage) Octave Interval (Octave) libieeep1788 is developed by Marco Nehmeier GNU Octave Interval is developed by Oliver Heimlich 3 An example from Siegfried Rump Reference: S.M. Rump. Gleitkommaarithmetik auf dem Prüfstand [Wie werden verifiziert(e) numerische Lösungen berechnet?]. Jahresbericht der Deutschen Mathematiker-Vereinigung, 118(3):179–226, 2016. a p(a; b) = 21b2 − 2a2 + 55b4 − 10a2b2 + 2b Evaluate p at a = 77617, b = 33096. 4 Rump’s polynomial in the C language #include <stdio.h> TYPE p (TYPE a, TYPE b) { TYPE a2 = a * a; TYPE b2 = b * b; return 21.0*b2 - 2.0*a2 + 55*b2*b2 - 10*a2*b2 + a/(2.0*b); } int main() { printf ("%.16Le\n", (long double) p (77617.0, 33096.0)); } 5 Rump’s polynomial in the C language: results $ gcc -DTYPE=float rump.c && ./a.out -4.3870930862080000e+12 $ gcc -DTYPE=double rump.c && ./a.out 1.1726039400531787e+00 $ gcc -DTYPE="long double" rump.c && ./a.out 1.1726039400531786e+00 $ gcc -DTYPE=__float128 rump.c && ./a.out -8.2739605994682137e-01 6 The MPFR library A reference implementation of IEEE 754 in (binary) arbitrary precision in the C language.
    [Show full text]
  • Bash Guide for Beginners
    Bash Guide for Beginners Machtelt Garrels Garrels BVBA <tille wants no spam _at_ garrels dot be> Version 1.11 Last updated 20081227 Edition Bash Guide for Beginners Table of Contents Introduction.........................................................................................................................................................1 1. Why this guide?...................................................................................................................................1 2. Who should read this book?.................................................................................................................1 3. New versions, translations and availability.........................................................................................2 4. Revision History..................................................................................................................................2 5. Contributions.......................................................................................................................................3 6. Feedback..............................................................................................................................................3 7. Copyright information.........................................................................................................................3 8. What do you need?...............................................................................................................................4 9. Conventions used in this
    [Show full text]
  • Gretl User's Guide
    Gretl User’s Guide Gnu Regression, Econometrics and Time-series Allin Cottrell Department of Economics Wake Forest university Riccardo “Jack” Lucchetti Dipartimento di Economia Università di Ancona November, 2005 Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation (see http://www.gnu.org/licenses/fdl.html). Contents 1 Introduction 1 1.1 Features at a glance ......................................... 1 1.2 Acknowledgements ......................................... 1 1.3 Installing the programs ....................................... 2 2 Getting started 4 2.1 Let’s run a regression ........................................ 4 2.2 Estimation output .......................................... 6 2.3 The main window menus ...................................... 7 2.4 The gretl toolbar ........................................... 10 3 Modes of working 12 3.1 Command scripts ........................................... 12 3.2 Saving script objects ......................................... 13 3.3 The gretl console ........................................... 14 3.4 The Session concept ......................................... 14 4 Data files 17 4.1 Native format ............................................. 17 4.2 Other data file formats ....................................... 17 4.3 Binary databases ........................................... 17 4.4 Creating a data file from scratch ................................
    [Show full text]
  • Functional Package and Configuration Management with GNU Guix
    Functional Package and Configuration Management with GNU Guix David Thompson Wednesday, January 20th, 2016 About me GNU project volunteer GNU Guile user and contributor since 2012 GNU Guix contributor since 2013 Day job: Ruby + JavaScript web development / “DevOps” 2 Overview • Problems with application packaging and deployment • Intro to functional package and configuration management • Towards the future • How you can help 3 User autonomy and control It is becoming increasingly difficult to have control over your own computing: • GNU/Linux package managers not meeting user needs • Self-hosting web applications requires too much time and effort • Growing number of projects recommend installation via curl | sudo bash 1 or otherwise avoid using system package managers • Users unable to verify that a given binary corresponds to the source code 1http://curlpipesh.tumblr.com/ 4 User autonomy and control “Debian and other distributions are going to be that thing you run Docker on, little more.” 2 2“ownCloud and distribution packaging” http://lwn.net/Articles/670566/ 5 User autonomy and control This is very bad for desktop users and system administrators alike. We must regain control! 6 What’s wrong with Apt/Yum/Pacman/etc.? Global state (/usr) that prevents multiple versions of a package from coexisting. Non-atomic installation, removal, upgrade of software. No way to roll back. Nondeterminstic package builds and maintainer-uploaded binaries. (though this is changing!) Reliance on pre-built binaries provided by a single point of trust. Requires superuser privileges. 7 The problem is bigger Proliferation of language-specific package managers and binary bundles that complicate secure system maintenance.
    [Show full text]
  • Some Effective Methods for Teaching Mathematics Courses in Technological Universities
    International Journal of Education and Information Studies. ISSN 2277-3169 Volume 6, Number 1 (2016), pp. 11-18 © Research India Publications http://www.ripublication.com Some Effective Methods for Teaching Mathematics Courses in Technological Universities Dr. D. S. Sankar Professor, School of Applied Sciences and Mathematics, Universiti Teknologi Brunei, Jalan Tungku Link, BE1410, Brunei Darussalam E-mail: [email protected] Dr. Rama Rao Karri Principal Lecturer, Petroleum and Chemical Engineering Programme Area, Faculty of Engineering, Universiti Teknologi Brunei, Jalan Tungku Link, Gadong BE1410, Brunei Darussalam E-mail: [email protected] Abstract This article discusses some effective and useful methods for teaching various mathematics topics to the students of undergraduate and post-graduate degree programmes in technological universities. These teaching methods not only equip the students to acquire knowledge and skills for solving real world problems efficiently, but also these methods enhance the teacher’s ability to demonstrate the mathematical concepts effectively along with suitable physical examples. The exposure to mathematical softwares like MATLAB, SCILAB, MATHEMATICA, etc not only increases the students confidential level to solve variety of typical problems which they come across in their respective disciplines of study, but also it enables them to visualize the surfaces of the functions of several variable. Peer learning, seminar based learning and project based learning are other methods of learning environment to the students which makes the students to learn mathematics by themselves. These are higher level learning methods which enhances the students understanding on the mathematical concepts and it enables them to take up research projects. It is noted that the teaching and learning of mathematics with the support of mathematical softwares is believed to be more effective when compared to the effects of other methods of teaching and learning of mathematics.
    [Show full text]
  • Sage Tutorial (Pdf)
    Sage Tutorial Release 9.4 The Sage Development Team Aug 24, 2021 CONTENTS 1 Introduction 3 1.1 Installation................................................4 1.2 Ways to Use Sage.............................................4 1.3 Longterm Goals for Sage.........................................5 2 A Guided Tour 7 2.1 Assignment, Equality, and Arithmetic..................................7 2.2 Getting Help...............................................9 2.3 Functions, Indentation, and Counting.................................. 10 2.4 Basic Algebra and Calculus....................................... 14 2.5 Plotting.................................................. 20 2.6 Some Common Issues with Functions.................................. 23 2.7 Basic Rings................................................ 26 2.8 Linear Algebra.............................................. 28 2.9 Polynomials............................................... 32 2.10 Parents, Conversion and Coercion.................................... 36 2.11 Finite Groups, Abelian Groups...................................... 42 2.12 Number Theory............................................. 43 2.13 Some More Advanced Mathematics................................... 46 3 The Interactive Shell 55 3.1 Your Sage Session............................................ 55 3.2 Logging Input and Output........................................ 57 3.3 Paste Ignores Prompts.......................................... 58 3.4 Timing Commands............................................ 58 3.5 Other IPython
    [Show full text]
  • 2015 Program for Women and Mathematics
    2015 Program for Women and Mathematics SageMath Installation Instructions Below are instructions for configuring your personal computer to run SageMath. Since one of the files that you need to download is quite large in size, we recommended that you complete the steps below on your personal computer prior to the start of the 2015 Program for Women and Mathematics. If you run into any issues with these instructions on your personal computer, please contact the School of Mathematics Help Desk at [email protected] or visit the SageMath website (http://www.sagemath.org/). Fedora 21 Operating System 1. Download and unpack the Fedora 21 pre-built SageMath binary tarball from the following location: http://www.sagemath.org/download-linux.html. 2. Create a symbolic link in /usr/local/bin that points to the path where you unpacked the pre-built SageMath binary in Step 1. For example, ln -s /path/to/sage-x.y.z-x86_64-Linux/sage /usr/local/bin/sage 3. Navigate to /usr/local/bin. 4. Type sage and press the Enter button. 5. You will be prompted to install “sagemath”. Enter y. Please wait for all required packages to be downloaded and installed. 6. Once the installation is complete, type sage. 7. Type notebook() to launch the browser-based notebook interface. 8. Type in a new password for the SageMath Notebook “admin” account twice. 9. The SageMath browser-based notebook should now be displayed. How to exit the Sage appliance 1. Click on the Sign out link at the top of the SageMath browser based notebook interface.
    [Show full text]