I am struggling to create a continuous density curve in R for the below pdf:
{ 3x(1-x)^2 0 < x < 1
f(x) = { 3(2-x)(1-x)^2 1 ≤ x < 2
{ 0 otherwise
Using the curve function, I can plot the two functions separately but not together:
curve(3*x*(1-x)^2,0,1)
curve(3*(2-x)*(1-x)^2,1,2)
Any help would be appreciated?