Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #lavet af steven
- lastvol = 0
- grænse = 1005
- f = function(x){ #f(x)
- y <- (-x^2+20*x)^(1/2)
- return(y)
- }
- t = function(x){ #f'(x)
- y <- 1/(2*(-x^2+20*x)^(1/2))*(-2*x+20)
- return(y)
- }
- p = function(x){ #f(x)
- y <- f(x)*(1+t(x)^2)^(1/2)
- return(y)
- }
- h = seq(15.99, 20, 0.000001)
- for(i in 1:length(h)){
- vol = (integrate(p, 0, h[i]))
- vol = vol$value*2*pi
- print(vol)
- if(lastvol < grænse & vol >= grænse){
- print("result!")
- print(h[i])
- break()
- }
- lastvol = vol
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement