Publications by Stéphane Laurent

The lazy numbers in R: correction

14.11.2022

Because of a change I did in the lazyNumbers package, I have to post a correction to my previous post. The as.double function, called on a lazy number, was not stable. Now it is. In the previous post, the following equality was true: library(lazyNumbers) x <- 1 - lazynb(7) * 0.1 as.double(x) == 0....

1208 sym R (257 sym/3 pcs)

The lazy numbers in R

11.11.2022

My new package lazyNumbers is a port of the lazy numbers implemented in the C++ library CGAL. The lazy numbers represent the real numbers and arithmetic on these numbers is exact. The ordinary floating-point arithmetic is not exact. Consider for example the simple operation \(1 – ...

2636 sym R (1024 sym/7 pcs)

Exact integral of a polynomial on a simplex

01.12.2022

The paper Simple formula for integration of polynomials on a simplex by Jean B. Lasserre provides a method to calculate the exact value of the integral of a multivariate polynomial on a simplex (i.e. a tetrahedron in dimension three). I implemented it in Julia, Python, and R. Integration o...

1741 sym R (3484 sym/9 pcs)

A note on Shiny reactivity

23.09.2022

In the ‘shiny’ package, the reactiveConsole function allows to enable reactivity at the console, for the purposes of experimentation and learning (that doesn’t work in a R Markdown document). library(shiny) reactiveConsole(TRUE) So let’s play with the Shiny reactivity, without a Shiny app. The code below...

1735 sym R (928 sym/6 pcs)

The missing lazy numbers: implementation

18.11.2022

In Haskell, for any type T (for example Double), there is a corresponding type Maybe T. An object of this type either has form Just x, where x is of type T, or is Nothing. Thus one can use the Maybe T type to extend the type T to a type allowing missing values. One can test whether a Maybe T...

2337 sym R (919 sym/5 pcs)

HTML widgets in Power BI

23.11.2022

Setting up an environment Example Notes Advanced example Arbitrary HTML Using multiple datasets Limiting the number of selected columns Combining widgets Prevent removal of duplicated rows Adding formatting objects Restricting a number input to a range It is possible to include a htmlwidget in a Power BI report, such as...

10333 sym R (11274 sym/30 pcs) 14 img

Labelling the points of a ‘ggplot’ with Shiny

07.08.2022

The Shiny app below allows to attribute a label to the points of a ‘ggplot’ by double-clicking on the points. library(shiny) library(rhandsontable) library(htmlwidgets) library(colourpicker) library(ggplot2) library(ggrepel) #' Add labels to points on a ggplot2 scatterplot #' @param gg the ggplot #' @param X name of the x-va...

541 sym R (4135 sym/1 pcs) 2 img

Kantorovich distance with the ‘ompr’ package

11.09.2022

Do you know my former blog? It contains four posts about the computation of the Kantorovich distance: Using Julia to compute the Kantorovich distance Using R to compute the Kantorovich distance Using Scala to compute the Kantorovich distance The ‘kantorovich’ package for R The Julia way using the J...

2003 sym R (948 sym/6 pcs)

The compound of five tetrahedra

09.09.2022

In this previous post I was wrong when I said I didn’t have a tool to compute the intersection of the compound of five tetrahedra: This can be achieved with the help of the rcdd package in R. This package is a wrapper of the C library cddlib. It implements the double description ...

3745 sym R (6194 sym/13 pcs) 4 img

The ‘Reorient’ transformation

14.09.2022

If you follow my youtube channel then you have certainly seen the “ball” of twenty Hopf tori. Sometimes I call it the “Hopf flower”. How is it done? Well, firstly, I take twenty points on a ball: the twenty vertices of the compound of five tetrahedra. Then, I construct one Hopf toru...

2200 sym R (4526 sym/7 pcs) 10 img