Publications by Stéphane Laurent

Gröbner implicitization and the ‘giacR’ package

18.07.2023

I considerably improved the computation of the Gröbner bases in the qspray package, and I implemented something new: Gröbner implicitization. The Gröbner implicitization is able to transform a system of parametric equations to an implicit equation. Let’s see the example of the ellipse: library(qspray) #...

1713 sym R (906 sym/3 pcs)

Gröbner bases are in ‘qspray’

13.07.2023

There is something new in the qspray package: Gröbner bases. Gröbner bases have many applications, and we will see one of them now. My package qspray deals with multivariate polynomials with rational coefficients. Consider the following system of three polynomial equations: \[\begin{align} x^2 + y + z & = 1 \\ x + y^2 + ...

4299 sym R (1239 sym/7 pcs)

Another Hopf torus

11.07.2023

Recall that a Hopf torus is a two-dimensional object in the 4D space defined by a profile curve: a closed curve on the unit sphere. When mapping it to the 3D space with the stereographic projection, we can obtain a beautiful object, or an ugly one, depending on the choice of the profile curve. Here, we will see the ...

2845 sym R (2836 sym/5 pcs) 6 img

The Doyle spiral with R

07.07.2023

I translated to R the JavaScipt code for the Doyle spiral written by Robin Houston and kindly provided in this gist. library(rootSolve) # for the function multiroot library(plotrix) # for the function draw.circle d_ <- function(z, t, p, q) { w <- z^(p/q) s <- (p*t + 2*pi)/q (z*cos(t) - w*cos(s))^2 + (z*sin(t) - w*sin(s))^2...

846 sym R (3807 sym/2 pcs) 6 img

Fast expansion of a polynomial with R – part 2

04.07.2023

In the previous post, I showed how to expand a polynomial with symbolic parameters with the help of the spray package. As I said, it has one problem: it doesn’t preserve the rational numbers in the polynomial expression. I’m going to provide a solution here which overcomes this problem, with the ...

2690 sym R (2477 sym/8 pcs) 2 img

Fast expansion of a polynomial with R

03.07.2023

In this previous post, this previous post, and this previous post, I showed how to expand a polynomial with symbolic parameters. In the first two posts, I used the R package caracas, a wrapper of SymPy, and in the third post I used Julia. Now I’ve found a pure R solution, with the help of the ...

1629 sym R (12599 sym/7 pcs)

Maximum volume inscribed ellipsoid

19.05.2023

I’ve just discovered the excellent book Convex Optimization written by Stephen Boyd and Lieven Vandenberghe. It gives methods for many interesting geometric problems. In this blog post I will construct the maximum volume ellipsoid inscribed in a convex polyhedron. Let’s take the vertices of a convex pol...

2204 sym R (2128 sym/7 pcs) 6 img

Tooltips for a dropdown list in Shiny

12.05.2023

Here is how to have some tooltips for the options and their headers of a selectizeInput in Shiny. library(shiny) ui <- fluidPage( selectizeInput( inputId = "selectAnimals", label = "Select some animals", choices = NULL, multiple = TRUE, options = list( options = list( list( species = "mammal",...

869 sym R (2993 sym/2 pcs) 2 img

Fisheye effect with R

28.04.2023

The fisheye function below distorts a bitmap image with a fisheye effect or an anti-fisheye effect (rho > 0.5 or rho < 0.5). fisheye_xy <- function(x, y, rho, stick) { p <- c(x, y) if(rho == 0.5) { return(p) } m <- c(0.5, 0.5) d <- p - m r <- sqrt(c(crossprod(d))) dnormalized <- d / r mnorm <- sqrt(c(cro...

1625 sym R (3761 sym/7 pcs) 12 img

Heatmap formatting of a table with ‘DT’

07.04.2023

Googling “heatmap format excel” returns a lot of results. Here we will see how to do a heatmap formatting with a DT table in R. The dataset we use provides the average monthly temperatures over a year for some cities in USA. It is available in a CSV file here. The table is in long format. Below ...

1720 sym R (3720 sym/8 pcs) 2 img