Wednesday, 5 December 2018

Solving ODEs in R

Solving ODEs in R
> par(mfrow=c(1,2))
>
> plot(rnorm(100), main = "Graph 1", ylab = "Normal distribution")
> grid()

>
> legend(x = 40, y = -1, legend = "A legend")
> plot(rnorm(100), main = "Graph 2", type = "l")
> abline(v = 50)
>
> set.seed(656)
> x = c(rnorm(150, 0, 1), rnorm(150,9,1), rnorm(150,4.5,1))
>
> y = c(rnorm(150, 0, 1), rnorm(150,0,1), rnorm(150,5,1))
> XYdf = data.frame(x,y)
> plot(XYdf, pch=20)
> XY_sing = hclust(dist(XYdf), method="single")
>
> XYs3 = cutree(XY_sing,k=3)
>
> table(XYs3)
XYs3
  1   2   3
448   1   1
> XYs6 = cutree(XY_sing,k=6)
>
> table(XYs6)
XYs6
  1   2   3   4   5   6
148 150   1 149   1   1
>
> plot(XYdf, pch=20, col=XYs6)

No comments:

Post a comment

Intersection of subring

How to prove the intersection of two subrings is a subring? Let S1 and S2  be two subrings of a ring R. Then S1∩S2 is not empty since ...