R version 4.2.3 (2023-03-15 ucrt) -- "Shortstop Beagle" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > read.table("adat3B.txt") V1 V2 1 x y 2 -1.8128998382017 1.26669337503769 3 -1.78000617120415 1.71519363544058 4 -1.53761506639421 1.53039595994982 5 -1.38548593875021 2.72491049194419 6 -1.36370046436787 1.54231349922645 7 -1.06372281443328 2.88488442579417 8 -1.0034651523456 2.3685727509976 9 -0.576038711704314 3.84214062542247 10 -0.511751984246075 3.26162721906042 11 -0.501689574681222 3.91782015629168 12 -0.418183164671063 3.39803187033859 13 -0.263308608904481 4.39116859949933 14 -0.202671359293163 3.03084561916818 15 -0.171649440191686 2.88538221901632 16 -0.136144533753395 4.16882140549909 17 -0.122023028321564 4.56867890337556 18 0.111457922495902 4.56005239290003 19 0.187089855782688 4.3856096725553 20 0.211925454437733 3.72069757748924 21 0.496581580489874 2.7570106560698 22 0.624563951045275 3.28052419828612 23 0.677349402569234 3.57347895464101 24 0.69881484284997 4.3505365426658 25 0.712974446825683 2.68153536193289 26 0.754332346841693 3.09814415196959 27 0.923411292955279 3.06342903785826 28 1.06195071432739 2.80959437953245 29 1.30101988278329 2.54548965410528 30 1.42867687996477 2.06092751859977 31 1.75527362432331 0.941456016204296 > read.table("adat3B.txt",header=TRUE) x y 1 -1.8128998 1.266693 2 -1.7800062 1.715194 3 -1.5376151 1.530396 4 -1.3854859 2.724910 5 -1.3637005 1.542313 6 -1.0637228 2.884884 7 -1.0034652 2.368573 8 -0.5760387 3.842141 9 -0.5117520 3.261627 10 -0.5016896 3.917820 11 -0.4181832 3.398032 12 -0.2633086 4.391169 13 -0.2026714 3.030846 14 -0.1716494 2.885382 15 -0.1361445 4.168821 16 -0.1220230 4.568679 17 0.1114579 4.560052 18 0.1870899 4.385610 19 0.2119255 3.720698 20 0.4965816 2.757011 21 0.6245640 3.280524 22 0.6773494 3.573479 23 0.6988148 4.350537 24 0.7129744 2.681535 25 0.7543323 3.098144 26 0.9234113 3.063429 27 1.0619507 2.809594 28 1.3010199 2.545490 29 1.4286769 2.060928 30 1.7552736 0.941456 > read.table("adat3B.txt",header=TRUE) -> pontok > class(pontok) [1] "data.frame" > mode(pontok) [1] "list" > mode(pontok$x) [1] "numeric" > mode(pontok$y) [1] "numeric" > ls() [1] "pontok" > attach(pontok) > ls() [1] "pontok" > x [1] -1.8128998 -1.7800062 -1.5376151 -1.3854859 [5] -1.3637005 -1.0637228 -1.0034652 -0.5760387 [9] -0.5117520 -0.5016896 -0.4181832 -0.2633086 [13] -0.2026714 -0.1716494 -0.1361445 -0.1220230 [17] 0.1114579 0.1870899 0.2119255 0.4965816 [21] 0.6245640 0.6773494 0.6988148 0.7129744 [25] 0.7543323 0.9234113 1.0619507 1.3010199 [29] 1.4286769 1.7552736 > pontok$x [1] -1.8128998 -1.7800062 -1.5376151 -1.3854859 [5] -1.3637005 -1.0637228 -1.0034652 -0.5760387 [9] -0.5117520 -0.5016896 -0.4181832 -0.2633086 [13] -0.2026714 -0.1716494 -0.1361445 -0.1220230 [17] 0.1114579 0.1870899 0.2119255 0.4965816 [21] 0.6245640 0.6773494 0.6988148 0.7129744 [25] 0.7543323 0.9234113 1.0619507 1.3010199 [29] 1.4286769 1.7552736 > plot(x,y) > plot(x,y,type="l") > ?plot starting httpd help server ... done > plot(x,y,type="p") > plot(x,y,type="o") > plot(x,y,type="b") > plot(x,y,type="c") > plot(x,y,type="h") > plot(x,y,type="s") > plot(x,y,type="S") > detach(pontok) > x Error: object 'x' not found > x <- rnorm(10) > x [1] -0.22450072 0.73182151 -1.15707168 0.87035169 [5] -0.32584788 0.06286279 0.59003797 -0.18244656 [9] 1.09153696 -1.77842994 > y <- rnorm(10) > plot(x,y,type="l") > x <- seq(-2,2,1) > x [1] -2 -1 0 1 2 > y <- x^2 > y [1] 4 1 0 1 4 > plot(x,y,type="l") > x <- seq(-2,2,0.2) > y <- x^2 > plot(x,y,type="l") > plot(x,x^2,type="l") > plot(x,x^2,type="l",col="red") > plot(x,x^2,type="o",col="red",pch=5) > plot(x,x^2,type="l",lwd=3) > plot(x,x^2,type="l",lwd=0.5) > plot(x,x^2,type="l",lty=1) > plot(x,x^2,type="l",lty=2) > plot(x,x^2,type="l",lty=3) > plot(x,x^2,type="l",lty=4) > plot(x,x^2,type="l",lty=5) > plot(x,x^2,type="l",lty=6) > plot(x,x^2,type="l",lty=7) > plot(x,x^2,type="l",lty=8) > lines(x,x) > plot(x,x^2,type="l",lty=8,ylim=c(-2,4)) > lines(x,x) > plot(x,x^2,type="l",lty=8,xlim=c(-2.5,2.5)) > lines(x,x) > plot(x,x^2,type="l",lty=8, + xlim=c(-2.5,2.5),ylim=c(-2,4), + ylab="f(x)") > lines(x,x) > lines( + x,x) > plot(x,x^2,type="l",lty=8, + xlim=c(-2.5,2.5),ylim=c(-2,4), + ylab="f(x)",main="y^2 és x") > lines(x,x) > pi [1] 3.141593 > cos function (x) .Primitive("cos") > cos(0) [1] 1 > cos(pi/2) [1] 6.123032e-17 > cos(pi) [1] -1 > cos(c(0,pi/2,pi)) [1] 1.000000e+00 6.123032e-17 -1.000000e+00 > # ZH feladat: f(x) = 2cos(2x)-1 > # abrazolasa fuggvenytranszformacioval > # 4 lepesben, [0 , 4pi] intervallumon > # 1. cos(x), 2. cos(2x), 3. 2cos(2x), > # 4. 2cos(2x)-1 > x <- seq(0,4*pi,pi/4) > y1 <- cos(x) > > > plot(x,y1,type="l") > # ZH feladat: f(x) = 2cos(2x)-1 > # abrazolasa fuggvenytranszformacioval > # 4 lepesben, [0 , 4pi] intervallumon > # 1. cos(x), 2. cos(2x), 3. 2cos(2x), > # 4. 2cos(2x)-1 > x <- seq(0,4*pi,pi/32) > y1 <- cos(x) > > > plot(x,y1,type="l") > y2 <- cos(2*x) > lines(x,y2,col="blue") > y3 <- 2 * y2 > lines(x,y3,col="purple") > plot(x,y1,type="l",ylim=c(-2,2)) > lines(x,y2,col="blue") > lines(x,y3,col="purple") > y4 <- y3 - 1 > lines(x,y4,col="red") > plot(x,y1,type="l",ylim=c(-3,2)) > lines(x,y2,col="blue") > lines(x,y3,col="purple") > lines(x,y4,col="red") > plot(x,y1,type="l",ylim=c(-3,2)) > lines(x,y2,col="blue",lty=2) > lines(x,y3,col="purple") > lines(x,y4,col="red") > lines(x,y4,col="red",pch=3) > lines(x,y4,col="red",pch=3,type="o") > lines(x,y4,col="red",pch=4,type="o") > plot(x,y1,type="l",ylim=c(-3,2)) > lines(x,y2,col="blue",lty=2) > lines(x,y3,col="purple") > lines(x,y4,col="red",pch=4,type="o") > ?legend > plot(x,y1,type="l",ylim=c(-3,3)) > lines(x,y2,col="blue",lty=2) > lines(x,y3,col="purple") > lines(x,y4,col="red",pch=4,type="o") > legend(0,3,c("cos(x)","cos(2x)", + "2cos(2x)","2cos(2x)-1") + ) > plot(x,y1,type="l",ylim=c(-3,4)) > lines(x,y2,col="blue",lty=2) > lines(x,y3,col="purple") > lines(x,y4,col="red",pch=4,type="o") > legend(0,4,c("cos(x)","cos(2x)", + "2cos(2x)","2cos(2x)-1"), + lty=1 + ) > legend(0,4,c("cos(x)","cos(2x)", + "2cos(2x)","2cos(2x)-1"), + lty=c(1,2,1,1) + ) > plot(x,y1,type="l",ylim=c(-3,4)) > lines(x,y2,col="blue",lty=2) > lines(x,y3,col="purple") > lines(x,y4,col="red",pch=4,type="o") > legend(0,4,c("cos(x)","cos(2x)", + "2cos(2x)","2cos(2x)-1"), + lty=c(1,2,1,1) + ) > plot(x,y1,type="l",ylim=c(-3,4)) > lines(x,y2,col="blue",lty=2) > lines(x,y3,col="purple") > lines(x,y4,col="red",pch=4,type="o") > legend(0,4,c("cos(x)","cos(2x)", + "2cos(2x)","2cos(2x)-1"), + lty=c(1,2,1,1), + col=c("black","blue","purple","red") + ) > plot(x,y1,type="l",ylim=c(-3,4)) > lines(x,y2,col="blue",lty=2) > lines(x,y3,col="purple") > lines(x,y4,col="red",pch=4,type="o") > legend(0,4,c("cos(x)","cos(2x)", + "2cos(2x)","2cos(2x)-1"), + #lty=c(1,2,1,1), + col=c("black","blue","purple","red") + ) > plot(x,y1,type="l",ylim=c(-3,4)) > lines(x,y2,col="blue",lty=2) > lines(x,y3,col="purple") > lines(x,y4,col="red",pch=4,type="o") > legend(0,4,c("cos(x)","cos(2x)", + "2cos(2x)","2cos(2x)-1"), + lty=c(1,2,1,1), + col=c("black","blue","purple","red") + ) > plot(x,y1,type="l",ylim=c(-3,4)) > lines(x,y2,col="blue",lty=2) > lines(x,y3,col="purple") > lines(x,y4,col="red",pch=4,type="o") > legend(0,4,c("cos(x)","cos(2x)", + "2cos(2x)","2cos(2x)-1"), + lty=c(1,2,1,1), + col=c("black","blue","purple","red"), + pch=4 + ) > plot(x,y1,type="l",ylim=c(-3,4)) > lines(x,y2,col="blue",lty=2) > lines(x,y3,col="purple") > lines(x,y4,col="red",pch=4,type="o") > legend(0,4,c("cos(x)","cos(2x)", + "2cos(2x)","2cos(2x)-1"), + lty=c(1,2,1,1), + col=c("black","blue","purple","red"), + pch=c(NA,NA,NA,4) + ) > plot(x,y1,type="l",ylim=c(-3,4), + ylab="y", + main="Függvénytranszformáció") > lines(x,y2,col="blue",lty=2) > lines(x,y3,col="purple") > lines(x,y4,col="red",pch=4,type="o") > legend(0,4,c("cos(x)","cos(2x)", + "2cos(2x)","2cos(2x)-1"), + lty=c(1,2,1,1), + col=c("black","blue","purple","red"), + pch=c(NA,NA,NA,4) + ) > plot(x,y) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ > plot(x,y1) > points(x,y2,col="red") > points(x,y2,col="red",type="l") > plot(x,y1) > points(x,y2,col="red",type="l") > sin function (x) .Primitive("sin") > function (x) x^2-1 function (x) x^2-1 > f <- function (x) x^2-1 > f function (x) x^2-1 > f(1) [1] 0 > sugar <- function (x,y) { r2 <- x^2+y^2;sqrt(r2) } > r2 Error: object 'r2' not found > sugar(3,4) [1] 5 > sugar <- function (x,y) { r2 <- x^2+y^2 ; + return(sqrt(r2)) } > sugar function (x,y) { r2 <- x^2+y^2 ; return(sqrt(r2)) } > sugar(3,4) [1] 5 > x <- seq(-2,2,0.2) > y <- seq(-2,2,0.2) > z <- outer(x,y,sugar) > x[3] [1] -1.6 > y[2] [1] -1.8 > sugar(x[3],y[2]) [1] 2.408319 > z[3,2] [1] 2.408319 > dim(z) [1] 21 21 > z [,1] [,2] [,3] [,4] [,5] [1,] 2.828427 2.690725 2.561250 2.441311 2.332381 [2,] 2.690725 2.545584 2.408319 2.280351 2.163331 [3,] 2.561250 2.408319 2.262742 2.126029 2.000000 [4,] 2.441311 2.280351 2.126029 1.979899 1.843909 [5,] 2.332381 2.163331 2.000000 1.843909 1.697056 [6,] 2.236068 2.059126 1.886796 1.720465 1.562050 [7,] 2.154066 1.969772 1.788854 1.612452 1.442221 [8,] 2.088061 1.897367 1.708801 1.523155 1.341641 [9,] 2.039608 1.843909 1.649242 1.456022 1.264911 [10,] 2.009975 1.811077 1.612452 1.414214 1.216553 [11,] 2.000000 1.800000 1.600000 1.400000 1.200000 [12,] 2.009975 1.811077 1.612452 1.414214 1.216553 [13,] 2.039608 1.843909 1.649242 1.456022 1.264911 [14,] 2.088061 1.897367 1.708801 1.523155 1.341641 [15,] 2.154066 1.969772 1.788854 1.612452 1.442221 [16,] 2.236068 2.059126 1.886796 1.720465 1.562050 [17,] 2.332381 2.163331 2.000000 1.843909 1.697056 [18,] 2.441311 2.280351 2.126029 1.979899 1.843909 [19,] 2.561250 2.408319 2.262742 2.126029 2.000000 [20,] 2.690725 2.545584 2.408319 2.280351 2.163331 [21,] 2.828427 2.690725 2.561250 2.441311 2.332381 [,6] [,7] [,8] [,9] [1,] 2.236068 2.1540659 2.0880613 2.0396078 [2,] 2.059126 1.9697716 1.8973666 1.8439089 [3,] 1.886796 1.7888544 1.7088007 1.6492423 [4,] 1.720465 1.6124515 1.5231546 1.4560220 [5,] 1.562050 1.4422205 1.3416408 1.2649111 [6,] 1.414214 1.2806248 1.1661904 1.0770330 [7,] 1.280625 1.1313708 1.0000000 0.8944272 [8,] 1.166190 1.0000000 0.8485281 0.7211103 [9,] 1.077033 0.8944272 0.7211103 0.5656854 [10,] 1.019804 0.8246211 0.6324555 0.4472136 [11,] 1.000000 0.8000000 0.6000000 0.4000000 [12,] 1.019804 0.8246211 0.6324555 0.4472136 [13,] 1.077033 0.8944272 0.7211103 0.5656854 [14,] 1.166190 1.0000000 0.8485281 0.7211103 [15,] 1.280625 1.1313708 1.0000000 0.8944272 [16,] 1.414214 1.2806248 1.1661904 1.0770330 [17,] 1.562050 1.4422205 1.3416408 1.2649111 [18,] 1.720465 1.6124515 1.5231546 1.4560220 [19,] 1.886796 1.7888544 1.7088007 1.6492423 [20,] 2.059126 1.9697716 1.8973666 1.8439089 [21,] 2.236068 2.1540659 2.0880613 2.0396078 [,10] [,11] [,12] [,13] [,14] [1,] 2.0099751 2.0 2.0099751 2.0396078 2.0880613 [2,] 1.8110770 1.8 1.8110770 1.8439089 1.8973666 [3,] 1.6124515 1.6 1.6124515 1.6492423 1.7088007 [4,] 1.4142136 1.4 1.4142136 1.4560220 1.5231546 [5,] 1.2165525 1.2 1.2165525 1.2649111 1.3416408 [6,] 1.0198039 1.0 1.0198039 1.0770330 1.1661904 [7,] 0.8246211 0.8 0.8246211 0.8944272 1.0000000 [8,] 0.6324555 0.6 0.6324555 0.7211103 0.8485281 [9,] 0.4472136 0.4 0.4472136 0.5656854 0.7211103 [10,] 0.2828427 0.2 0.2828427 0.4472136 0.6324555 [11,] 0.2000000 0.0 0.2000000 0.4000000 0.6000000 [12,] 0.2828427 0.2 0.2828427 0.4472136 0.6324555 [13,] 0.4472136 0.4 0.4472136 0.5656854 0.7211103 [14,] 0.6324555 0.6 0.6324555 0.7211103 0.8485281 [15,] 0.8246211 0.8 0.8246211 0.8944272 1.0000000 [16,] 1.0198039 1.0 1.0198039 1.0770330 1.1661904 [17,] 1.2165525 1.2 1.2165525 1.2649111 1.3416408 [18,] 1.4142136 1.4 1.4142136 1.4560220 1.5231546 [19,] 1.6124515 1.6 1.6124515 1.6492423 1.7088007 [20,] 1.8110770 1.8 1.8110770 1.8439089 1.8973666 [21,] 2.0099751 2.0 2.0099751 2.0396078 2.0880613 [,15] [,16] [,17] [,18] [,19] [1,] 2.1540659 2.236068 2.332381 2.441311 2.561250 [2,] 1.9697716 2.059126 2.163331 2.280351 2.408319 [3,] 1.7888544 1.886796 2.000000 2.126029 2.262742 [4,] 1.6124515 1.720465 1.843909 1.979899 2.126029 [5,] 1.4422205 1.562050 1.697056 1.843909 2.000000 [6,] 1.2806248 1.414214 1.562050 1.720465 1.886796 [7,] 1.1313708 1.280625 1.442221 1.612452 1.788854 [8,] 1.0000000 1.166190 1.341641 1.523155 1.708801 [9,] 0.8944272 1.077033 1.264911 1.456022 1.649242 [10,] 0.8246211 1.019804 1.216553 1.414214 1.612452 [11,] 0.8000000 1.000000 1.200000 1.400000 1.600000 [12,] 0.8246211 1.019804 1.216553 1.414214 1.612452 [13,] 0.8944272 1.077033 1.264911 1.456022 1.649242 [14,] 1.0000000 1.166190 1.341641 1.523155 1.708801 [15,] 1.1313708 1.280625 1.442221 1.612452 1.788854 [16,] 1.2806248 1.414214 1.562050 1.720465 1.886796 [17,] 1.4422205 1.562050 1.697056 1.843909 2.000000 [18,] 1.6124515 1.720465 1.843909 1.979899 2.126029 [19,] 1.7888544 1.886796 2.000000 2.126029 2.262742 [20,] 1.9697716 2.059126 2.163331 2.280351 2.408319 [21,] 2.1540659 2.236068 2.332381 2.441311 2.561250 [,20] [,21] [1,] 2.690725 2.828427 [2,] 2.545584 2.690725 [3,] 2.408319 2.561250 [4,] 2.280351 2.441311 [5,] 2.163331 2.332381 [6,] 2.059126 2.236068 [7,] 1.969772 2.154066 [8,] 1.897367 2.088061 [9,] 1.843909 2.039608 [10,] 1.811077 2.009975 [11,] 1.800000 2.000000 [12,] 1.811077 2.009975 [13,] 1.843909 2.039608 [14,] 1.897367 2.088061 [15,] 1.969772 2.154066 [16,] 2.059126 2.236068 [17,] 2.163331 2.332381 [18,] 2.280351 2.441311 [19,] 2.408319 2.561250 [20,] 2.545584 2.690725 [21,] 2.690725 2.828427 > dim(z) [1] 21 21 > length(x) [1] 21 > length(yí) Error: object 'yí' not found > length(y) [1] 21 > z[3,2] == sugar(x[3],y[2]) [1] TRUE > z[17,52] == sugar(x[17],y[5]) Error in z[17, 52] : subscript out of bounds > z[17,5] == sugar(x[17],y[5]) [1] TRUE > sugar(x,y) [1] 2.8284271 2.5455844 2.2627417 1.9798990 [5] 1.6970563 1.4142136 1.1313708 0.8485281 [9] 0.5656854 0.2828427 0.0000000 0.2828427 [13] 0.5656854 0.8485281 1.1313708 1.4142136 [17] 1.6970563 1.9798990 2.2627417 2.5455844 [21] 2.8284271 > image(x,y,z) > contour(x,y,z) > contour(x,y,z,nlevels=5) > contour(x,y,z,nlevels=7) > contour(x,y,z,nlevels=8) > contour(x,y,z,nlevels=10) > contour(x,y,z,nlevels=12) > contour(x,y,z,nlevels=3) > image(x,y,z) > contour(x,y,z,add=TRUE) > image(x,y,z) > contour(x,y,z,add=TRUE,nlevels=12) > persp(x,y,z) > persp(x,y,z,theta=0) > persp(x,y,z,theta=30) > persp(x,y,z,theta=30,phi=15) > persp(x,y,z,theta=30,phi=45) > persp(x,y,z,theta=60,phi=30) > persp(x,y,z,theta=60,phi=1:30) > ?persp > ?for + > help.search("for") > help.search("loop") > for (alpha in 1:30) {persp( + x,y,z,phi=alpha) } > for (alpha in 1:30) {persp( + x,y,z,phi=alpha) } > help.search("wait") > persp(x,y,z,col="red") > persp(x,y,z,col=1:3) > persp(x,y,z,col=1:3,theta=30) > rmorm(10) Error in rmorm(10) : could not find function "rmorm" > rnorm(10) [1] 0.93707476 -0.33331595 [3] 0.08569835 -2.35465026 [5] 0.02212288 -0.39294188 [7] -1.98062389 -0.88464033 [9] 2.14560556 -0.92978174 > runif(10) [1] 0.1615211 0.9560125 0.4543464 0.9481978 [5] 0.7111970 0.6689991 0.6556344 0.4484927 [9] 0.7263789 0.4281112 > ?runif > x <- seq(-0.5,1.5,0.1) > plot(x,dunif(x),type="l") > help.search("set function") > lines(x,punif(x),col="red") > ?binom No documentation for ‘binom’ in specified packages and libraries: you could try ‘??binom’ > ?rbinom > x <- 0:10 > y <- dbinom(x,size = 10, prob= 0.5) > y [1] 0.0009765625 0.0097656250 0.0439453125 [4] 0.1171875000 0.2050781250 0.2460937500 [7] 0.2050781250 0.1171875000 0.0439453125 [10] 0.0097656250 0.0009765625 > plot(x,y) > y <- dbinom(x,size = 10, prob= 0.7) > plot(x,y) > sum(y) [1] 1 > ?distributions > x <- seq(-2,2,0.05) > plot(x,dnorm(x),type="l") > x <- seq(-3,3,0.05) > plot(x,dnorm(x),type="l") > lines(x,pnorm(x),col="red") > plot(x,dnorm(x),type="l",ylim=c(0,1)) > lines(x,pnorm(x),col="red") > plot(x,x^2,type="l") > abline(1,-1) > abline(v=2) > abline(h=2,col="blue") > # standard Gauss/ normalis eo. > # surusegfuggveny > plot(x,dnorm(x),type="l",ylim=c(0,1)) > # eloszlasfuggveny > lines(x,pnorm(x),col="red") > # kvantilisfuggveny > # spec. eset: median: > abline(h=0.5,lty=2) > abline(v=0,lty=2) > abline(h=0.7,col="blue") > qnorm(0.7) [1] 0.5244005 > abline(v = qnorm(0.7),col="blue") >