Homework 1

Derivatives

Find the derivatives with the respect to x of the following.

  1. F(x|x≥0)=1−e−λx
    f1 <- function(x){ 1-exp(-lx) }
    Deriv(f1)
## function (x) 
## 0


  1. F(x│b>a)=(x-a)/(b-a)
    f2 <- function(x){ (x-a)/(b-a) }
    Deriv(f2)
## function (x) 
## 1/(b - a)


  1. F(x│a<x≤c≤b)=(x-a)^2/(b-a)(c-a)
    f3 <- function(x){ (x-a)^2 / (b-a)(c-a) }
    Deriv(f3)
## function (x) 
## 2 * ((x - a)/(b - a)(c - a))


  1. F(x│a≤c<x<b)=1-(b-x)^2/((b-a)(c-a))
    f4 <- function(x){ 1-((b-x)^2 / (b-a)(c-a)) }
    Deriv(f4)
## function (x) 
## 2 * ((b - x)/(b - a)(c - a))



Please email to: kleber.perez@live.com for any suggestion.

    ** Math Bridge Homework 1 - MSDS 2019 Program.


Integrals

Solve the following definite and indefinite integrals.

  1. ∫_0^10〖 3x^3 dx〗
    f5 <- antiD(3*x^3~x, x=10)
    f5
## function (x = 10, C = 0) 
## 3/4 * x^4 + C


  1. ∫_(0)(x)〖xλe(-λx) dx〗
    f6 <- function(x) { x*antiD(exp(-x)~x)-(1-exp(-x)) }
    antiD(f6~x)
## function (x, C = 0, f6) 
## f6 * x + C


  1. ∫_(0)^(.5)〖 1/(b-a) dx〗
    f7 <- antiD((1/(b - a)) ~x, x = 0.5)
    f7
## function (x = 0.5, C = 0, b, a) 
## (1/(b - a)) * x + C


  1. ∫_(0)^(x) x 1/Γ(α)βα x^(α-1) e^(-βx ) dx
    f8 <- antiD(x*(1/(Γ(α)*B^α))*x^(α−1)*e^(−Bx)~x)
    f8
## function (x, a, B, e, Bx, C = 0) 
## {
##     numerical_integration(.newf, .wrt, as.list(match.call())[-1], 
##         formals(), from, ciName = intC, .tol)
## }
## <environment: 0x000000002207c2e0>

Hint: the last part of the equation is beginning with the gamma function is a Gamma probability distribution function. Try rearranging the terms to integrate another Gamma distribution out10 of the integral, as pdfs must integrate to 1.

Please email to: kleber.perez@live.com for any suggestion.






    ** Math Bridge Homework 1 - MSDS 2019 Program.


Linear Algebra

With the following matrix,

\[ x = [(1,2,3)(3,3,1)(4,6,8)] \]

  1. Invert it using Gaussian row reduction.
    m1 <- matrix(c(1, 3, 4, 2, 3, 6, 3, 1, 8), ncol = 3)
    solve(m1)
##      [,1] [,2]  [,3]
## [1,] -4.5 -0.5  1.75
## [2,]  5.0  1.0 -2.00
## [3,] -1.5 -0.5  0.75


  1. Find the determinant.
    m2 <- matrix(c(1, 3, 4, 2, 3, 6, 3, 1, 8), ncol = 3)
    determinant(m2)
## $modulus
## [1] 1.386294
## attr(,"logarithm")
## [1] TRUE
## 
## $sign
## [1] -1
## 
## attr(,"class")
## [1] "det"


  1. Conduct LU decomposition.
    m3 <- matrix(c(1, 3, 4, 2, 3, 6, 3, 1, 8), ncol = 3)
    lu(m3)
## 'MatrixFactorization' of Formal class 'denseLU' [package "Matrix"] with 4 slots
##   ..@ x       : num [1:9] 4 0.75 0.25 6 -1.5 ...
##   ..@ perm    : int [1:3] 3 2 3
##   ..@ Dimnames:List of 2
##   .. ..$ : NULL
##   .. ..$ : NULL
##   ..@ Dim     : int [1:2] 3 3
    expand(lu(m3))
## $L
## 3 x 3 Matrix of class "dtrMatrix" (unitriangular)
##      [,1]       [,2]       [,3]      
## [1,]  1.0000000          .          .
## [2,]  0.7500000  1.0000000          .
## [3,]  0.2500000 -0.3333333  1.0000000
## 
## $U
## 3 x 3 Matrix of class "dtrMatrix"
##      [,1]       [,2]       [,3]      
## [1,]  4.0000000  6.0000000  8.0000000
## [2,]          . -1.5000000 -5.0000000
## [3,]          .          . -0.6666667
## 
## $P
## 3 x 3 sparse Matrix of class "pMatrix"
##           
## [1,] . . |
## [2,] . | .
## [3,] | . .


  1. Multiply the matrix by it’s inverse.
    m4 <- matrix(c(1, 3, 4, 2, 3, 6, 3, 1, 8), ncol = 3)
    m4%*%solve(m4)
##               [,1]          [,2]         [,3]
## [1,]  1.000000e+00 -2.220446e-16 4.440892e-16
## [2,] -4.440892e-16  1.000000e+00 2.220446e-16
## [3,]  0.000000e+00  0.000000e+00 1.000000e+00


Please email to: kleber.perez@live.com for any suggestion.






    ** Math Bridge Homework 1 - MSDS 2019 Program.