MyNixOS website logo
Description
Interface to the Computer Algebra System 'Giac'
'Giac' <https://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/en/cascmd_en/cascmd_en.html> is a general purpose symbolic algebra software. It powers the graphical interface 'Xcas'. This package allows to execute 'Giac' commands in 'R'.

The ‘giacR’ package

R interface to ‘Giac’

R-CMD-check


Giac is a general purpose symbolic algebra software. It powers the graphical interface Xcas. This package allows to execute Giac commands in R. You can find the documentation of Giac here.

Installation

remotes::install_github("rstudio/chromote")
remotes::install_github("stla/giacR")

Initialisation of a Giac session

The ‘chromote’ package is used to create a Giac session. If the find_chrome() function of ‘chromote’ returns NULL, you can set the path to the Chrome executable (or Chromium, Brave, etc) to the environment variable CHROMOTE_CHROME. Or you can pass it to the the Giac$new function. Since the Chrome executable is in my system path, I can use Sys.which("chrome").

library(giacR)
giac <- Giac$new(Sys.which("chrome"))

Examples

Elementary calculus

giac$execute("2 + 3/7")
## [1] "17/7=2.42857142857"

Gröbner basis

giac$execute("gbasis([x^3 - 2*x*y, x^2*y - 2*y^2 + x], [x, y])")
## [1] "[x^2,x*y,2*y^2-x]"

Antiderivative

giac$execute("integrate(ln(x))")
## [1] "x*ln(x)-x"

Infinite sum

giac$execute("sum(1/(n^2), n, 1, +(infinity))")
## [1] "1/6*pi^2=1.64493406685"

Exact rational roots of a polynomial

giac$execute("crationalroot(2*x^3 - 3*x^2 + 8*x - 12)")
## [1] "[2*i,3/2,-2*i]"

Solve a system of equations (and simplify the solutions)

giac$execute(
  "apply(simplify, solve([x^2+y+z=1, x+y^2+z=1, x+y+z^2=1], [x, y, z]))"
)
## [1] "list[[0,1,0],[1,0,0],[0,0,1],[sqrt(2)-1,sqrt(2)-1,sqrt(2)-1],[-sqrt(2)-1,-sqrt(2)-1,-sqrt(2)-1]]"

Determinant of a matrix with symbolic entries

giac$execute("det([[1, 2, 3], [3/4, a, b], [c, 4, 5]])")
## [1] "(-6*a*c+10*a+4*b*c-8*b+3)/2"

Check whether a variable occurs in an expression

giac$execute("has(x*y + u^2*z, u)")
## [1] "3"
giac$execute("has(x*y + u^2*z, w)")
## [1] "0"

Close session

giac$close()
## [1] TRUE

Blog posts

Metadata

Version

1.0.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows