Email             :
RPubs            : https://rpubs.com/noviaanita/
Jurusan          : Fisika Medis
Address         : ARA Center, Matana University Tower
                         Jl. CBD Barat Kav, RT.1, Curug Sangereng, Kelapa Dua, Tangerang, Banten 15810.


1 Buatlah fungsi dengan bahasa pemrograman R untuk menghitung:

1.1 Intergral Tentu

library(mosaicCalc)
## Loading required package: mosaicCore
## Registered S3 method overwritten by 'mosaic':
##   method                           from   
##   fortify.SpatialPolygonsDataFrame ggplot2
## 
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
## 
##     D
fungsi = makeFun(x^2+2~x)

f = antiD(x^2+3*x ~ x) 

print(x = 3) - f(x = 1)
## [1] 3
## [1] 1.166667

1.2 Integral Tak Tentu

library(mosaicCore)

fungsi = makeFun(x^2 ~ x)

f = antiD(x^2 ~ x)

2 Buatlah fungsi dengan bahasa pemrograman R untuk menghitung:

2.1 Luas Lingkaran

Diketahui sebuah lingkaran memiliki diameter 28 cm. Berapakah luas lingkaran tersebut?

Luas_Lingkaran <- function(π,r)
{
  Luas = π*r^2
  return(cat("Luas:", Luas))
}

Luas_Lingkaran(22/7,142)
## Luas: 63372.57

2.2 Keliling Lingkaran

Sebuah lingkaran memiliki jari-jari 14 cm. Berapakah keliling lingkaran tersebut?

Keliling_Lingkaran <- function(π,r)
{
  Keliling = 2*π*r
  return(cat("Keliling:", Keliling))
}

Keliling_Lingkaran(22/7,14)
## Keliling: 88

2.3 Volume Bola

Hitunglah volume bola yang memiliki jari – jari 9 cm.

Volume_Bola <- function(π,r) 
{ 
  Volume = 4/3*π*r^3
  return(cat("Volume:", Volume))
}

Volume_Bola(3.14,9)
## Volume: 3052.08

3 Nilai Maksimum, Minimum, Rata-rata, Median, Mode, Variansi, Standard Deviasi pada data berfrekuensi.

Nilai Frekuensi
31-36 4
37-42 6
43-48 10
49-54 14
55-60 8
61-66 5
67-72 2

3.1 Nilai Maksimum

Nilai <-seq(31-36,67-72,0)
Frek <-c(4,6,10,14,8,5,2)

max_frek <- function(x,frek)
{
  keluaran=max(frek)
  return(cat("Nilai Maksimum:", keluaran))
}
max_frek(Nilai, Frek)
## Nilai Maksimum: 14

3.2 Nilai Minimum

Nilai <-seq(31-36,67-72,0)
Frek <-c(4,6,10,14,8,5,2)

min_frek <- function(x,frek)
{
  keluaran=min(frek)
  return(cat("Nilai Minimum:", keluaran))
}
min_frek(Nilai, Frek)
## Nilai Minimum: 2

3.3 Rata-rata

Nilai <-seq(31-36,67-72,0)
Frek <-c(4,6,10,14,8,5,2)

Rerata_frek <- function(x,frek)
{
  keluaran=sum(x*frek)/length(frek)
  return(cat("Nilai rata-rata:", keluaran))
}
Rerata_frek(Nilai, Frek)
## Nilai rata-rata: -35

3.4 Median

Nilai <-seq(31-36,67-72,0)
Frek <-c(4,6,10,14,8,5,2)

median_frek <- function(x,frek)
{
  keluaran=median(frek)
  return(cat("Nilai Median:", keluaran))
}
median_frek(Nilai, Frek)
## Nilai Median: 6

3.5 Nilai Mode

Ulangan_harian <- c(rep(31-36, 4), rep(37-42, 6), rep(43-48, 10), rep(49-54, 14), rep(55-60, 8), rep(61-66, 5), rep(67-72, 2))

Mode <- function(Ulangan_harian)
{
  mode <- unique(Ulangan_harian)
  mode[which.max(tabulate(match(Ulangan_harian, mode)))]
}

