Es la disciplina que trata de métodos de razonamiento. En un nivel elemental, la lógica proporciona reglas y técnicas para determinar si es o no valido un argumento dado.
\({\forall}\): para todo
\({\exists}\): para algún
\({\exists!}\): para un único
\({\nexists}\): para ninguno
\({\neg}\): negación
\(\land\): y
\(\lor\): o
\(\implies\): implicación
\(iif\): doble implicación; “si y solo si”
El estudio de la teoría de conjuntos tiene como objetivo brindar la oportunidad de aprender las relaciones básicas desarrolladas en las operaciones matemáticas y la resolución de problemas. Además, el estudio de la teoría de conjuntos aporta elementos que pueden servir como base para el aprendizaje de la programación y también de las bases de datos.
Es una colección de objetos llamados elementos, los conjuntos pueden ser finitos o infinitos y el orden en que se dan su elementos es irrelevante.
Supongamos que estamos refiriendonos a únicamente los elementos que existen en la habitación de un estudiante. Definamos entonces algunos conjuntos.
Consiste en dar una regla que permita establecer cuáles elementos pertenecen al conjunto
\(A=\left\{x|x\text{ es ropa del estudiante para dormir}\right\}\)
\(B=\left\{x|x\text{ es ropa del estudiante para salir}\right\}\)
Consiste en dar explicitamente cuáles elementos pertenecen al conjunto
\(C=\left\{\text{fundas, sabanas, sobresabanas, cobijas, cubrelechos}\right\}\)
\(D=\left\{\text{laptop, mouse, headphones, phone, path mouse}\right\}\)
Se dice que un conjunto es vacío cuando no tiene ningún elemento
\(\emptyset=\left\{\right\}\)
Un conjunto que tiene un solo elemento se llama conjunto unitario
El conjunto universal, referente o Universo, denotado por U, aquel conjunto al que pertenecen todos los elementos considerados en una situación dada o contexto específico.
\(\mathbb{U}=\left\{x|x\text{ es un elemento de la habitación del estudiante}\right\}\)
Existen cuatro premisas sobre conjuntos o ideas principales a tener en cuenta:
Cada conjunto es un subconjunto de sí mismo.
El conjunto vacío, por convención, es un subconjunto de cualquier conjunto.
Si un conjunto tiene \(n\) elementos, entonces habrá \(2^n\) subconjuntos de dicho conjunto.
\(\emptyset{\subseteq}A,B,C,D,\ldots{\subseteq}\mathbb{U}\)
\(A{\cap}B=\left\{x|x{\in}A{\land}x{\in}B\right\}\)
\[ \begin{align} A{\cap}B&=\left\{x|x\text{ es ropa para dormir}\text{ y }x\text{ es ropa para salir}\right\}\\ &=\left\{x|x\text{ es ropa para dormir y para salir}\right\}\\ &=\left\{x|x\text{ es ropa interior}\right\} \end{align} \]
\(A{\cup}B=\left\{x|x{\in}A{\lor}x{\in}B\right\}\)
\[ \begin{align} A{\cup}B&=\left\{x|x\text{ es ropa para dormir}\text{ o }x\text{ es ropa para salir}\right\}\\ &=\left\{x|x\text{ es ropa para dormir o para salir}\right\}\\ &=\left\{x|x\text{ es ropa}\right\} \end{align} \]
\(A{-}B=\left\{x|x{\in}A{\land}x{\not\in}B\right\}\)
\[ \begin{align} A{\cup}B&=\left\{x|x\text{ es ropa para dormir}\text{ y }x\text{ no es ropa para salir}\right\}\\ &=\left\{x|x\text{ es ropa para dormir y no es para salir}\right\}\\ &=\left\{x|x\text{ es ropa para dormir pero no ropa interior}\right\} \end{align} \]
\(A{\Delta}B=\left\{x|(x{\in}A{\land}x{\not\in}B){\lor}(x{\not\in}A{\land}x{\in}B){\lor}\right\}\)
\[ \begin{align} A{\cup}B&=\left\{x|x\text{ es ropa para dormir y no es ropa para salir}\text{ o }x\text{ no es ropa para dormir y es ropa para salir}\right\}\\ &=\left\{x|x\text{ es ropa para dormir y no es para salir, o, no es ropa para salir y es ropa para dormir}\right\}\\ &=\left\{x|x\text{ es ropa pero no es ropa interior}\right\} \end{align} \]
\(A^{c}=\left\{x|x{\not\in}A\right\}\): complemento
\[ \begin{align} A^{c}&=\left\{x|x\text{ es no ropa para dormir}\right\}\\ &=\left\{x|x\text{ es ropa para para salir y no es ropa interior}\right\}\\ &=\left\{x|x\text{ es ropa para salir pero no ropa interior}\right\} \end{align} \]
\(\emptyset\) o \(\varnothing\): conjunto vacío
\(\\N\): conjunto de los numeros naturales
\(\\Z\): conjunto de los numeros enteros
\(\\Q\): conjunto de los numeros racionales
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
A <- letters[1:10]
B <- letters[8:24]
AyB <- calculate.overlap(x = list("A" = A,"B" = B))
\[A = \left\{a, b, c, d, e, f, g, h, i, j\right\}\]
\[B = \left\{h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x\right\}\]
\[A{\cap}B = \left\{h, i, j\right\}\]
venn.plot <- draw.pairwise.venn(length(AyB$a1), length(AyB$a2), length(AyB$a3), c("A", "B"))
grid.draw(venn.plot)
grid.newpage()
venn.plot <- draw.pairwise.venn(area1 = 100,area2 = 70,cross.area = 68,category = c("Y", "Z"),fill = c("blue", "red"),lty = "blank",cex = 2,cat.cex = 2,cat.pos = c(285, 105),cat.dist = 0.09,cat.just = list(c(-1, -1), c(1, 1)),ext.pos = 30,ext.dist = -0.05,ext.length = 0.85,ext.line.lwd = 2,ext.line.lty = "dashed");grid.draw(venn.plot);grid.newpage();
venn.plot <- draw.pairwise.venn(area1 = 100,area2 = 70,cross.area = 0,category = c("First", "Second"),cat.pos = c(0, 180),euler.d = TRUE,sep.dist = 0.03,rotation.degree = 45);grid.draw(venn.plot);grid.newpage();
venn.plot <- draw.pairwise.venn(area1 = 100,area2 = 70,cross.area = 68,category = c("First", "Second"),fill = c("blue", "red"),lty = "blank",cex = 2,cat.cex = 2,cat.pos = c(285, 105),cat.dist = 0.09,cat.just = list(c(-1, -1), c(1, 1)),ext.pos = 30,ext.dist = -0.05,ext.length = 0.85,ext.line.lwd = 2,ext.line.lty = "dashed");grid.draw(venn.plot);grid.newpage();
venn.plot <- draw.pairwise.venn(area1 = 100,area2 = 70,cross.area = 0,category = c("First", "Second"),cat.pos = c(0, 180),euler.d = TRUE,sep.dist = 0.03,rotation.degree = 45);grid.draw(venn.plot);grid.newpage();
venn.plot <- draw.quad.venn(area1 = 72,area2 = 86,area3 = 50,area4 = 52,n12 = 44,n13 = 27,n14 = 32,n23 = 38,n24 = 32,n34 = 20,n123 = 18,n124 = 17,n134 = 11,n234 = 13,n1234 = 6,category = c("First", "Second", "Third", "Fourth"),fill = c("orange", "red", "green", "blue"),lty = "dashed",cex = 2,cat.cex = 2,cat.col = c("orange", "red", "green", "blue"));grid.draw(venn.plot);grid.newpage();
venn.plot <- draw.single.venn(100, "First");grid.draw(venn.plot);grid.newpage()
venn.plot <- draw.pairwise.venn(area1 = 100,
area2 = 70,
cross.area = 30,
category = c("First", "Second"))
grid.draw(venn.plot)
grid.newpage()
library(venn)
venn(2, ilab=TRUE, zcolor = "style")
library(venn)
venn(3, ilab=TRUE, zcolor = "style")
library(venn)
venn(5, ilab=TRUE, zcolor = "style")
library(venn)
venn(7, ilab=TRUE, zcolor = "style")
expr1 = expression(c^2 == a[1]^2 + b[1]^2)
expr2 = expression(paste(pi^{
x[i]
}, (1 - pi)^(n - x[i])))
expr3 = expression(paste("Media muestral: ", italic(n)^{
-1
}, sum(italic(x)[italic(i)], italic(i) == 1, italic(n)) == frac(italic(x)[1] + ... +
italic(x)[italic(n)], italic(n))))
expr4 = expression(paste("f(x", "|", alpha, ",", beta, ")" == frac(x^{
alpha - 1
} ~ (1 - x)^{
beta - 1
}, B(alpha, beta))))
plot(1, 1, type = "n", xlim = c(-1, 1), ylim = c(0.5, 4.5), xaxt = "n", yaxt = "n",
ann = FALSE)
text(0, 4:1, labels = c(expr1, expr2, expr3, expr4), cex = 1.35)
title(main = "Matemáticas y estadística", cex.main = 2)
\[y=x\]
curve(x+0, from = -10, to = 10, main = "x")
\[y=\left|x\right|\]
curve(abs(x), from = -10, to = 10, main = "|x|")
\[y=x^2\]
curve(x^2, from = -10, to = 10, main = "x^2")
\[y=x^3\]
curve(x^3, from = -10, to = 10, main = "x^3")
\[y=x^4\]
curve(x^4, from = -10, to = 10, main = "x^4")
\[y=x^4\]
curve(x^5, from = -10, to = 10, main = "x^5")
\[y=\sqrt{x}\]
curve(x^(1/2), from = -10, to = 10, main = "x^(1/2)")
\[y=\sqrt[3]{x}\]
curve(x^(1/3), from = -10, to = 10, main = "x^(1/3)")
\[y=\frac{1}{x}\]
curve(1/x, from = -10, to = 10, main = "1/x")
\[y=\frac{1}{x^2}\]
curve(1/(x^2), from = -10, to = 10, main = "1/(x^2)")
\[x!=x{\cdot}(x-1){\cdot}(x-2){\cdots}3{\cdot}2{\cdot}1\]
curve(factorial(x), from = -10, to = 10, main = "x!")
## Warning in gamma(x + 1): NaNs produced
\[y=2^x\]
curve(2^x, from = -10, to = 10, main = "2^x")
\[y=\frac{1}{\sqrt{x}}\]
curve(1/sqrt(x), from = -10, to = 10, main = "1/x^(1/2)")
## Warning in sqrt(x): NaNs produced
\[y=\frac{1}{e^x}\]
curve(exp(-x), from = -10, to = 10, main = "e^(-x)")
curve(log(x), from = -10, to = 10, main = “ln(x)”) curve(exp(x), from = -10, to = 10, main = “e^x”) curve(log2(x), from = -10, to = 10, main = “log2(x)”) curve(log10(x), from = -10, to = 10, main = “log10(x)”) curve(xlog(x), from = -10, to = 10, main = “xln(x)“) curve(log(x)^2, from = -10, to = 10, main =”ln(x)^2”)
library(mosaic)
## Registered S3 method overwritten by 'mosaic':
## method from
## fortify.SpatialPolygonsDataFrame ggplot2
##
## The 'mosaic' package masks several functions from core packages in order to add
## additional features. The original behavior of these functions should not be affected by this.
##
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
##
## count, do, tally
## The following object is masked from 'package:Matrix':
##
## mean
## The following object is masked from 'package:ggplot2':
##
## stat
## The following objects are masked from 'package:stats':
##
## binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
## quantile, sd, t.test, var
## The following objects are masked from 'package:base':
##
## max, mean, min, prod, range, sample, sum
\[g(x)=2x^2-5x+2-x\]
g=makeFun(2*x^2-5*x+2~x)
g(2)
## [1] 0
plotFun(g(x)~x, x.lim=range(-2,2))
plotFun(g(x)~x, x.lim=range(-2,2))
curve(dnorm, from = -3, to = 3, n = 1000, main = "Función de densidad Gaussiana")
text(-2, 0.3, expression(f(x) == paste(frac(1, sqrt(2 * pi * sigma^2)), " ", e^{
frac(-(x - mu)^2, 2 * sigma^2)
})), cex = 1.2)
curve(pnorm, from = -3, to = 3, n = 1000, main = "Función de distribución Gaussiana")
text(-2, 0.3, expression(F(x) == integral(paste(frac(1, sqrt(2 * pi * sigma^2)), " ", e^{
frac(-(x - mu)^2, 2 * sigma^2)
}),-infinity,+infinity)), cex = 1.2)
h <- rnorm(mean = 5, sd = 1, n = 1000)
hist(h, main = expression(paste("Sampled values, ", mu, "=5, ", sigma, "=1")), col = "grey")
library(latex2exp)
\[f(x)={\alpha}x^{\alpha}\]
x <- seq(0, 4, length.out = 100)
alpha <- 1:5
plot(x, xlim = c(0, 4), ylim = c(0, 10), xlab = "x", ylab = TeX("$\\alpha x^\\alpha$, donde $\\alpha \\in 1\\ldots 5$"),
type = "n", main = TeX("Usando $\\LaTeX$ para graficar una función exponencial!"))
invisible(sapply(alpha, function(a) lines(x, a * x^a, col = a)))
legend("topleft", legend = TeX(sprintf("$\\alpha = %d$", alpha)), lwd = 1, col = alpha)
\[3x+5\]
h<- function(x){
3*x+5
}
h(2)
## [1] 11
g<-function(x,m,b){
m*x+b
}
g(2,3,5)
## [1] 11
g(x=3,b=2,m=-1)
## [1] -1
\[f(x,t)=\sin(x)e^{-t}\]
plotFun(sin(2*pi*t/10)*exp(-0.2*x)~t&x, t.lim=range(0,20), x.lim=range(0,10), filled = F)
plotFun(sin(2*pi*t/10)*exp(-0.2*x)~t&x, t.lim=range(0,20), x.lim=range(0,10), filled = F, surface = T)
pareja.dos <- c(9800000,10200000)
mean(pareja.dos)
## [1] 1e+07
venn.plot <- draw.pairwise.venn(70, 100, 70, c("A", "B"))
grid.draw(venn.plot)
grid.newpage()
venn.plot <- draw.pairwise.venn(area1 = 100,area2 = 70,cross.area = 68,category = c("Y", "Z"),fill = c("pink", "green"),lty = "blank",cex = 2,cat.cex = 2,cat.pos = c(285, 105),cat.dist = 0.09,cat.just = list(c(-1, -1), c(1, 1)),ext.pos = 30,ext.dist = -0.05,ext.length = 0.85,ext.line.lwd = 2,ext.line.lty = "dashed");grid.draw(venn.plot);grid.newpage();
venn.plot <- draw.quad.venn(area1 = 72,area2 = 86,area3 = 50,area4 = 52,n12 = 44,n13 = 27,n14 = 32,n23 = 38,n24 = 32,n34 = 20,n123 = 18,n124 = 17,n134 = 11,n234 = 13,n1234 = 6,category = c("A", "B", "C", "D"),fill = c("orange", "red", "green", "blue"),lty = "dashed",cex = 2,cat.cex = 2,cat.col = c("gold", "red", "green", "blue"));grid.draw(venn.plot);grid.newpage();
library(venn)
venn(2, ilab=TRUE, zcolor = "style")
venn(3, counts = 1:8)