about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/math
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/science/math')
-rw-r--r--nixpkgs/pkgs/applications/science/math/R/default.nix10
-rw-r--r--nixpkgs/pkgs/applications/science/math/R/fix-failing-test.patch25
-rw-r--r--nixpkgs/pkgs/applications/science/math/R/skip-check-for-aarch64.patch11
-rw-r--r--nixpkgs/pkgs/applications/science/math/colpack/default.nix28
-rw-r--r--nixpkgs/pkgs/applications/science/math/ginac/default.nix18
-rw-r--r--nixpkgs/pkgs/applications/science/math/lp_solve/default.nix63
-rw-r--r--nixpkgs/pkgs/applications/science/math/lp_solve/isnan.patch13
-rw-r--r--nixpkgs/pkgs/applications/science/math/maxima/default.nix25
-rw-r--r--nixpkgs/pkgs/applications/science/math/nasc/default.nix14
-rw-r--r--nixpkgs/pkgs/applications/science/math/nauty/default.nix6
-rw-r--r--nixpkgs/pkgs/applications/science/math/polymake/default.nix31
-rw-r--r--nixpkgs/pkgs/applications/science/math/pynac/default.nix11
-rw-r--r--nixpkgs/pkgs/applications/science/math/qalculate-gtk/default.nix4
-rw-r--r--nixpkgs/pkgs/applications/science/math/sage/default.nix4
-rw-r--r--nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch18
-rw-r--r--nixpkgs/pkgs/applications/science/math/sage/patches/ignore-cmp-deprecation.patch24
-rw-r--r--nixpkgs/pkgs/applications/science/math/sage/sage-src.nix97
-rw-r--r--nixpkgs/pkgs/applications/science/math/sage/sagelib.nix2
-rw-r--r--nixpkgs/pkgs/applications/science/math/scilab-bin/default.nix2
-rw-r--r--nixpkgs/pkgs/applications/science/math/wxmaxima/default.nix4
20 files changed, 185 insertions, 225 deletions
diff --git a/nixpkgs/pkgs/applications/science/math/R/default.nix b/nixpkgs/pkgs/applications/science/math/R/default.nix
index 827c817fd1a6..a8fdfe8571a6 100644
--- a/nixpkgs/pkgs/applications/science/math/R/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/R/default.nix
@@ -1,9 +1,10 @@
 { lib, stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt, libjpeg, libpng
 , libtiff, ncurses, pango, pcre2, perl, readline, tcl, texLive, tk, xz, zlib
 , less, texinfo, graphviz, icu, pkg-config, bison, imake, which, jdk, blas, lapack
-, curl, Cocoa, Foundation, libobjc, libcxx, tzdata, fetchpatch
+, curl, Cocoa, Foundation, libobjc, libcxx, tzdata
 , withRecommendedPackages ? true
 , enableStrictBarrier ? false
+, enableMemoryProfiling ? false
 # R as of writing does not support outputting both .so and .a files; it outputs:
 #     --enable-R-static-lib conflicts with --enable-R-shlib and will be ignored
 , static ? false
@@ -13,11 +14,11 @@ assert (!blas.isILP64) && (!lapack.isILP64);
 
 stdenv.mkDerivation rec {
   pname = "R";
-  version = "4.0.4";
+  version = "4.1.1";
 
   src = fetchurl {
     url = "https://cran.r-project.org/src/base/R-${lib.versions.major version}/${pname}-${version}.tar.gz";
-    sha256 = "0bl098xcv8v316kqnf43v6gb4kcsv31ydqfm1f7qr824jzb2fgsj";
+    sha256 = "0r6kpnxjbvb7gdfg4m1z8zc6xd225vw81wrnf05ps9ajawk06pji";
   };
 
   dontUseImakeConfigure = true;
@@ -30,7 +31,7 @@ stdenv.mkDerivation rec {
 
   patches = [
     ./no-usr-local-search-paths.patch
-    ./fix-failing-test.patch
+    ./skip-check-for-aarch64.patch
   ];
 
   prePatch = lib.optionalString stdenv.isDarwin ''
@@ -56,6 +57,7 @@ stdenv.mkDerivation rec {
       --with-libtiff
       --with-ICU
       ${lib.optionalString enableStrictBarrier "--enable-strict-barrier"}
+      ${lib.optionalString enableMemoryProfiling "--enable-memory-profiling"}
       ${if static then "--enable-R-static-lib" else "--enable-R-shlib"}
       AR=$(type -p ar)
       AWK=$(type -p gawk)
diff --git a/nixpkgs/pkgs/applications/science/math/R/fix-failing-test.patch b/nixpkgs/pkgs/applications/science/math/R/fix-failing-test.patch
deleted file mode 100644
index 5fb3b3b9c317..000000000000
--- a/nixpkgs/pkgs/applications/science/math/R/fix-failing-test.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From e8f54bc562eb301d204b5f880614be58a2b39a2b Mon Sep 17 00:00:00 2001
-From: maechler <maechler@00db46b3-68df-0310-9c12-caf00c1e9a41>
-Date: Mon, 30 Mar 2020 19:15:59 +0000
-Subject: [PATCH] no longer fail in norm() check for broken OpenBLAS Lapack
- 3.9.0
-
-git-svn-id: https://svn.r-project.org/R/trunk@78112 00db46b3-68df-0310-9c12-caf00c1e9a41
----
- tests/reg-tests-1d.R | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/tests/reg-tests-1d.R b/tests/reg-tests-1d.R
-index 6b7de765a95..fafd6911e7a 100644
---- a/tests/reg-tests-1d.R
-+++ b/tests/reg-tests-1d.R
-@@ -3836,7 +3836,8 @@ stopifnot(is.na( norm(diag(c(1, NA)), "2") ))
- ## norm(<matrix-w-NA>, "F")
- (m <- cbind(0, c(NA, 0), 0:-1))
- nTypes <- eval(formals(base::norm)$type) # "O" "I" "F" "M" "2"
--stopifnot(is.na( print(vapply(nTypes, norm, 0., x = m)) )) # print(): show NA *or* NaN
-+print( # stopifnot( -- for now, as Lapack is still broken in some OpenBLAS -- FIXME
-+    is.na( print(vapply(nTypes, norm, 0., x = m)) )) # print(): show NA *or* NaN
- ## "F" gave non-NA with LAPACK 3.9.0, before our patch in R-devel and R-patched
- 
- 
diff --git a/nixpkgs/pkgs/applications/science/math/R/skip-check-for-aarch64.patch b/nixpkgs/pkgs/applications/science/math/R/skip-check-for-aarch64.patch
new file mode 100644
index 000000000000..8721bf6b422d
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/math/R/skip-check-for-aarch64.patch
@@ -0,0 +1,11 @@
+diff -ur a/src/library/stats/man/nls.Rd b/src/library/stats/man/nls.Rd
+--- a/src/library/stats/man/nls.Rd   2021-05-21 19:15:02.000000000 -0300
++++ b/src/library/stats/man/nls.Rd   2021-08-12 12:39:00.094758280 -0300
+@@ -287,7 +287,7 @@
+ options(digits = 10) # more accuracy for 'trace'
+ ## IGNORE_RDIFF_BEGIN
+ try(nlm1 <- update(nlmod, control = list(tol = 1e-7))) # where central diff. work here:
+-   (nlm2 <- update(nlmod, control = list(tol = 8e-8, nDcentral=TRUE), trace=TRUE))
++   (nlm2 <- update(nlmod, control = list(tol = 8e-8, nDcentral=TRUE, warnOnly=TRUE), trace=TRUE))
+ ## --> convergence tolerance  4.997e-8 (in 11 iter.)
+ ## IGNORE_RDIFF_END
diff --git a/nixpkgs/pkgs/applications/science/math/colpack/default.nix b/nixpkgs/pkgs/applications/science/math/colpack/default.nix
index f203852c9657..3cc9290a7626 100644
--- a/nixpkgs/pkgs/applications/science/math/colpack/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/colpack/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, gettext }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation rec {
 
@@ -12,20 +12,32 @@ stdenv.mkDerivation rec {
     sha256 = "1p05vry940mrjp6236c0z83yizmw9pk6ly2lb7d8rpb7j9h03glr";
   };
 
-  buildInputs = [ autoconf automake gettext libtool ];
+  nativeBuildInputs = [ autoreconfHook ];
 
-  configurePhase = ''
-    autoreconf -vif
-    ./configure --prefix=$out --enable-openmp
+  configureFlags = [
+    "--enable-openmp=${if stdenv.isLinux then "yes" else "no"}"
+    "--enable-examples=no"
+  ];
+
+  postInstall = ''
+    # Remove libtool archive
+    rm $out/lib/*.la
+
+    # Remove compiled examples (Basic examples get compiled anyway)
+    rm -r $out/examples
+
+    # Copy the example sources (Basic tree contains scripts and object files)
+    mkdir -p $out/share/ColPack/examples/Basic
+    cp SampleDrivers/Basic/*.cpp $out/share/ColPack/examples/Basic
+    cp -r SampleDrivers/Matrix* $out/share/ColPack/examples
   '';
 
   meta = with lib; {
     description = "A package comprising of implementations of algorithms for
     vertex coloring and derivative computation";
     homepage = "http://cscapes.cs.purdue.edu/coloringpage/software.htm#functionalities";
-    license = licenses.lgpl3;
-    platforms = platforms.linux;
+    license = licenses.lgpl3Plus;
+    platforms = platforms.unix;
     maintainers = with maintainers; [ edwtjo ];
   };
-
 }
diff --git a/nixpkgs/pkgs/applications/science/math/ginac/default.nix b/nixpkgs/pkgs/applications/science/math/ginac/default.nix
index 901b9a340fea..78b64d7f587a 100644
--- a/nixpkgs/pkgs/applications/science/math/ginac/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/ginac/default.nix
@@ -1,30 +1,34 @@
 { lib, stdenv, fetchurl, cln, pkg-config, readline, gmp, python3 }:
 
 stdenv.mkDerivation rec {
-  name = "ginac-1.8.0";
+  pname = "ginac";
+  version = "1.8.1";
 
   src = fetchurl {
-    url    = "${meta.homepage}/${name}.tar.bz2";
-    sha256 = "0l9byzfxq3f9az5pcdldnl95ws8mpirkqky46f973mvxi5541d24";
+    url = "https://www.ginac.de/ginac-${version}.tar.bz2";
+    sha256 = "sha256-8WldvWsYcGHvP7pQdkjJ1tukOPczsFjBb5J4y9z14as=";
   };
 
   propagatedBuildInputs = [ cln ];
 
-  buildInputs = [ readline ] ++ lib.optional stdenv.isDarwin gmp;
+  buildInputs = [ readline ]
+    ++ lib.optional stdenv.isDarwin gmp;
 
   nativeBuildInputs = [ pkg-config python3 ];
 
   strictDeps = true;
 
-  preConfigure = "patchShebangs ginsh";
+  preConfigure = ''
+    patchShebangs ginsh
+  '';
 
   configureFlags = [ "--disable-rpath" ];
 
   meta = with lib; {
     description = "GiNaC is Not a CAS";
-    homepage    = "https://www.ginac.de/";
+    homepage = "https://www.ginac.de/";
     maintainers = with maintainers; [ lovek323 ];
     license = licenses.gpl2;
-    platforms   = platforms.all;
+    platforms = platforms.all;
   };
 }
diff --git a/nixpkgs/pkgs/applications/science/math/lp_solve/default.nix b/nixpkgs/pkgs/applications/science/math/lp_solve/default.nix
index f944499af401..876222772e86 100644
--- a/nixpkgs/pkgs/applications/science/math/lp_solve/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/lp_solve/default.nix
@@ -1,40 +1,45 @@
-{ lib, stdenv, fetchurl }:
+{ lib, stdenv, fetchurl, cctools, fixDarwinDylibNames }:
 
 stdenv.mkDerivation rec {
 
   pname = "lp_solve";
-  version = "5.5.2.5";
+  version = "5.5.2.11";
 
   src = fetchurl {
     url = "mirror://sourceforge/project/lpsolve/lpsolve/${version}/lp_solve_${version}_source.tar.gz";
-    sha256 = "12pj1idjz31r7c2mb5w03vy1cmvycvbkx9z29s40qdmkp1i7q6i0";
+    sha256 = "sha256-bUq/9cxqqpM66ObBeiJt8PwLZxxDj2lxXUHQn+gfkC8=";
   };
 
-  patches = [ ./isnan.patch ];
-
-  buildCommand = ''
-    . $stdenv/setup
-    tar xvfz $src
-    (
-    cd lp_solve*
-    eval patchPhase
-    )
-    (
-    cd lp_solve*/lpsolve55
-    bash ccc
-    mkdir -pv $out/lib
-    find bin -type f -exec cp -v "{}" $out/lib \;
-    )
-    (
-    cd lp_solve*/lp_solve
-    bash ccc
-    mkdir -pv $out/bin
-    find bin -type f -exec cp -v "{}" $out/bin \;
-    )
-    (
-    mkdir -pv $out/include
-    cp -v lp_solve*/*.h $out/include
-    )
+  nativeBuildInputs = lib.optionals stdenv.isDarwin [
+    cctools
+    fixDarwinDylibNames
+  ];
+
+  dontConfigure = true;
+
+  buildPhase = let
+    ccc = if stdenv.isDarwin then "ccc.osx" else "ccc";
+  in ''
+    runHook preBuild
+
+    (cd lpsolve55 && bash -x -e ${ccc})
+    (cd lp_solve  && bash -x -e ${ccc})
+
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    install -d -m755 $out/bin $out/lib $out/include/lpsolve
+    install -m755 lp_solve/bin/*/lp_solve -t $out/bin
+    install -m644 lpsolve55/bin/*/liblpsolve* -t $out/lib
+    install -m644 lp_*.h -t $out/include/lpsolve
+
+    rm $out/lib/liblpsolve*.a
+    rm $out/include/lpsolve/lp_solveDLL.h  # A Windows header
+
+    runHook postInstall
   '';
 
   meta = with lib; {
@@ -44,6 +49,4 @@ stdenv.mkDerivation rec {
     maintainers = with maintainers; [ smironov ];
     platforms   = platforms.unix;
   };
-
 }
-
diff --git a/nixpkgs/pkgs/applications/science/math/lp_solve/isnan.patch b/nixpkgs/pkgs/applications/science/math/lp_solve/isnan.patch
deleted file mode 100644
index bc1983d4423d..000000000000
--- a/nixpkgs/pkgs/applications/science/math/lp_solve/isnan.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff -u a/lp_lib.h b/lp_lib.h
---- a/lp_lib.h	2016-05-04 19:45:15.753143720 +0900
-+++ b/lp_lib.h	2016-05-04 19:53:59.536920722 +0900
-@@ -59,9 +59,6 @@
- # if defined _WIN32 && !defined __GNUC__
- #  define isnan _isnan
- # endif
--#if defined NOISNAN
--# define isnan(x) FALSE
--#endif
- 
- #define SETMASK(variable, mask)     variable |= mask
- #define CLEARMASK(variable, mask)   variable &= ~(mask)
diff --git a/nixpkgs/pkgs/applications/science/math/maxima/default.nix b/nixpkgs/pkgs/applications/science/math/maxima/default.nix
index 01f086c92c75..2b82a8f81705 100644
--- a/nixpkgs/pkgs/applications/science/math/maxima/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/maxima/default.nix
@@ -1,14 +1,16 @@
-{ lib, stdenv, fetchurl, fetchpatch, sbcl, texinfo, perl, python, makeWrapper, autoreconfHook
+{ lib, stdenv, fetchurl, fetchpatch, sbcl, texinfo, perl, python3, makeWrapper, autoreconfHook
 , rlwrap ? null, tk ? null, gnuplot ? null, ecl ? null, ecl-fasl ? false
 }:
 
 let
   name    = "maxima";
-  version = "5.44.0";
+  version = "5.45.0";
+
+  lisp-compiler = if ecl-fasl then ecl else sbcl;
 
   searchPath =
     lib.makeBinPath
-      (lib.filter (x: x != null) [ sbcl ecl rlwrap tk gnuplot ]);
+      (lib.filter (x: x != null) [ lisp-compiler rlwrap tk gnuplot ]);
 in
 stdenv.mkDerivation ({
   inherit version;
@@ -16,14 +18,21 @@ stdenv.mkDerivation ({
 
   src = fetchurl {
     url = "mirror://sourceforge/${name}/${name}-${version}.tar.gz";
-    sha256 = "1v6jr5s6hhj6r18gfk6hgxk2qd6z1dxkrjq9ss2z1y6sqi45wgyr";
+    sha256 = "sha256-x2MfMmRIBc67e6/vOrUzHEus0sJ+OE/YgyO1A5pg0Ng=";
   };
 
-  nativeBuildInputs = [ autoreconfHook ];
+  nativeBuildInputs = [
+    autoreconfHook
+    lisp-compiler
+    makeWrapper
+    python3
+    texinfo
+  ];
+
+  strictDeps = true;
 
-  buildInputs = lib.filter (x: x != null) [
-    sbcl ecl texinfo perl python makeWrapper
-    gnuplot   # required in the test suite
+  checkInputs = [
+    gnuplot
   ];
 
   postPatch = ''
diff --git a/nixpkgs/pkgs/applications/science/math/nasc/default.nix b/nixpkgs/pkgs/applications/science/math/nasc/default.nix
index b55e4047fe47..431668f0c583 100644
--- a/nixpkgs/pkgs/applications/science/math/nasc/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/nasc/default.nix
@@ -21,26 +21,16 @@
 
 stdenv.mkDerivation rec {
   pname = "nasc";
-  version = "0.7.5";
+  version = "0.8.0";
 
   src = fetchFromGitHub {
     owner = "parnold-x";
     repo = pname;
     rev = version;
-    sha256 = "kSRc5RLkI6SBJirUYw6swZi8IJhaL3y74b2Zw8kh2XA=";
+    sha256 = "02b9a59a9fzsb6nn3ycwwbcbv04qfzm6x7csq2addpzx5wak6dd8";
     fetchSubmodules = true;
   };
 
-  patches = [
-    # fix compilation with gcc10
-    (fetchpatch {
-      url = "https://github.com/parnold-x/libqalculate/commit/4fa8f2cceada128ef19f82407226b2c230b780d5.patch";
-      extraPrefix = "subprojects/libqalculate/";
-      stripLen = "1";
-      sha256 = "0kbff623zl0s6yx5avx068f2apwzxzvihjahja4qhlkqkhhzj9dm";
-    })
-  ];
-
   nativeBuildInputs = [
     glib # post_install.py
     gtk3 # post_install.py
diff --git a/nixpkgs/pkgs/applications/science/math/nauty/default.nix b/nixpkgs/pkgs/applications/science/math/nauty/default.nix
index a941a6334508..c435c63ab2ef 100644
--- a/nixpkgs/pkgs/applications/science/math/nauty/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/nauty/default.nix
@@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
   pname = "nauty";
   version = "27r1";
   src = fetchurl {
-    url = "http://pallini.di.uniroma1.it/nauty${version}.tar.gz";
+    url = "https://pallini.di.uniroma1.it/nauty${version}.tar.gz";
     sha256 = "0xsfqfcknbd6g6wzpa5l7crmmk3bf3zjh37rhylq6b20dqcmvjkn";
   };
   outputs = [ "out" "dev" ];
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
     # I'm not sure if the filename will remain the same for future changelog or
     # if it will track changes to minor releases. Lets see. Better than nothing
     # in any case.
-    changelog = "http://pallini.di.uniroma1.it/changes24-27.txt";
-    homepage = "http://pallini.di.uniroma1.it/";
+    changelog = "https://pallini.di.uniroma1.it/changes24-27.txt";
+    homepage = "https://pallini.di.uniroma1.it/";
   };
 }
diff --git a/nixpkgs/pkgs/applications/science/math/polymake/default.nix b/nixpkgs/pkgs/applications/science/math/polymake/default.nix
index b1abb31c7650..9566801479a3 100644
--- a/nixpkgs/pkgs/applications/science/math/polymake/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/polymake/default.nix
@@ -1,27 +1,32 @@
 { lib, stdenv, fetchurl
-, ninja, libxml2, libxslt, readline, perl, gmp, mpfr, boost
+, perl, gmp, mpfr, flint, boost
 , bliss, ppl, singular, cddlib, lrs, nauty
-, ant, openjdk
+, ninja, ant, openjdk
 , perlPackages
 , makeWrapper
 }:
 
+# polymake compiles its own version of sympol and atint because we
+# don't have those packages. other missing optional dependencies:
+# javaview, libnormaliz, scip, soplex, jreality.
+
 stdenv.mkDerivation rec {
   pname = "polymake";
-  version = "3.2.rc4";
+  version = "4.4";
 
   src = fetchurl {
-    url = "https://polymake.org/lib/exe/fetch.php/download/polymake-3.2r4.tar.bz2";
-    sha256 = "02jpkvy1cc6kc23vkn7nkndzr40fq1gkb3v257bwyi1h5d37fyqy";
+    # "The minimal version is a packager friendly version which omits
+    # the bundled sources of cdd, lrs, libnormaliz, nauty and jReality."
+    url = "https://polymake.org/lib/exe/fetch.php/download/polymake-${version}-minimal.tar.bz2";
+    sha256 = "sha256-2nF5F2xznI77pl2TslrxA8HLpw4fmzVnPOM8N3kOwJE=";
   };
 
   buildInputs = [
-    libxml2 libxslt readline perl gmp mpfr boost
+    perl gmp mpfr flint boost
     bliss ppl singular cddlib lrs nauty
     openjdk
-  ] ++
-  (with perlPackages; [
-    XMLLibXML XMLLibXSLT XMLWriter TermReadLineGnu TermReadKey
+  ] ++ (with perlPackages; [
+    JSON TermReadLineGnu TermReadKey XMLSAX
   ]);
 
   nativeBuildInputs = [
@@ -36,11 +41,11 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  meta = {
+  meta = with lib; {
     description = "Software for research in polyhedral geometry";
-    license = lib.licenses.gpl2 ;
-    maintainers = [lib.maintainers.raskin];
-    platforms = lib.platforms.linux;
+    license = licenses.gpl2Plus;
+    maintainers = teams.sage.members;
+    platforms = platforms.linux;
     homepage = "https://www.polymake.org/doku.php";
   };
 }
diff --git a/nixpkgs/pkgs/applications/science/math/pynac/default.nix b/nixpkgs/pkgs/applications/science/math/pynac/default.nix
index 138c97d73be1..88515b92beaf 100644
--- a/nixpkgs/pkgs/applications/science/math/pynac/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/pynac/default.nix
@@ -1,4 +1,5 @@
 { lib, stdenv
+, fetchpatch
 , fetchFromGitHub
 , autoreconfHook
 , pkg-config
@@ -20,6 +21,16 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-ocR7emXtKs+Xe2f6dh4xEDAacgiolY8mtlLnWnNBS8A=";
   };
 
+  patches = [
+    # the patch below is included in sage 9.4 and should be included
+    # in a future pynac release. see https://trac.sagemath.org/ticket/28357
+    (fetchpatch {
+      name = "realpartloop.patch";
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/pynac/patches/realpartloop.patch?h=9.4.beta5";
+      sha256 = "sha256-1nj0xtlFN5fZKEiRLD+tiW/ZtxMQre1ziEGA0OVUGE4=";
+    })
+  ];
+
   buildInputs = [
     flint
     gmp
diff --git a/nixpkgs/pkgs/applications/science/math/qalculate-gtk/default.nix b/nixpkgs/pkgs/applications/science/math/qalculate-gtk/default.nix
index 7807ae613e8c..bc192fe4218b 100644
--- a/nixpkgs/pkgs/applications/science/math/qalculate-gtk/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/qalculate-gtk/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "qalculate-gtk";
-  version = "3.19.0";
+  version = "3.20.1";
 
   src = fetchFromGitHub {
     owner = "qalculate";
     repo = "qalculate-gtk";
     rev = "v${version}";
-    sha256 = "1nrx7gp6f1yalbdda1gb97azhbr4xclq2xf08vvbvsk8jfd6fd2v";
+    sha256 = "sha256-GTOdJ4dxR491WU6WM47xLHO7RGUGXkdHuQIDxJvVvFE=";
   };
 
   hardeningDisable = [ "format" ];
diff --git a/nixpkgs/pkgs/applications/science/math/sage/default.nix b/nixpkgs/pkgs/applications/science/math/sage/default.nix
index e39db4b1ac2d..b7821db1f9a7 100644
--- a/nixpkgs/pkgs/applications/science/math/sage/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/sage/default.nix
@@ -38,8 +38,8 @@ let
     ];
     language = "sagemath";
     # just one 16x16 logo is available
-    logo32 = "${sage-src}/doc/common/themes/sage/static/sageicon.png";
-    logo64 = "${sage-src}/doc/common/themes/sage/static/sageicon.png";
+    logo32 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png";
+    logo64 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png";
   };
 
   three = callPackage ./threejs-sage.nix { };
diff --git a/nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch b/nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch
index 0dbfba642e82..178cef3e54ea 100644
--- a/nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch
+++ b/nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch
@@ -1,8 +1,8 @@
 diff --git a/src/sage/env.py b/src/sage/env.py
-index 2908f5d04f..81dfd75c0d 100644
+index 95980cc2df..37107a30e1 100644
 --- a/src/sage/env.py
 +++ b/src/sage/env.py
-@@ -218,93 +218,12 @@ NTL_LIBDIR = var("NTL_LIBDIR")
+@@ -227,93 +227,12 @@ OPENMP_CXXFLAGS = var("OPENMP_CXXFLAGS", "")
  SAGE_BANNER = var("SAGE_BANNER", "")
  SAGE_IMPORTALL = var("SAGE_IMPORTALL", "yes")
  
@@ -51,10 +51,9 @@ index 2908f5d04f..81dfd75c0d 100644
 -        if sys.platform == 'cygwin':
 -            # Later down we take the first matching DLL found, so search
 -            # SAGE_LOCAL first so that it takes precedence
--            search_directories = [
--                Path(SAGE_LOCAL) / 'bin',
--                Path(sysconfig.get_config_var('BINDIR')),
--            ]
+-            if SAGE_LOCAL:
+-                search_directories.append(Path(SAGE_LOCAL) / 'bin')
+-            search_directories.append(Path(sysconfig.get_config_var('BINDIR')))
 -            # Note: The following is not very robust, since if there are multible
 -            # versions for the same library this just selects one more or less
 -            # at arbitrary. However, practically speaking, on Cygwin, there
@@ -66,14 +65,15 @@ index 2908f5d04f..81dfd75c0d 100644
 -            else:
 -                ext = 'so'
 -
--            search_directories = [Path(SAGE_LOCAL) / 'lib']
+-            if SAGE_LOCAL:
+-                search_directories.append(Path(SAGE_LOCAL) / 'lib')
 -            libdir = sysconfig.get_config_var('LIBDIR')
 -            if libdir is not None:
 -                libdir = Path(libdir)
 -                search_directories.append(libdir)
 -
 -                multiarchlib = sysconfig.get_config_var('MULTIARCH')
--                if multiarchlib is not None: 
+-                if multiarchlib is not None:
 -                    search_directories.append(libdir / multiarchlib),
 -
 -            patterns = [f'lib{libname}.{ext}']
@@ -97,4 +97,4 @@ index 2908f5d04f..81dfd75c0d 100644
 +GAP_SO = var("GAP_SO", '/default')
  
  # post process
- if ' ' in DOT_SAGE:
+ if DOT_SAGE is not None and ' ' in DOT_SAGE:
diff --git a/nixpkgs/pkgs/applications/science/math/sage/patches/ignore-cmp-deprecation.patch b/nixpkgs/pkgs/applications/science/math/sage/patches/ignore-cmp-deprecation.patch
deleted file mode 100644
index a91ee319b8f0..000000000000
--- a/nixpkgs/pkgs/applications/science/math/sage/patches/ignore-cmp-deprecation.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py
-index 6e034dcb5a..8ec60ec72b 100644
---- a/src/sage/tests/cmdline.py
-+++ b/src/sage/tests/cmdline.py
-@@ -660,8 +660,8 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False
-         sage: with open(input, 'w') as F:
-         ....:     _ = F.write(s)
-         sage: L = ["sage", "--rst2ipynb", input, output]
--        sage: test_executable(L)                              # optional - rst2ipynb
--        ('', '', 0)
-+        sage: test_executable(L)[2]                           # optional - rst2ipynb
-+        0
-         sage: import json                                     # optional - rst2ipynb
-         sage: d = json.load(open(output,'r'))                 # optional - rst2ipynb
-         sage: type(d)                                         # optional - rst2ipynb
-@@ -757,8 +757,6 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False
-         ///
-         4
-         }}}
--        sage: err # py2 # optional -- sagenb
--        ''
-         sage: ret # py2 # optional -- sagenb
-         0
- 
diff --git a/nixpkgs/pkgs/applications/science/math/sage/sage-src.nix b/nixpkgs/pkgs/applications/science/math/sage/sage-src.nix
index 218ab920a872..3ba21cf6c8be 100644
--- a/nixpkgs/pkgs/applications/science/math/sage/sage-src.nix
+++ b/nixpkgs/pkgs/applications/science/math/sage/sage-src.nix
@@ -13,30 +13,52 @@ let
   # Fetch a diff between `base` and `rev` on sage's git server.
   # Used to fetch trac tickets by setting the `base` to the last release and the
   # `rev` to the last commit of the ticket.
-  fetchSageDiff = { base, name, rev, sha256, ...}@args: (
+  fetchSageDiff = { base, name, rev, sha256, squashed ? false, ...}@args: (
     fetchpatch ({
       inherit name sha256;
 
-      # We used to use
-      # "https://git.sagemath.org/sage.git/patch?id2=${base}&id=${rev}"
-      # but the former way does not squash multiple patches together.
-      url = "https://github.com/sagemath/sage/compare/${base}...${rev}.diff";
+      # There are three places to get changes from:
+      #
+      # 1) From Sage's Trac. Contains all release tags (like "9.4") and all developer
+      # branches (wip patches from tickets), but exports each commit as a separate
+      # patch, so merge commits can lead to conflicts. Used if squashed == false.
+      #
+      # 2) From GitHub's sagemath/sage repo. This lets us use a GH feature that allows
+      # us to choose between a .patch file, with one patch per commit, or a .diff file,
+      # which squashes all commits into a single diff. This is used if squashed ==
+      # true. This repo has all release tags. However, it has no developer branches, so
+      # this option can't be used if a change wasn't yet shipped in a (possibly beta)
+      # release.
+      #
+      # 3) From GitHub's sagemath/sagetrac-mirror repo. Mirrors all developer branches,
+      # but has no release tags. The only use case not covered by 1 or 2 is when we need
+      # to apply a patch from an open ticket that contains merge commits.
+      #
+      # Item 3 could cover all use cases if the sagemath/sagetrack-mirror repo had
+      # release tags, but it requires a sha instead of a release number in "base", which
+      # is inconvenient.
+      urls = if squashed
+             then [
+               "https://github.com/sagemath/sage/compare/${base}...${rev}.diff"
+               "https://github.com/sagemath/sagetrac-mirror/compare/${base}...${rev}.diff"
+             ]
+             else [ "https://git.sagemath.org/sage.git/patch?id2=${base}&id=${rev}" ];
 
       # We don't care about sage's own build system (which builds all its dependencies).
       # Exclude build system changes to avoid conflicts.
       excludes = [ "build/*" ];
-    } // builtins.removeAttrs args [ "rev" "base" "sha256" ])
+    } // builtins.removeAttrs args [ "rev" "base" "sha256" "squashed" ])
   );
 in
 stdenv.mkDerivation rec {
-  version = "9.3";
+  version = "9.4";
   pname = "sage-src";
 
   src = fetchFromGitHub {
     owner = "sagemath";
     repo = "sage";
     rev = version;
-    sha256 = "sha256-l9DX8jcDdKA7GJ6xU+nBsmlZxrcZ9ZUAJju621ooBEo=";
+    sha256 = "sha256-jqkr4meG02KbTCMsGvyr1UbosS4ZuUJhPXU/InuS+9A=";
   };
 
   # Patches needed because of particularities of nix or the way this is packaged.
@@ -77,63 +99,16 @@ stdenv.mkDerivation rec {
   # be empty since dependencies update all the time.
   packageUpgradePatches = [
     # After updating smypow to (https://trac.sagemath.org/ticket/3360) we can
-    # now set the cache dir to be withing the .sage directory. This is not
+    # now set the cache dir to be within the .sage directory. This is not
     # strictly necessary, but keeps us from littering in the user's HOME.
     ./patches/sympow-cache.patch
 
-    # ignore a deprecation warning for usage of `cmp` in the attrs library in the doctests
-    ./patches/ignore-cmp-deprecation.patch
-
-    # remove use of matplotlib function deprecated in 3.4
-    # https://trac.sagemath.org/ticket/31827
-    (fetchSageDiff {
-      base = "9.3";
-      name = "remove-matplotlib-deprecated-function.patch";
-      rev = "32b2bcaefddc4fa3d2aee6fa690ce1466cbb5948";
-      sha256 = "sha256-SXcUGBMOoE9HpuBzgKC3P6cUmM5MiktXbe/7dVdrfWo=";
-    })
-
-    # pari 2.13 update
-    # https://trac.sagemath.org/ticket/30801
-    #
-    # the last commit in that ticket is
-    # c78b1470fccd915e2fa93f95f2fefba6220fb1f7, but commits after
-    # 10a4531721d2700fd717e2b3a1364508ffd971c3 only deal with 32-bit
-    # and post-26635 breakage, none of which is relevant to us. since
-    # there are post-9.4.beta0 rebases after that, we just skip later
-    # commits.
-    (fetchSageDiff {
-      base = "9.3";
-      name = "pari-2.13.1.patch";
-      rev = "10a4531721d2700fd717e2b3a1364508ffd971c3";
-      sha256 = "sha256-gffWKK9CMREaNOb5zb63iZUgON4FvsPrMQNqe+5ZU9E=";
-    })
-
-    # sympy 1.8 update
-    # https://trac.sagemath.org/ticket/31647
-    (fetchSageDiff {
-      base = "9.4.beta0";
-      name = "sympy-1.8.patch";
-      rev = "fa864b36e15696450c36d54215b1e68183b29d25";
-      sha256 = "sha256-fj/9QEZlVF0fw9NpWflkTuBSKpGjCE6b96ECBgdn77o=";
-    })
-
-    # sphinx 4 update
-    # https://trac.sagemath.org/ticket/31696
-    (fetchSageDiff {
-      base = "9.4.beta3";
-      name = "sphinx-4.patch";
-      rev = "bc84af8c795b7da433d2000afc3626ee65ba28b8";
-      sha256 = "sha256-5Kvs9jarC8xRIU1rdmvIWxQLC25ehiTLJpg5skh8WNM=";
-    })
-
-    # eclib 20210625 update
-    # https://trac.sagemath.org/ticket/31443
+    # https://trac.sagemath.org/ticket/32305
     (fetchSageDiff {
-      base = "9.4.beta3";
-      name = "eclib-20210625.patch";
-      rev = "789550ca04c94acfb1e803251538996a34962038";
-      sha256 = "sha256-VlyEn5hg3joG8t/GwiRfq9TzJ54AoHxLolsNQ3shc2c=";
+      base = "9.4";
+      name = "networkx-2.6-upgrade.patch";
+      rev = "9808325853ba9eb035115e5b056305a1c9d362a0";
+      sha256 = "sha256-gJSqycCtbAVr5qnVEbHFUvIuTOvaxFIeffpzd6nH4DE=";
     })
   ];
 
diff --git a/nixpkgs/pkgs/applications/science/math/sage/sagelib.nix b/nixpkgs/pkgs/applications/science/math/sage/sagelib.nix
index f60cb64d2e8d..b9c98ed64d01 100644
--- a/nixpkgs/pkgs/applications/science/math/sage/sagelib.nix
+++ b/nixpkgs/pkgs/applications/science/math/sage/sagelib.nix
@@ -27,6 +27,7 @@
 , linbox
 , m4ri
 , m4rie
+, memory-allocator
 , libmpc
 , mpfi
 , ntl
@@ -107,6 +108,7 @@ buildPythonPackage rec {
     lrcalc
     m4ri
     m4rie
+    memory-allocator
     mpfi
     ntl
     blas
diff --git a/nixpkgs/pkgs/applications/science/math/scilab-bin/default.nix b/nixpkgs/pkgs/applications/science/math/scilab-bin/default.nix
index f9abdee2d148..5dea2c7653aa 100644
--- a/nixpkgs/pkgs/applications/science/math/scilab-bin/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/scilab-bin/default.nix
@@ -39,8 +39,6 @@ stdenv.mkDerivation {
     xorg.libXxf86vm
   ];
 
-  phases = [ "unpackPhase" "fixupPhase" "installPhase" ];
-
   fixupPhase = ''
     sed -i 's|\$(/bin/|$(|g' bin/scilab
     sed -i 's|/usr/bin/||g' bin/scilab
diff --git a/nixpkgs/pkgs/applications/science/math/wxmaxima/default.nix b/nixpkgs/pkgs/applications/science/math/wxmaxima/default.nix
index 94e675d7dd44..2205e96383a4 100644
--- a/nixpkgs/pkgs/applications/science/math/wxmaxima/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/wxmaxima/default.nix
@@ -4,13 +4,13 @@
 
 stdenv.mkDerivation rec {
   pname = "wxmaxima";
-  version = "21.02.0";
+  version = "21.05.2";
 
   src = fetchFromGitHub {
     owner = "wxMaxima-developers";
     repo = "wxmaxima";
     rev = "Version-${version}";
-    sha256 = "sha256-5nvaaKsvSEs7QxOszjDK1Xkana2er1BCMZ83b1JZSqc=";
+    sha256 = "sha256-HPqdxGrPxe5FZNOimTpAP+c9VpDBkXu3Z1c1Aaf3+UA=";
   };
 
   buildInputs = [ wxGTK maxima gnome.adwaita-icon-theme ];