Mode(Ulangan_harian)
## [1] -5

3.6 Nilai Variansi

Nilai <-seq(31-36,67-72,0)
Frek <-c(4,6,10,14,8,5,2)

variansi_frek <- function(x,frek)
{
  keluaran=var(frek)
  return(cat("Nilai Variansi:", keluaran))
}
variansi_frek(Nilai, Frek)
## Nilai Variansi: 16.33333

3.7 Standard Deviasi

Nilai <-seq(31-36,67-72,0)
Frek <-c(4,6,10,14,8,5,2)

sqrt_frek <- function(x,frek)
{
  keluaran=sqrt(frek)
  return(cat("Standard Deviasi:", keluaran))
}
sqrt_frek(Nilai, Frek)
## Standard Deviasi: 2 2.44949 3.162278 3.741657 2.828427 2.236068 1.414214
div.main-container {
  max-width: 1280px;
}

.main-container {
  max-width: 1280px;
}

div.tocify {
  width: 20%;
  max-width: 280px;
  max-height: 85%;
}

.tocify {
  border: 1px solid #50719447;
}

body {
  text-align: justify
  
}

a {
  color: #2f4b7c;
    text-decoration: none;
}

p {
  margin: 0 0 13px;
  font-size: 1.1em;
  font-family: "calibri", Garamond, 'Comic Sans MS';
}

.list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus {
  z-index: 2;
  color: #ffffff;
    background-color: #003f5c;
    border-color: #2f4b7c;
}

.nav>li>a:hover, .nav>li>a:focus {
  text-decoration: none;
  background-color: #1a242f;
    color: white;
}

.nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus {
  color: #2c3e50;
    background-color: #ffffff;
    border: 1px solid #1a242f;
  border-bottom-color: transparent;
  cursor: default;
}

.nav-tabs {
  border-bottom: 1px solid #1a242f;
}

.nav-pills li>a {
  
  border: 2px solid #f47c3c40;
}

.nav-pills>li.active>a, .nav-pills>li.active>a:hover, .nav-pills>li.active>a:focus {
  color: #ffffff;
    background-color: #006b21c4;
}

.nav>li>a:hover, .nav>li>a:focus {
  
  text-decoration: none;
  background-color: #bbc1c78a;
    color: #6f6f6f;
}

.tocify {
  border: 1px solid #1a242f;
}

.tocify-extend-page {
  height: 24px !important;
}

h1 {
  font-size: 1.4em;
  font-weight: bolder;
}

h2, h3 {
  font-size: 1.2em;
  font-weight: bolder;
}

h3 {
  font-size: 1.1em;
  font-weight: bolder;
}

h1.title {
  font-size: 1.8em;
}


em {
  color: #ff7c43;
    margin-left: .5%;
  margin-right: .5%;
  font-weight: bold;
}

.date > em {
  font-size: 0.8em;
}

h4.author > em {
  color: white;
  text-decoration: initial;
  background: black;
  border-radius: 6px;
  padding: 6px 8px;
  margin: 5% 0;
  font-size: 0.8em;
}

code > span.kw {
  color:#54b4eb;
}


p > code {
  background-color: #ecf0f1!important;
    padding: 0.2%;
  margin: 0.2%;
  font-weight: 500;
}

pre {
    font-size: 16px;
    background-color: #6f6f6f;
    border: 1px solid #d2d2d2;
}

pre > code {
  color: #656565;
}

code.sourceCode.r {
  color: white;
}

code > span.ot {
  color: #ef6d5f;
}

code > span.st {
  color: #37982c;
}

code > span.dt {
  color: #2f4b7c;
}

code > span.dv {
  color: #2f4b7c;
}

code > span.fl {
  color: #18bc9c;
}

#header:after {
content: " ";
display: block;
margin-top: 2%;
margin-bottom: 2%;
}


code span.kw {
  color: #ff7c43;
}

img {
  color: white;
  font-style: italic;
  padding: 2px;
  text-align: center;
  margin: 5px;
}