Skip to content

Instantly share code, notes, and snippets.

library(ggplot2)
model <- function(phi, theta){
yl35m27 = Re(-exp(27i*phi)*sin(theta)^27*(180297*cos(theta)^8 - 73164*cos(theta)^6 + 8190*cos(theta)^4 - 252*cos(theta)^2 + 1))
yl12mm7 = Re((exp(-7i* phi)* sin(theta)^7* cos(theta)* (161 *cos(theta)^4 - 70* cos(theta)^2 + 5)))
yl12m0 = Re(5 *(676039* cos(theta)^12 - 1939938 * cos(theta)^10 + 2078505 * cos(theta)^8 - 1021020 * cos(theta)^6 + 225225 * cos(theta)^4 - 18018 * cos(theta)^2 + 231)/2000)
eq <- r"($\displaystyle\sigma_\mathrm{abs} = \frac{2\pi}{n\lambda |\mathbf{E_0}|^2}\int_0^{2\pi}\int_0^{\pi}\int_{r_1}^{r_2}\varepsilon''|\mathbf{E}|^2 r^2\sin\theta\,\mathrm{d}r\mathrm{d}\theta\mathrm{d}\varphi$)"
library(glue)
library(grImport2)
library(grid)
latex <- function(s){
tmp <- tempfile(tmpdir = '.')
doc <- glue('\\documentclass[border=5pt]{minimal}\\begin{document}<s>\\end{document}',
@baptiste
baptiste / Progress-Pride-Flag-Daniel-Quasar_vector.svg
Last active June 17, 2020 08:43
Progress-Pride-Flag-Daniel-Quasar_vector
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
m <- matrix(c(0,1), nrow = 600, ncol=800)
lm <- replicate(100, jitter(m, 20), simplify = FALSE)
library(Cairo)
CairoX11()
plot.new()
system.time({
## visualising some spherical harmonics on a sphere
## with 3d interactive plot
## Ylm is a scalar field defined at surface points
## E is a vector field defined at those points
library(rgl)
library(dplyr)
library(RColorBrewer)
library(chipmunkbasic)
library(chipmunkcore)
library(ggplot2)
N <- 2
cm <- Chipmunk$new(time_step = 0.005)
cm$add_static_segment(-70, 0, 120, 0, friction = 0, elasticity = 1)
cm$add_static_segment(-70, 0, -70, 30, friction = 0, elasticity = 1)
library(gridExtra)
library(grid)
N <- 15
N2 <- 8
d <- matrix(sample(seq(1,N2,by=2)^2, N^2,replace = T),N,N)
myfun <- function(label, ...){
i <- as.numeric(label)
n <- sqrt(i)
arrangeGrob(grobs=replicate(i, rectGrob(gp=gpar(fill=grey(runif(1,0.5+0.2*n/N2,0.9-0.2*n/N2)),col='white', lwd=1)),
library(vwline)
library(gridGeometry)
library(hershey)
library(ggplot2)
library(scales)
w <- c(0, .2, 0)
gl <- list()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.