Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Gab1A
# Gráfico em 3 dimensões # Curva # Superfície z=f(x,y) x <- seq(-1,1, by=0.05) y <- seq(-1,1,by=0.05) mf<-function(s,r){z=s+r*1i; Mod(z^5+z+1)^2# f(x,y); auxiliar para gráfico } require(grDevices) # for trans3d z <- outer(x, y, mf) z[is.na(z)] <- 4 op <- par(bg = "white") persp(x, y, z, theta = 60, phi = 20, expand = 1) contour(x,y,z,levels=c(0.5,1)) # Curva (u(t),v(t)) t=seq(0,2.5,by=0.01) u<-function(s){(s*cos(s)+2)/2.5-0.5} v<-function(s){(-s^2)*sin(s)/4+1} curve(u,0,2.5) curve(v,0,2.5) plot(u(t),v(t),'l',col="red") # curva (u(t),v(t)) persp(x, y, z, theta = 60, phi = 20, expand = 1)->res lines(trans3d(u(t),v(t),mf(u(t),v(t)), res), col = "red", lwd = 2) # Inclui curvas no gráfico em 3d # Método de Euler oara resolver a equação e'(t)=grad f(e(t)), e(0)=(0.5,1) gradmf<-function(u){ # gradiente de f(x,y) s=u[1] r=u[2] h=10^(-5) dnfx= mf(s+h,r)-mf(s-h,r) dnfy=mf(s,r+h)-mf(s,r-h) c(dnfx,dnfy)/(2*h) } t0=0 # tempo inicial tf=5 # t final e0=c(0,0.5) # condição inicial mf(e0[1],e0[2]) # teste da escolha n=500 h=(tf-t0)/n # Tamanho do passo tt=seq(t0,tf,by=h) Y=matrix(0,2,length(tt)) Y[,1]=e0 for ( i in 1:(length(tt)-1)){ Y[,i+1]=Y[,i]-h*gradmf(Y[,i]) } print("Aproximação para o ponto de máximo"); Y[,length(tt)] print("Aproximação para o valor máximo"); mf(Y[1,length(tt)],Y[2,length(tt)]) lines(trans3d(Y[1,],Y[2,],mf(Y[1,],Y[2,]), res), col = "blue", lwd = 2) # Inclui curvas plot(Y[1,],Y[2,],col="blue") plot(t,mf(u(t),v(t)),'l',col="red") # curva f(u(t),v(t)) plot(tt,mf(Y[1,],Y[2,]), col = "blue")
run
|
edit
|
history
|
help
0
Paired t-test [Access Medical Information]
Assignment2 Q1
Zerlina L Bi-variate Regression
Graph
Sign test
For loops Example
03-08-2020-Integral-Numerica
31-08-2020-Exemplo Ajuste
Figura
Spiral