Site icon R-bloggers

Maths can be cool (to impress your kids)

[This article was first published on Freakonometrics - Tag - R-english, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Just imagine that your kids need some help, to prepare fishes for April 1st, like

Her: “please, Daddy, help us to draw some fishes

Me: “Sure, Daddy is a champion, actually, I do that everyday at work: drawing fishes – and more generally nice stuff – is exactly Daddy’s job“.

OK, no need to talk neither about Talbot’s curves, ellipse negative pedal curve nor Burleigh’s ovals, unless you don’t want to scare them, e.g.

t=seq(0,2*pi,length=100) 
b=.8
c=sqrt(1-b^2)
x=cos(t)-c*sin(t)^2
y=(1-2*c^2+c*cos(t))*sin(t)/b
plot(x,y)

From now on, it is rather simple to draw fishes,

t=seq(0,2*pi,length=100)
y=cos(t)-sin(t)^2/sqrt(2)
x=cos(t)*sin(t)
plot(x,y,type="l",axes=FALSE,xlab="",ylab="")
polygon(c(-2,-2,2,2),
c(-2,2,2,-2),col="light blue",border=NA)
polygon(x,y,col="red",border=NA)
axis(1)
axis(2)
lines(x,y,type="l")

so we can easily get nice fishes,

To leave a comment for the author, please follow the link and comment on their blog: Freakonometrics - Tag - R-english.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.