Advertisement
Guest User

Untitled

a guest
May 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. f <- function(x,y)
  2. (27*y^2-26*x*y-46*y+19*x^2-9*x-34)/(16*y^2-48*x*y+16*y+36*x^2-24*x+6)
  3.  
  4. x0 <- -8
  5. y0 <- 7
  6. #l1 <- 2
  7. #l2 <- -1
  8. r <- 1
  9.  
  10. l <- function(x)
  11. y0+l2/l1*(x-x0)
  12.  
  13. x <-seq(x0-r,x0+r,r/100)
  14. y <-seq(y0-r,y0+r,r/100)
  15. z <-outer(x,y,f)
  16.  
  17. contour(x,y,z,asp=1,nlevels=20)
  18. points(x0,y0,pch=16,col="red")
  19. abline(h=y0,v=x0,col="black")
  20. lines(x,l(x),col="blue")
  21.  
  22. h <- 1e-6
  23. fx <- (f(x0+h,y0)-f(x0,y0))/h
  24. fy <- (f(x0,y0+h)-f(x0,y0))/h
  25. fv <- (f(x0+h*l1,y0+h*l2)-f(x0,y0))/
  26. (h*sqrt(l1^2+l2^2))
  27.  
  28. fx
  29. fy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement