SlideShare a Scribd company logo
1 of 10
Prepared by VOLKAN OBAN
Basic Calculus in R.
install.packages("mosaic")
library(mosaic)
Example:
> f <- makeFun(m * x + b ~ x, m = 3.5, b = 10)
>
> f(x = 2)
[1] 17
>
> g <- makeFun(A * x * cos(pi * x * y) ~ x + y, A = 3)
> g
function (x, y, A = 3)
A * x * cos(pi * x * y)
>
> g(x = 1, y = 2)
[1] 3
> > plotFun(A * exp(k * t) * sin(2 * pi * t/P) ~ t + k, t.lim = range(0, 1
0), k.lim = range(-0.3,
+
0), A = 10, P = 4)
Example
Example:
> library(manipulate)
> plotFun(A * exp(k * t) * sin(2 * pi * t/P) ~ t + k, t.lim = range(0, 10),
k.lim = range(-0.3,
+
0), A = 10, P = 4, surface = TRUE)
Example:
> plotFun(dt(t, df) ~ t + df, t.lim = range(-3, 3), df.lim = range(1, 10))
Derivative:
>library(mosaic)
> D(sin(x) ~ x)
function (x)
cos(x)
> D(A * x^2 * sin(y) ~ x)
function (x, A, y)
A * (2 * x) * sin(y)
> D(A * x^2 * sin(y) ~ x + y)
function (x, y, A)
A * (2 * x) * cos(y)
Example:
> F = antiD(a * x^2 ~ x, a = 1)
> F
function (x, a = 1, C = 0)
a * 1/3 * x^3 + C
> F = antiD(dnorm(x, mean = 6000, sd = 0.01) ~ x, lower.bound = 6000)
> F(Inf) - F(-Inf)
[1] 1
>
Solving..
findZeros(sin(t) ~ t, t.lim = range(-5, 1))
> findZeros(sin(t) ~ t, t.lim = range(-5, 1))
t
1 -6.2832
2 -3.1416
3 0.0000
4 3.1416
Example:
> solve(4 * sin(3 * x) == 2 ~ x, near = 0, within = 1)
x
1 0.1746
2 0.8726
Example:
> f <- rfun(~x, seed = 345)
> g <- rfun(~x)
> h <- rfun(~x)
> plotFun(f(x) ~ x, x.lim = range(-5, 5))
> plotFun(g(x) ~ x, add = TRUE, col = "red")
> plotFun(h(x) ~ x, add = TRUE, col = "darkgreen")
>
Example:
> Water <- data.frame(mass = c(57, 76, 105, 147, 181, 207, 227, 231, 231, 2
31), time = c(0,
+
3, 6, 9, 12, 15, 18, 21, 24, 27))
>
> xyplot(mass ~ time, data = Water)
Example:
> data(CPS85)
>
> xyplot(wage ~ age, data = CPS85)
> f <- smoother(wage ~ age, span = 0.9, data = CPS85)
> plotFun(f(age) ~ age, add = TRUE, lwd = 4)
>
Fitted Functions:
> data(CPS85)
> model <- lm(log(wage) ~ age * educ + 1, data = CPS85)
> g <- makeFun(model)
> g(age = 40, educ = 12)
1
7.494671
>
Example:
> plotPoints(temp ~ time, data = CoolingWater)
> mod <- fitModel(temp ~ A + B * exp(-k * time), start = list(A = 30, k = l
og(2)/30),data = CoolingWater)
> plotFun(mod(time) ~ time, add = TRUE, col = "red")
>
Mixed Examples:
1
> f = function(x){ x^2 + 2*x }
>
> f(pi)
[1] 16.15279
2-
> findZeros( sin(x)-0.35 ~ x, x.lim=range(-20,20) )
x
1 -12.2088
2 -9.7823
3 -5.9256
4 -3.4991
5 0.3576
6 2.7840
7 6.6407
8 9.0672
9 12.9239
10 15.3504
3-
> findZeros(sin(x^2)*(cos(sqrt(x^4+3)-x^2))-x+1~x,x.lim=range(1,2))
x
1 1.5576
4-
> f3 = makeFun( sin(x^2) - 100~x)
> f3(x=2)
[1] -100.7568
5-
> F = antiD( exp(x^2) ~ x )
> F(x=2) - F(x=-1)
[1] 17.91528
6-Dif.Eq.
> soln <- integrateODE( dx ~ r*x*(1-x/K),x=1, K=10, r=.5, tdur=list(from=0,
to=20))
> soln$x(0:5)
[1] 1.000000 1.548281 2.319693 3.324279 4.508531 5.751209
7-
> plotFun( exp(-t/10)*sin(2*pi*x/5) ~ x&t,x.lim=range(0,5), t.lim=range(0,1
0) )
8-
> newF = antiD(exp(x)*x^2 ~ x, x.from=1)
> F(x=2) #default lower bound is 0
[1] 16.45263

More Related Content

What's hot

ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions Dr. Volkan OBAN
 
Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.Dr. Volkan OBAN
 
Plot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,onPlot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,onDr. Volkan OBAN
 
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...Revolution Analytics
 
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : NotesCUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : NotesSubhajit Sahu
 
Data visualization using the grammar of graphics
Data visualization using the grammar of graphicsData visualization using the grammar of graphics
Data visualization using the grammar of graphicsRupak Roy
 
Data visualization with multiple groups using ggplot2
Data visualization with multiple groups using ggplot2Data visualization with multiple groups using ggplot2
Data visualization with multiple groups using ggplot2Rupak Roy
 

What's hot (20)

ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions
 
Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.
 
RHadoop の紹介
RHadoop の紹介RHadoop の紹介
RHadoop の紹介
 
R meets Hadoop
R meets HadoopR meets Hadoop
R meets Hadoop
 
Oh Composable World!
Oh Composable World!Oh Composable World!
Oh Composable World!
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
Script jantung copy
Script jantung   copyScript jantung   copy
Script jantung copy
 
Plot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,onPlot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,on
 
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
 
Joclad 2010 d
Joclad 2010 dJoclad 2010 d
Joclad 2010 d
 
Dplyr and Plyr
Dplyr and PlyrDplyr and Plyr
Dplyr and Plyr
 
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
 
Numpy python cheat_sheet
Numpy python cheat_sheetNumpy python cheat_sheet
Numpy python cheat_sheet
 
Python hmm
Python hmmPython hmm
Python hmm
 
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : NotesCUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
 
Data visualization using the grammar of graphics
Data visualization using the grammar of graphicsData visualization using the grammar of graphics
Data visualization using the grammar of graphics
 
Py lecture5 python plots
Py lecture5 python plotsPy lecture5 python plots
Py lecture5 python plots
 
NumPy Refresher
NumPy RefresherNumPy Refresher
NumPy Refresher
 
Data visualization with multiple groups using ggplot2
Data visualization with multiple groups using ggplot2Data visualization with multiple groups using ggplot2
Data visualization with multiple groups using ggplot2
 
Clojure to Slang
Clojure to SlangClojure to Slang
Clojure to Slang
 

Viewers also liked

Stem basic calculus cg 1
Stem basic calculus cg 1Stem basic calculus cg 1
Stem basic calculus cg 1Live Angga
 
Basic of Computer component
Basic of Computer componentBasic of Computer component
Basic of Computer componentMeet Gondaliya
 
Implicit function and Total derivative
Implicit function and Total derivativeImplicit function and Total derivative
Implicit function and Total derivativeMeet Gondaliya
 
The Building Block of Calculus - Chapter 2 Derivatives
The Building Block of Calculus - Chapter 2 DerivativesThe Building Block of Calculus - Chapter 2 Derivatives
The Building Block of Calculus - Chapter 2 DerivativesTenri Ashari Wanahari
 
Green chemistry - english version
Green chemistry - english versionGreen chemistry - english version
Green chemistry - english versionclasse4ach
 
Application of derivatives
Application of derivatives Application of derivatives
Application of derivatives Seyid Kadher
 
Determinants
DeterminantsDeterminants
DeterminantsRivan001
 
General mathematics
General mathematicsGeneral mathematics
General mathematicsBoyet Aluan
 
Differentiation powerpoint for tuesday pd
Differentiation powerpoint for tuesday pdDifferentiation powerpoint for tuesday pd
Differentiation powerpoint for tuesday pdmclaringbold
 
A Course of Calculus for IT-Students
A Course of Calculus for IT-StudentsA Course of Calculus for IT-Students
A Course of Calculus for IT-Studentsmetamath
 
GENERAL MATHEMATICS Module 1: Review on Functions
GENERAL MATHEMATICS Module 1: Review on FunctionsGENERAL MATHEMATICS Module 1: Review on Functions
GENERAL MATHEMATICS Module 1: Review on FunctionsGalina Panela
 
introduction-to-numerical-methods-in-chemical-engineering
 introduction-to-numerical-methods-in-chemical-engineering introduction-to-numerical-methods-in-chemical-engineering
introduction-to-numerical-methods-in-chemical-engineeringTalal Ashraf
 
Integral Calculus
Integral CalculusIntegral Calculus
Integral Calculusitutor
 
Chemical reaction engineering handbook of solved problems
Chemical reaction engineering handbook of solved problemsChemical reaction engineering handbook of solved problems
Chemical reaction engineering handbook of solved problemsJuan Monroy
 
STATISTICS AND PROBABILITY (TEACHING GUIDE)
STATISTICS AND PROBABILITY (TEACHING GUIDE)STATISTICS AND PROBABILITY (TEACHING GUIDE)
STATISTICS AND PROBABILITY (TEACHING GUIDE)PRINTDESK by Dan
 

Viewers also liked (20)

Stem basic calculus cg 1
Stem basic calculus cg 1Stem basic calculus cg 1
Stem basic calculus cg 1
 
Basic calculus (i)
Basic calculus (i)Basic calculus (i)
Basic calculus (i)
 
Pre calculus Grade 11 Learner's Module Senior High School
Pre calculus Grade 11 Learner's Module Senior High SchoolPre calculus Grade 11 Learner's Module Senior High School
Pre calculus Grade 11 Learner's Module Senior High School
 
Basic of Computer component
Basic of Computer componentBasic of Computer component
Basic of Computer component
 
Basic calculus (ii) recap
Basic calculus (ii) recapBasic calculus (ii) recap
Basic calculus (ii) recap
 
Implicit function and Total derivative
Implicit function and Total derivativeImplicit function and Total derivative
Implicit function and Total derivative
 
The Building Block of Calculus - Chapter 2 Derivatives
The Building Block of Calculus - Chapter 2 DerivativesThe Building Block of Calculus - Chapter 2 Derivatives
The Building Block of Calculus - Chapter 2 Derivatives
 
Green chemistry - english version
Green chemistry - english versionGreen chemistry - english version
Green chemistry - english version
 
Application of derivatives
Application of derivatives Application of derivatives
Application of derivatives
 
Calculus
CalculusCalculus
Calculus
 
Determinants
DeterminantsDeterminants
Determinants
 
General mathematics
General mathematicsGeneral mathematics
General mathematics
 
Differentiation powerpoint for tuesday pd
Differentiation powerpoint for tuesday pdDifferentiation powerpoint for tuesday pd
Differentiation powerpoint for tuesday pd
 
A Course of Calculus for IT-Students
A Course of Calculus for IT-StudentsA Course of Calculus for IT-Students
A Course of Calculus for IT-Students
 
GENERAL MATHEMATICS Module 1: Review on Functions
GENERAL MATHEMATICS Module 1: Review on FunctionsGENERAL MATHEMATICS Module 1: Review on Functions
GENERAL MATHEMATICS Module 1: Review on Functions
 
lecture1 introduction to computer graphics(Computer graphics tutorials)
lecture1 introduction to computer graphics(Computer graphics tutorials)lecture1 introduction to computer graphics(Computer graphics tutorials)
lecture1 introduction to computer graphics(Computer graphics tutorials)
 
introduction-to-numerical-methods-in-chemical-engineering
 introduction-to-numerical-methods-in-chemical-engineering introduction-to-numerical-methods-in-chemical-engineering
introduction-to-numerical-methods-in-chemical-engineering
 
Integral Calculus
Integral CalculusIntegral Calculus
Integral Calculus
 
Chemical reaction engineering handbook of solved problems
Chemical reaction engineering handbook of solved problemsChemical reaction engineering handbook of solved problems
Chemical reaction engineering handbook of solved problems
 
STATISTICS AND PROBABILITY (TEACHING GUIDE)
STATISTICS AND PROBABILITY (TEACHING GUIDE)STATISTICS AND PROBABILITY (TEACHING GUIDE)
STATISTICS AND PROBABILITY (TEACHING GUIDE)
 

Similar to Basic Calculus in R.

5.2 primitive recursive functions
5.2 primitive recursive functions5.2 primitive recursive functions
5.2 primitive recursive functionsSampath Kumar S
 
functions limits and continuity
functions limits and continuityfunctions limits and continuity
functions limits and continuityPume Ananda
 
Tugasmatematikakelompok
TugasmatematikakelompokTugasmatematikakelompok
Tugasmatematikakelompokgundul28
 
Tugas matematika kelompok
Tugas matematika kelompokTugas matematika kelompok
Tugas matematika kelompokachmadtrybuana
 
Tugasmatematikakelompok 150715235527-lva1-app6892
Tugasmatematikakelompok 150715235527-lva1-app6892Tugasmatematikakelompok 150715235527-lva1-app6892
Tugasmatematikakelompok 150715235527-lva1-app6892drayertaurus
 
Algebra 2 Section 5-1
Algebra 2 Section 5-1Algebra 2 Section 5-1
Algebra 2 Section 5-1Jimbo Lamb
 
17 integrals of rational functions x
17 integrals of rational functions x17 integrals of rational functions x
17 integrals of rational functions xmath266
 
The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212Mahmoud Samir Fayed
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)riue
 
Functional JS for everyone - 4Developers
Functional JS for everyone - 4DevelopersFunctional JS for everyone - 4Developers
Functional JS for everyone - 4DevelopersBartek Witczak
 
MT T4 (Bab 3: Fungsi Kuadratik)
MT T4 (Bab 3: Fungsi Kuadratik)MT T4 (Bab 3: Fungsi Kuadratik)
MT T4 (Bab 3: Fungsi Kuadratik)hasnulslides
 
Mathsclass xii (exampler problems)
Mathsclass xii (exampler problems)Mathsclass xii (exampler problems)
Mathsclass xii (exampler problems)nitishguptamaps
 
The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181Mahmoud Samir Fayed
 
Introductory RxJava
Introductory RxJavaIntroductory RxJava
Introductory RxJavaIntae Kim
 
Graph for Coulomb damped oscillation
Graph for Coulomb damped oscillationGraph for Coulomb damped oscillation
Graph for Coulomb damped oscillationphanhung20
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語ikdysfm
 
Why Haskell Matters
Why Haskell MattersWhy Haskell Matters
Why Haskell Mattersromanandreg
 

Similar to Basic Calculus in R. (20)

5.2 primitive recursive functions
5.2 primitive recursive functions5.2 primitive recursive functions
5.2 primitive recursive functions
 
functions limits and continuity
functions limits and continuityfunctions limits and continuity
functions limits and continuity
 
Functions limits and continuity
Functions limits and continuityFunctions limits and continuity
Functions limits and continuity
 
Tugasmatematikakelompok
TugasmatematikakelompokTugasmatematikakelompok
Tugasmatematikakelompok
 
Tugas matematika kelompok
Tugas matematika kelompokTugas matematika kelompok
Tugas matematika kelompok
 
Tugasmatematikakelompok 150715235527-lva1-app6892
Tugasmatematikakelompok 150715235527-lva1-app6892Tugasmatematikakelompok 150715235527-lva1-app6892
Tugasmatematikakelompok 150715235527-lva1-app6892
 
Algebra 2 Section 5-1
Algebra 2 Section 5-1Algebra 2 Section 5-1
Algebra 2 Section 5-1
 
17 integrals of rational functions x
17 integrals of rational functions x17 integrals of rational functions x
17 integrals of rational functions x
 
The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)
 
F(x) terminology
F(x) terminologyF(x) terminology
F(x) terminology
 
Functional JS for everyone - 4Developers
Functional JS for everyone - 4DevelopersFunctional JS for everyone - 4Developers
Functional JS for everyone - 4Developers
 
MT T4 (Bab 3: Fungsi Kuadratik)
MT T4 (Bab 3: Fungsi Kuadratik)MT T4 (Bab 3: Fungsi Kuadratik)
MT T4 (Bab 3: Fungsi Kuadratik)
 
Mathsclass xii (exampler problems)
Mathsclass xii (exampler problems)Mathsclass xii (exampler problems)
Mathsclass xii (exampler problems)
 
The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181
 
Introductory RxJava
Introductory RxJavaIntroductory RxJava
Introductory RxJava
 
Graph for Coulomb damped oscillation
Graph for Coulomb damped oscillationGraph for Coulomb damped oscillation
Graph for Coulomb damped oscillation
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
Matlab differential
Matlab differentialMatlab differential
Matlab differential
 
Why Haskell Matters
Why Haskell MattersWhy Haskell Matters
Why Haskell Matters
 

More from Dr. Volkan OBAN

Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...Dr. Volkan OBAN
 
Covid19py Python Package - Example
Covid19py  Python Package - ExampleCovid19py  Python Package - Example
Covid19py Python Package - ExampleDr. Volkan OBAN
 
Object detection with Python
Object detection with Python Object detection with Python
Object detection with Python Dr. Volkan OBAN
 
Python - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) ParametreleriPython - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) ParametreleriDr. Volkan OBAN
 
Linear Programming wi̇th R - Examples
Linear Programming wi̇th R - ExamplesLinear Programming wi̇th R - Examples
Linear Programming wi̇th R - ExamplesDr. Volkan OBAN
 
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ..."optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...Dr. Volkan OBAN
 
k-means Clustering in Python
k-means Clustering in Pythonk-means Clustering in Python
k-means Clustering in PythonDr. Volkan OBAN
 
Naive Bayes Example using R
Naive Bayes Example using  R Naive Bayes Example using  R
Naive Bayes Example using R Dr. Volkan OBAN
 
k-means Clustering and Custergram with R
k-means Clustering and Custergram with Rk-means Clustering and Custergram with R
k-means Clustering and Custergram with RDr. Volkan OBAN
 
Data Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision MakingData Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision MakingDr. Volkan OBAN
 
Scikit-learn Cheatsheet-Python
Scikit-learn Cheatsheet-PythonScikit-learn Cheatsheet-Python
Scikit-learn Cheatsheet-PythonDr. Volkan OBAN
 
Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet Dr. Volkan OBAN
 
Pandas,scipy,numpy cheatsheet
Pandas,scipy,numpy cheatsheetPandas,scipy,numpy cheatsheet
Pandas,scipy,numpy cheatsheetDr. Volkan OBAN
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleDr. Volkan OBAN
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleDr. Volkan OBAN
 
R Machine Learning packages( generally used)
R Machine Learning packages( generally used)R Machine Learning packages( generally used)
R Machine Learning packages( generally used)Dr. Volkan OBAN
 
treemap package in R and examples.
treemap package in R and examples.treemap package in R and examples.
treemap package in R and examples.Dr. Volkan OBAN
 
R-Data table Cheat Sheet
R-Data table Cheat SheetR-Data table Cheat Sheet
R-Data table Cheat SheetDr. Volkan OBAN
 
Rcommands-for those who interested in R.
Rcommands-for those who interested in R.Rcommands-for those who interested in R.
Rcommands-for those who interested in R.Dr. Volkan OBAN
 

More from Dr. Volkan OBAN (20)

Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
 
Covid19py Python Package - Example
Covid19py  Python Package - ExampleCovid19py  Python Package - Example
Covid19py Python Package - Example
 
Object detection with Python
Object detection with Python Object detection with Python
Object detection with Python
 
Python - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) ParametreleriPython - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) Parametreleri
 
Linear Programming wi̇th R - Examples
Linear Programming wi̇th R - ExamplesLinear Programming wi̇th R - Examples
Linear Programming wi̇th R - Examples
 
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ..."optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
 
k-means Clustering in Python
k-means Clustering in Pythonk-means Clustering in Python
k-means Clustering in Python
 
Naive Bayes Example using R
Naive Bayes Example using  R Naive Bayes Example using  R
Naive Bayes Example using R
 
R forecasting Example
R forecasting ExampleR forecasting Example
R forecasting Example
 
k-means Clustering and Custergram with R
k-means Clustering and Custergram with Rk-means Clustering and Custergram with R
k-means Clustering and Custergram with R
 
Data Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision MakingData Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision Making
 
Scikit-learn Cheatsheet-Python
Scikit-learn Cheatsheet-PythonScikit-learn Cheatsheet-Python
Scikit-learn Cheatsheet-Python
 
Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet
 
Pandas,scipy,numpy cheatsheet
Pandas,scipy,numpy cheatsheetPandas,scipy,numpy cheatsheet
Pandas,scipy,numpy cheatsheet
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an example
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an example
 
R Machine Learning packages( generally used)
R Machine Learning packages( generally used)R Machine Learning packages( generally used)
R Machine Learning packages( generally used)
 
treemap package in R and examples.
treemap package in R and examples.treemap package in R and examples.
treemap package in R and examples.
 
R-Data table Cheat Sheet
R-Data table Cheat SheetR-Data table Cheat Sheet
R-Data table Cheat Sheet
 
Rcommands-for those who interested in R.
Rcommands-for those who interested in R.Rcommands-for those who interested in R.
Rcommands-for those who interested in R.
 

Recently uploaded

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 

Recently uploaded (20)

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

Basic Calculus in R.

  • 1. Prepared by VOLKAN OBAN Basic Calculus in R. install.packages("mosaic") library(mosaic) Example: > f <- makeFun(m * x + b ~ x, m = 3.5, b = 10) > > f(x = 2) [1] 17 > > g <- makeFun(A * x * cos(pi * x * y) ~ x + y, A = 3) > g function (x, y, A = 3) A * x * cos(pi * x * y) > > g(x = 1, y = 2) [1] 3 > > plotFun(A * exp(k * t) * sin(2 * pi * t/P) ~ t + k, t.lim = range(0, 1 0), k.lim = range(-0.3, + 0), A = 10, P = 4)
  • 2. Example Example: > library(manipulate) > plotFun(A * exp(k * t) * sin(2 * pi * t/P) ~ t + k, t.lim = range(0, 10), k.lim = range(-0.3, + 0), A = 10, P = 4, surface = TRUE)
  • 3.
  • 4. Example: > plotFun(dt(t, df) ~ t + df, t.lim = range(-3, 3), df.lim = range(1, 10)) Derivative: >library(mosaic) > D(sin(x) ~ x) function (x) cos(x) > D(A * x^2 * sin(y) ~ x) function (x, A, y) A * (2 * x) * sin(y) > D(A * x^2 * sin(y) ~ x + y) function (x, y, A) A * (2 * x) * cos(y)
  • 5. Example: > F = antiD(a * x^2 ~ x, a = 1) > F function (x, a = 1, C = 0) a * 1/3 * x^3 + C > F = antiD(dnorm(x, mean = 6000, sd = 0.01) ~ x, lower.bound = 6000) > F(Inf) - F(-Inf) [1] 1 > Solving.. findZeros(sin(t) ~ t, t.lim = range(-5, 1)) > findZeros(sin(t) ~ t, t.lim = range(-5, 1)) t 1 -6.2832 2 -3.1416 3 0.0000 4 3.1416 Example: > solve(4 * sin(3 * x) == 2 ~ x, near = 0, within = 1) x 1 0.1746 2 0.8726 Example: > f <- rfun(~x, seed = 345) > g <- rfun(~x) > h <- rfun(~x) > plotFun(f(x) ~ x, x.lim = range(-5, 5)) > plotFun(g(x) ~ x, add = TRUE, col = "red") > plotFun(h(x) ~ x, add = TRUE, col = "darkgreen") >
  • 6. Example: > Water <- data.frame(mass = c(57, 76, 105, 147, 181, 207, 227, 231, 231, 2 31), time = c(0, + 3, 6, 9, 12, 15, 18, 21, 24, 27)) > > xyplot(mass ~ time, data = Water)
  • 7. Example: > data(CPS85) > > xyplot(wage ~ age, data = CPS85) > f <- smoother(wage ~ age, span = 0.9, data = CPS85) > plotFun(f(age) ~ age, add = TRUE, lwd = 4) >
  • 8. Fitted Functions: > data(CPS85) > model <- lm(log(wage) ~ age * educ + 1, data = CPS85) > g <- makeFun(model) > g(age = 40, educ = 12) 1 7.494671 > Example: > plotPoints(temp ~ time, data = CoolingWater) > mod <- fitModel(temp ~ A + B * exp(-k * time), start = list(A = 30, k = l og(2)/30),data = CoolingWater) > plotFun(mod(time) ~ time, add = TRUE, col = "red") >
  • 9. Mixed Examples: 1 > f = function(x){ x^2 + 2*x } > > f(pi) [1] 16.15279 2- > findZeros( sin(x)-0.35 ~ x, x.lim=range(-20,20) ) x 1 -12.2088 2 -9.7823 3 -5.9256 4 -3.4991 5 0.3576 6 2.7840 7 6.6407 8 9.0672 9 12.9239 10 15.3504 3- > findZeros(sin(x^2)*(cos(sqrt(x^4+3)-x^2))-x+1~x,x.lim=range(1,2)) x 1 1.5576 4- > f3 = makeFun( sin(x^2) - 100~x) > f3(x=2) [1] -100.7568
  • 10. 5- > F = antiD( exp(x^2) ~ x ) > F(x=2) - F(x=-1) [1] 17.91528 6-Dif.Eq. > soln <- integrateODE( dx ~ r*x*(1-x/K),x=1, K=10, r=.5, tdur=list(from=0, to=20)) > soln$x(0:5) [1] 1.000000 1.548281 2.319693 3.324279 4.508531 5.751209 7- > plotFun( exp(-t/10)*sin(2*pi*x/5) ~ x&t,x.lim=range(0,5), t.lim=range(0,1 0) ) 8- > newF = antiD(exp(x)*x^2 ~ x, x.from=1) > F(x=2) #default lower bound is 0 [1] 16.45263