diff --git a/1 - Strings.ipynb b/1 - Strings.ipynb
index 3675629..b67f9e4 100644
--- a/1 - Strings.ipynb
+++ b/1 - Strings.ipynb
@@ -4,21 +4,21 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "# Strings\n",
- "\n",
- "Topics:\n",
- "1. How to get a string\n",
- "2. String interpolation\n",
- "3. String concatenation"
+ "# Cadenas de texto (Strings)\n",
+ " \n",
+ "Temas:\n",
+ "1. Cómo obtener una cadena de texto\n",
+ "2. Interpolación de cadenas\n",
+ "3. Concatenación de cadenas"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "## How to get a string\n",
- "\n",
- "Enclose your characters in \" \" or \"\"\" \"\"\"!"
+ "## Cómo obtener una cadena de texto\n",
+ " \n",
+ "¡Encierra tus caracteres entre \" \" o \"\"\" \"\"\"!"
]
},
{
@@ -65,8 +65,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "There are a couple functional differences between strings enclosed in single and triple quotes.
\n",
- "One difference is that, in the latter case, you can use quotation marks within your string."
+ "Existen un par de diferencias funcionales entre las cadenas encerradas en comillas simples y triples.
\n",
+ "Una diferencia es que, en el segundo caso, puedes usar comillas dentro de tu cadena."
]
},
{
@@ -119,7 +119,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Note that ' ' define a character, but NOT a string!"
+ "¡Nota que ' ' define un carácter, pero NO una cadena de texto!"
]
},
{
@@ -172,10 +172,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## String interpolation\n",
- "\n",
- "We can use the $ sign to insert existing variables into a string and to evaluate expressions within a string.
\n",
- "Below is an example that contains some highly sensitive personal information."
+ "## Interpolación de cadenas\n",
+ " \n",
+ "Podemos usar el signo $ para insertar variables existentes en una cadena y para evaluar expresiones dentro de una cadena.
\n",
+ "Abajo hay un ejemplo que contiene información personal altamente sensible."
]
},
{
@@ -240,11 +240,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## String concatenation\n",
- "\n",
- "Below are three ways we can concatenate strings!
\n",
- "The first way is to use the `string()` function.
\n",
- "`string()` converts non-string inputs to strings."
+ "## Concatenación de cadenas\n",
+ " \n",
+ "¡Abajo hay tres formas de concatenar cadenas!
\n",
+ "La primera forma es usar la función `string()`.
\n",
+ "`string()` convierte entradas que no son cadenas a cadenas."
]
},
{
@@ -313,7 +313,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "We can also use `*` for concatenation!"
+ "¡También podemos usar `*` para concatenar!"
]
},
{
@@ -340,10 +340,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Exercises\n",
- "\n",
+ "### Ejercicios\n",
+ " \n",
"#### 2.1 \n",
- "Create a string that says \"hi\" 1000 times, first with `repeat` and then with the exponentiation operator, which can call `*` under the hood. Assign it the variable `hi` below."
+ "Crea una cadena que diga \"hi\" 1000 veces, primero con `repeat` y luego con el operador de potenciación, que puede llamar a `*` internamente. Asígnala a la variable `hi` abajo."
]
},
{
@@ -390,18 +390,18 @@
"metadata": {},
"source": [
"#### 2.2 \n",
- "Declare two variables\n",
- "\n",
+ "Declara dos variables\n",
+ " \n",
"```julia\n",
"a = 3\n",
"b = 4\n",
"```\n",
- "and use them to create two strings:\n",
+ "y úsalas para crear dos cadenas:\n",
"```julia\n",
"\"3 + 4\"\n",
"\"7\" \n",
"```\n",
- "and store the results in `c` and `d` respectively"
+ "y guarda los resultados en `c` y `d` respectivamente"
]
},
{
diff --git a/10 - Basic linear algebra.ipynb b/10 - Basic linear algebra.ipynb
index f3e0517..85877de 100644
--- a/10 - Basic linear algebra.ipynb
+++ b/10 - Basic linear algebra.ipynb
@@ -3,18 +3,12 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# Basic linear algebra in Julia\n",
- "Author: Andreas Noack Jensen (MIT & JuliaComputing) (https://twitter.com/anoackjensen?lang=en)\n",
- "(with edits from Jane Herriman)"
- ]
+ "source": "# Álgebra lineal básica en Julia\nAutor: Andreas Noack Jensen (MIT & JuliaComputing) (https://twitter.com/anoackjensen?lang=en)\n(con ediciones de Jane Herriman)"
},
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "First let's define a random matrix"
- ]
+ "source": "Primero definamos una matriz aleatoria"
},
{
"cell_type": "code",
@@ -42,9 +36,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "Define a vector of ones"
- ]
+ "source": "Definir un vector de unos"
},
{
"cell_type": "code",
@@ -72,12 +64,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "Notice that $A$ has type Array{Int64,2} but $x$ has type Array{Float64,1}. Julia defines the aliases Vector{Type}=Array{Type,1} and Matrix{Type}=Array{Type,2}. \n",
- "\n",
- "Many of the basic operations are the same as in other languages\n",
- "#### Multiplication"
- ]
+ "source": "Observa que $A$ tiene tipo Array{Int64,2} pero $x$ tiene tipo Array{Float64,1}. Julia define los alias Vector{Type}=Array{Type,1} y Matrix{Type}=Array{Type,2}. \n\nMuchas de las operaciones básicas son las mismas que en otros lenguajes\n#### Multiplicación"
},
{
"cell_type": "code",
@@ -105,10 +92,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "#### Transposition\n",
- "As in other languages `A'` is the conjugate transpose, or adjoint"
- ]
+ "source": "#### Transposición\nComo en otros lenguajes `A'` es la transpuesta conjugada, o adjunta"
},
{
"cell_type": "code",
@@ -136,9 +120,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "and we can get the transpose with"
- ]
+ "source": "y podemos obtener la transpuesta con"
},
{
"cell_type": "code",
@@ -166,10 +148,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "#### Transposed multiplication\n",
- "Julia allows us to write this without *"
- ]
+ "source": "#### Multiplicación transpuesta\nJulia nos permite escribir esto sin *"
},
{
"cell_type": "code",
@@ -197,10 +176,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "#### Solving linear systems \n",
- "The problem $Ax=b$ for ***square*** $A$ is solved by the \\ function."
- ]
+ "source": "#### Resolución de sistemas lineales \nEl problema $Ax=b$ para $A$ ***cuadrada*** se resuelve con la función \\."
},
{
"cell_type": "code",
@@ -228,9 +204,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "`A\\b` gives us the *least squares solution* if we have an overdetermined linear system (a \"tall\" matrix)"
- ]
+ "source": "`A\\b` nos da la *solución de mínimos cuadrados* si tenemos un sistema lineal sobredeterminado (una matriz \"alta\")"
},
{
"cell_type": "code",
@@ -280,9 +254,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "and the *minimum norm least squares solution* if we have a rank-deficient least squares problem"
- ]
+ "source": "y la *solución de mínimos cuadrados de norma mínima* si tenemos un problema de mínimos cuadrados deficiente en rango"
},
{
"cell_type": "code",
@@ -333,9 +305,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "Julia also gives us the minimum norm solution when we have an underdetermined solution (a \"short\" matrix)"
- ]
+ "source": "Julia también nos da la solución de norma mínima cuando tenemos una solución subdeterminada (una matriz \"corta\")"
},
{
"cell_type": "code",
@@ -386,22 +356,12 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# The LinearAlgebra library\n",
- "\n",
- "While much of linear algebra is available in Julia by default (as shown above), there's a standard library named `LinearAlgebra` that brings in many more relevant names and functions. In particular, it provides factorizations and some structured matrix types. As with all packages, you can bring these additional features into your session with a `using LinearAlgebra`."
- ]
+ "source": "# La librería LinearAlgebra\n\nAunque mucho del álgebra lineal está disponible en Julia por defecto (como se mostró arriba), hay una librería estándar llamada `LinearAlgebra` que incorpora muchos más nombres y funciones relevantes. En particular, proporciona factorizaciones y algunos tipos de matrices estructuradas. Como con todos los paquetes, puedes traer estas características adicionales a tu sesión con `using LinearAlgebra`."
},
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "### Exercises\n",
- "\n",
- "#### 10.1 \n",
- "Take the inner product (or \"dot\" product) of a vector `v` with itself and assign it to variable `dot_v`.\n",
- "\n"
- ]
+ "source": "### Ejercicios\n\n#### 10.1 \nToma el producto interior (o producto \"punto\") de un vector `v` consigo mismo y asígnalo a la variable `dot_v`."
},
{
"cell_type": "code",
@@ -458,10 +418,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "#### 10.2 \n",
- "Take the outer product of a vector v with itself and assign it to variable `outer_v`"
- ]
+ "source": "#### 10.2 \nToma el producto exterior de un vector v consigo mismo y asígnalo a la variable `outer_v`"
},
{
"cell_type": "code",
@@ -484,10 +441,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "#### 10.3 \n",
- "Use [LinearAlgebra.cross](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.cross) to compute the cross product of a vector v with itself and assign it to variable `cross_v`"
- ]
+ "source": "#### 10.3 \nUsa [LinearAlgebra.cross](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.cross) para calcular el producto cruz de un vector v consigo mismo y asígnalo a la variable `cross_v`"
},
{
"cell_type": "code",
@@ -535,4 +489,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
-}
+}
\ No newline at end of file
diff --git a/11 - Factorizations and other fun.ipynb b/11 - Factorizations and other fun.ipynb
index ce9be46..d441a68 100644
--- a/11 - Factorizations and other fun.ipynb
+++ b/11 - Factorizations and other fun.ipynb
@@ -3,22 +3,12 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# Factorizations and other fun\n",
- "Based on work by Andreas Noack\n",
- "\n",
- "## Outline\n",
- " - Factorizations\n",
- " - Special matrix structures\n",
- " - Generic linear algebra"
- ]
+ "source": "# Factorizaciones y otras diversiones\nBasado en el trabajo de Andreas Noack\n\n## Resumen\n - Factorizaciones\n - Estructuras de matrices especiales\n - Álgebra lineal genérica"
},
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "Before we get started, let's set up a linear system and use `LinearAlgebra` to bring in the factorizations and special matrix structures."
- ]
+ "source": "Antes de comenzar, configuremos un sistema lineal y usemos `LinearAlgebra` para incorporar las factorizaciones y estructuras de matrices especiales."
},
{
"cell_type": "code",
@@ -49,18 +39,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "## Factorizations\n",
- "\n",
- "#### LU factorizations\n",
- "In Julia we can perform an LU factorization\n",
- "```julia\n",
- "PA = LU\n",
- "``` \n",
- "where `P` is a permutation matrix, `L` is lower triangular unit diagonal and `U` is upper triangular, using `lufact`.\n",
- "\n",
- "Julia allows computing the LU factorization and defines a composite factorization type for storing it."
- ]
+ "source": "## Factorizaciones\n\n#### Factorizaciones LU\nEn Julia podemos realizar una factorización LU\n```julia\nPA = LU\n``` \ndonde `P` es una matriz de permutación, `L` es triangular inferior con diagonal unitaria y `U` es triangular superior, usando `lufact`.\n\nJulia permite calcular la factorización LU y define un tipo de factorización compuesta para almacenarla."
},
{
"cell_type": "code",
@@ -1014,4 +993,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
-}
+}
\ No newline at end of file
diff --git a/2 - Data structures.ipynb b/2 - Data structures.ipynb
index ba9b34b..a07c82d 100644
--- a/2 - Data structures.ipynb
+++ b/2 - Data structures.ipynb
@@ -4,32 +4,33 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "# Data structures\n",
- "\n",
- "Once we start working with many pieces of data at once, it will be convenient for us to store data in structures like arrays or dictionaries (rather than just relying on variables).
\n",
- "\n",
- "Types of data structures covered:\n",
- "1. Tuples\n",
- "2. Dictionaries\n",
- "3. Arrays\n",
- "\n",
+ "# Estructuras de datos\n",
+ " \n",
+ "Cuando empezamos a trabajar con muchos datos a la vez, es conveniente almacenarlos en estructuras como arreglos o diccionarios (en lugar de depender solo de variables).
\n",
+ " \n",
+ "Tipos de estructuras de datos que veremos:\n",
+ "1. Tuplas\n",
+ "2. Diccionarios\n",
+ "3. Arreglos\n",
+ " \n",
"
\n",
- "As an overview, tuples and arrays are both ordered sequences of elements (so we can index into them). Dictionaries and arrays are both mutable.\n",
- "We'll explain this more below!"
+ "Como resumen, las tuplas y los arreglos son secuencias ordenadas de elementos (por lo que podemos indexarlas). Los diccionarios y los arreglos son mutables.\n",
+ "¡Explicaremos esto más abajo!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Tuples\n",
- "\n",
- "We can create a tuple by enclosing an ordered collection of elements in `( )`.\n",
- "\n",
- "Syntax:
\n",
+ "## Tuplas\n",
+ " \n",
+ "Podemos crear una tupla encerrando una colección ordenada de elementos entre `( )`.\n",
+ " \n",
+ "Sintaxis:
\n",
"```julia\n",
- "(item1, item2, ...)\n",
- "```\n"
+ "(elemento1, elemento2, ...)\n",
+ "```\n",
+ " "
]
},
{
@@ -56,7 +57,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "We can index into this tuple,"
+ "Podemos indexar esta tupla,"
]
},
{
@@ -83,7 +84,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "but since tuples are immutable, we can't update it"
+ "pero como las tuplas son inmutables, no podemos actualizarlas"
]
},
{
@@ -116,12 +117,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Now in 1.6: NamedTuples\n",
- "\n",
- "As you might guess, `NamedTuple`s are just like `Tuple`s except that each element additionally has a name! They have a special syntax using `=` inside a tuple:\n",
- "\n",
+ "## Nuevo en 1.6: NamedTuples\n",
+ " \n",
+ "Como puedes imaginar, los `NamedTuple` son como las `Tuple` pero cada elemento tiene además un nombre. Tienen una sintaxis especial usando `=` dentro de la tupla:\n",
+ " \n",
"```julia\n",
- "(name1 = item1, name2 = item2, ...)\n",
+ "(nombre1 = elemento1, nombre2 = elemento2, ...)\n",
"```"
]
},
@@ -149,7 +150,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Like regular `Tuples`, `NamedTuples` are ordered, so we can retrieve their elements via indexing:"
+ "Al igual que las `Tuples` normales, los `NamedTuples` son ordenados, por lo que podemos recuperar sus elementos mediante índices:"
]
},
{
@@ -176,7 +177,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "They also add the special ability to access values by their name:"
+ "También añaden la habilidad especial de acceder a los valores por su nombre:"
]
},
{
@@ -203,16 +204,16 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Dictionaries\n",
- "\n",
- "If we have sets of data related to one another, we may choose to store that data in a dictionary. We can create a dictionary using the `Dict()` function, which we can initialize as an empty dictionary or one storing key, value pairs.\n",
- "\n",
- "Syntax:\n",
+ "## Diccionarios\n",
+ " \n",
+ "Si tenemos conjuntos de datos relacionados entre sí, podemos elegir almacenarlos en un diccionario. Podemos crear un diccionario usando la función `Dict()`, que podemos inicializar como un diccionario vacío o con pares clave-valor.\n",
+ " \n",
+ "Sintaxis:\n",
"```julia\n",
- "Dict(key1 => value1, key2 => value2, ...)\n",
+ "Dict(clave1 => valor1, clave2 => valor2, ...)\n",
"```\n",
- "\n",
- "A good example is a contacts list, where we associate names with phone numbers."
+ " \n",
+ "Un buen ejemplo es una lista de contactos, donde asociamos nombres con números de teléfono."
]
},
{
@@ -241,7 +242,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "In this example, each name and number is a \"key\" and \"value\" pair. We can grab Jenny's number (a value) using the associated key"
+ "En este ejemplo, cada nombre y número es un par \"clave\" y \"valor\". Podemos obtener el número de Jenny (un valor) usando la clave asociada"
]
},
{
@@ -268,7 +269,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "We can add another entry to this dictionary as follows"
+ "Podemos agregar otra entrada a este diccionario así"
]
},
{
@@ -295,7 +296,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Let's check what our phonebook looks like now..."
+ "Veamos cómo luce ahora nuestra agenda telefónica..."
]
},
{
@@ -325,7 +326,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "We can delete Kramer from our contact list - and simultaneously grab his number - by using `pop!`"
+ "Podemos eliminar a Kramer de nuestra lista de contactos —y al mismo tiempo obtener su número— usando `pop!`"
]
},
{
@@ -374,7 +375,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Unlike tuples and arrays, dictionaries are not ordered. So, we can't index into them."
+ "A diferencia de las tuplas y los arreglos, los diccionarios no son ordenados. Por lo tanto, no podemos indexarlos."
]
},
{
@@ -409,25 +410,24 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "In the example above, `julia` thinks you're trying to access a value associated with the key `1`."
+ "En el ejemplo anterior, `julia` piensa que intentas acceder a un valor asociado a la clave `1`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Arrays\n",
- "\n",
- "Unlike tuples, arrays are mutable. Unlike dictionaries, arrays contain ordered collections.
\n",
- "We can create an array by enclosing this collection in `[ ]`.\n",
- "\n",
- "Syntax:
\n",
+ "## Arreglos\n",
+ " \n",
+ "A diferencia de las tuplas, los arreglos son mutables. A diferencia de los diccionarios, los arreglos contienen colecciones ordenadas.
\n",
+ "Podemos crear un arreglo encerrando la colección entre `[ ]`.\n",
+ " \n",
+ "Sintaxis:
\n",
"```julia\n",
- "[item1, item2, ...]\n",
+ "[elemento1, elemento2, ...]\n",
"```\n",
- "\n",
- "\n",
- "For example, we might create an array to keep track of my friends"
+ " \n",
+ "Por ejemplo, podríamos crear un arreglo para llevar registro de mis amigos"
]
},
{
@@ -459,14 +459,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "The `1` in `Array{String,1}` means this is a one dimensional vector. An `Array{String,2}` would be a 2d matrix, etc. The `String` is the type of each element."
+ "El `1` en `Array{String,1}` significa que es un vector unidimensional. Un `Array{String,2}` sería una matriz 2D, etc. `String` es el tipo de cada elemento."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "or to store a sequence of numbers"
+ "o para almacenar una secuencia de números"
]
},
{
@@ -526,7 +526,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Once we have an array, we can grab individual pieces of data from inside that array by indexing into the array. For example, if we want the third friend listed in `myfriends`, we write"
+ "Una vez que tenemos un arreglo, podemos obtener elementos individuales indexando el arreglo. Por ejemplo, si queremos el tercer amigo listado en `myfriends`, escribimos"
]
},
{
@@ -553,7 +553,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "We can use indexing to edit an existing element of an array"
+ "Podemos usar la indexación para editar un elemento existente de un arreglo"
]
},
{
@@ -580,16 +580,16 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Yes, Julia is 1-based indexing, not 0-based like Python. Wars are fought over lesser issues. I have a friend with the wisdom of Solomon who proposes settling this once and for all with ½ 😃"
+ "Sí, Julia usa indexación desde 1, no desde 0 como Python. Se han librado guerras por cosas menores. Tengo un amigo con la sabiduría de Salomón que propone zanjar esto de una vez por todas con ½ 😃"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "We can also edit the array by using the `push!` and `pop!` functions. `push!` adds an element to the end of an array and `pop!` removes the last element of an array.\n",
- "\n",
- "We can add another number to our fibonnaci sequence"
+ "También podemos editar el arreglo usando las funciones `push!` y `pop!`. `push!` agrega un elemento al final del arreglo y `pop!` elimina el último elemento.\n",
+ " \n",
+ "Podemos agregar otro número a nuestra secuencia de Fibonacci"
]
},
{
@@ -624,7 +624,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "and then remove it"
+ "y luego eliminarlo"
]
},
{
@@ -678,9 +678,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "So far I've given examples of only 1D arrays of scalars, but arrays can have an arbitrary number of dimensions and can also store other arrays. \n",
+ "Hasta ahora solo he dado ejemplos de arreglos 1D de escalares, pero los arreglos pueden tener cualquier número de dimensiones y también pueden almacenar otros arreglos. \n",
"
\n",
- "For example, the following are arrays of arrays:"
+ "Por ejemplo, los siguientes son arreglos de arreglos:"
]
},
{
@@ -732,7 +732,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Below are examples of 2D and 3D arrays populated with random values."
+ "Abajo hay ejemplos de arreglos 2D y 3D poblados con valores aleatorios."
]
},
{
@@ -794,7 +794,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Be careful when you want to copy arrays!"
+ "¡Ten cuidado cuando quieras copiar arreglos!"
]
},
{
@@ -902,11 +902,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Editing `somenumbers` caused `fibonacci` to get updated as well!\n",
- "\n",
- "In the above example, we didn't actually make a copy of `fibonacci`. We just created a new way to access the entries in the array bound to `fibonacci`.\n",
- "\n",
- "If we'd like to make a copy of the array bound to `fibonacci`, we can use the `copy` function."
+ "¡Editar `somenumbers` hizo que `fibonacci` también se actualizara!\n",
+ " \n",
+ "En el ejemplo anterior, en realidad no hicimos una copia de `fibonacci`. Solo creamos una nueva forma de acceder a las entradas del arreglo referenciado por `fibonacci`.\n",
+ " \n",
+ "Si queremos hacer una copia del arreglo referenciado por `fibonacci`, podemos usar la función `copy`."
]
},
{
@@ -1016,23 +1016,23 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "In this last example, fibonacci was not updated. Therefore we see that the arrays bound to `somemorenumbers` and `fibonacci` are distinct."
+ "En este último ejemplo, fibonacci no se actualizó. Por lo tanto, vemos que los arreglos referenciados por `somemorenumbers` y `fibonacci` son distintos."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Exercises\n",
- "\n",
+ "### Ejercicios\n",
+ " \n",
"#### 3.1 \n",
- "Create an array, `a_ray`, with the following code:\n",
- "\n",
+ "Crea un arreglo, `a_ray`, con el siguiente código:\n",
+ " \n",
"```julia\n",
"a_ray = [1, 2, 3]\n",
"```\n",
- "\n",
- "Add the number `4` to the end of this array and then remove it."
+ " \n",
+ "Agrega el número `4` al final de este arreglo y luego elimínalo."
]
},
{
@@ -1069,12 +1069,12 @@
"metadata": {},
"source": [
"#### 3.2 \n",
- "Try to add \"Emergency\" as key to `myphonebook` with the value `string(911)` with the following code\n",
+ "Intenta agregar \"Emergency\" como clave a `myphonebook` con el valor `string(911)` con el siguiente código\n",
"```julia\n",
"myphonebook[\"Emergency\"] = 911\n",
"```\n",
- "\n",
- "Why doesn't this work?"
+ " \n",
+ "¿Por qué no funciona esto?"
]
},
{
@@ -1089,8 +1089,8 @@
"metadata": {},
"source": [
"#### 3.3 \n",
- "Create a new dictionary called `flexible_phonebook` that has Jenny's number stored as an integer and Ghostbusters' number stored as a string with the following code\n",
- "\n",
+ "Crea un nuevo diccionario llamado `flexible_phonebook` que tenga el número de Jenny almacenado como entero y el de los Cazafantasmas como cadena, con el siguiente código\n",
+ " \n",
"```julia\n",
"flexible_phonebook = Dict(\"Jenny\" => 8675309, \"Ghostbusters\" => \"555-2368\")\n",
"```"
@@ -1130,7 +1130,7 @@
"metadata": {},
"source": [
"#### 3.4 \n",
- "Add the key \"Emergency\" with the value `911` (an integer) to `flexible_phonebook`."
+ "Agrega la clave \"Emergency\" con el valor `911` (un entero) a `flexible_phonebook`."
]
},
{
@@ -1189,7 +1189,7 @@
"metadata": {},
"source": [
"#### 3.5 \n",
- "Why can we add an integer as a value to `flexible_phonebook` but not `myphonebook`? How could we have initialized `myphonebook` so that it would accept integers as values? (hint: try using [Julia's documentation for dictionaries](https://docs.julialang.org/en/v1/base/collections/#Dictionaries))"
+ "¿Por qué podemos agregar un entero como valor a `flexible_phonebook` pero no a `myphonebook`? ¿Cómo podríamos haber inicializado `myphonebook` para que aceptara enteros como valores? (pista: consulta la [documentación de diccionarios de Julia](https://docs.julialang.org/en/v1/base/collections/#Dictionaries))"
]
},
{
diff --git a/3 - Loops.ipynb b/3 - Loops.ipynb
index af4d019..237119f 100644
--- a/3 - Loops.ipynb
+++ b/3 - Loops.ipynb
@@ -4,24 +4,24 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "# Loops\n",
- "\n",
- "Topics:\n",
- "1. `while` loops\n",
- "2. `for` loops\n",
+ "# Bucles (Loops)\n",
+ " \n",
+ "Temas:\n",
+ "1. Bucles `while`\n",
+ "2. Bucles `for`\n",
"
\n",
- "\n",
- "## while loops\n",
- "\n",
- "The syntax for a `while` is\n",
- "\n",
+ " \n",
+ "## Bucles while\n",
+ " \n",
+ "La sintaxis para un `while` es:\n",
+ " \n",
"```julia\n",
- "while *condition*\n",
- " *loop body*\n",
+ "while *condición*\n",
+ " *cuerpo del bucle*\n",
"end\n",
"```\n",
- "\n",
- "For example, we could use `while` to count or to iterate over an array."
+ " \n",
+ "Por ejemplo, podríamos usar `while` para contar o para iterar sobre un arreglo."
]
},
{
@@ -97,17 +97,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## for loops\n",
- "\n",
- "The syntax for a `for` loop is\n",
- "\n",
+ "## Bucles for\n",
+ " \n",
+ "La sintaxis para un bucle `for` es:\n",
+ " \n",
"```julia\n",
- "for *var* in *loop iterable*\n",
- " *loop body*\n",
+ "for *var* in *colección*\n",
+ " *cuerpo del bucle*\n",
"end\n",
"```\n",
- "\n",
- "We could use a for loop to generate the same results as either of the examples above:"
+ " \n",
+ "Podríamos usar un bucle for para generar los mismos resultados que cualquiera de los ejemplos anteriores:"
]
},
{
@@ -167,11 +167,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Now let's use `for` loops to create some addition tables, where the value of every entry is the sum of its row and column indices.
\n",
- "\n",
- "Note that we iterate over this array via column-major loops in order to get the best performance. More information about fast indexing of multidimensional arrays inside nested loops can be found at https://docs.julialang.org/en/v1/manual/performance-tips/#Access-arrays-in-memory-order,-along-columns-1\n",
- "\n",
- "First, we initialize an array with zeros."
+ "Ahora usemos bucles `for` para crear algunas tablas de suma, donde el valor de cada entrada es la suma de sus índices de fila y columna.
\n",
+ " \n",
+ "Nota que iteramos sobre este arreglo con bucles en orden columna-primero para obtener el mejor rendimiento. Más información sobre el acceso rápido a arreglos multidimensionales en bucles anidados se puede encontrar en https://docs.julialang.org/en/v1/manual/performance-tips/#Access-arrays-in-memory-order,-along-columns-1\n",
+ " \n",
+ "Primero, inicializamos un arreglo con ceros."
]
},
{
@@ -234,7 +234,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Here's some syntactic sugar for the same nested `for` loop"
+ "Aquí tienes una forma más concisa (azúcar sintáctica) para el mismo bucle `for` anidado"
]
},
{
@@ -294,7 +294,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "The more \"Julia\" way to create this addition table would have been with an *array comprehension*."
+ "La forma más \"juliana\" de crear esta tabla de suma habría sido con una *comprensión de arreglos* (array comprehension)."
]
},
{
@@ -326,10 +326,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Exercises\n",
- "\n",
+ "### Ejercicios\n",
+ " \n",
"#### 4.1 \n",
- "Loop over integers between 1 and 100 and print their squares."
+ "Itera sobre los enteros del 1 al 100 e imprime sus cuadrados."
]
},
{
@@ -344,8 +344,8 @@
"metadata": {},
"source": [
"#### 4.2 \n",
- "Add to the code above a bit to create a dictionary, `squares` that holds integers and their squares as key, value pairs such that\n",
- "\n",
+ "Agrega al código anterior un poco para crear un diccionario, `squares`, que almacene enteros y sus cuadrados como pares clave-valor de modo que\n",
+ " \n",
"```julia\n",
"squares[10] == 100\n",
"```"
@@ -386,7 +386,7 @@
"metadata": {},
"source": [
"#### 4.3 \n",
- "Use an array comprehension to create an an array `squares_arr` that stores the squares for all integers between 1 and 100."
+ "Usa una comprensión de arreglos para crear un arreglo `squares_arr` que almacene los cuadrados de todos los enteros del 1 al 100."
]
},
{
diff --git a/4 - Conditionals.ipynb b/4 - Conditionals.ipynb
index 5751c00..87f640a 100644
--- a/4 - Conditionals.ipynb
+++ b/4 - Conditionals.ipynb
@@ -4,24 +4,24 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "# Conditionals\n",
- "\n",
- "#### with the `if` keyword\n",
- "In Julia, the syntax\n",
- "\n",
+ "# Condicionales\n",
+ " \n",
+ "#### con la palabra clave `if`\n",
+ "En Julia, la sintaxis\n",
+ " \n",
"```julia\n",
- "if *condition 1*\n",
- " *option 1*\n",
- "elseif *condition 2*\n",
- " *option 2*\n",
+ "if *condición 1*\n",
+ " *opción 1*\n",
+ "elseif *condición 2*\n",
+ " *opción 2*\n",
"else\n",
- " *option 3*\n",
+ " *opción 3*\n",
"end\n",
"```\n",
- "\n",
- "allows us to conditionally evaluate one of our options.\n",
+ " \n",
+ "nos permite evaluar condicionalmente una de nuestras opciones.\n",
"
\n",
- "For example, we might want to implement the FizzBuzz test: given a number, N, print \"Fizz\" if N is divisible by 3, \"Buzz\" if N is divisible by 5, and \"FizzBuzz\" if N is divisible by 3 and 5. Otherwise just print the number itself! Enter your choice for `N` here:"
+ "Por ejemplo, podríamos querer implementar el test de FizzBuzz: dado un número N, imprime \"Fizz\" si N es divisible por 3, \"Buzz\" si N es divisible por 5, y \"FizzBuzz\" si N es divisible por 3 y 5. ¡De lo contrario, imprime el número! Escribe tu elección para `N` aquí:"
]
},
{
@@ -73,16 +73,16 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "#### with ternary operators\n",
- "\n",
- "For this last block, we could instead use the ternary operator with the syntax\n",
- "\n",
+ "#### con operadores ternarios\n",
+ " \n",
+ "Para este último bloque, podríamos usar el operador ternario con la sintaxis\n",
+ " \n",
"```julia\n",
"a ? b : c\n",
"```\n",
- "\n",
- "which equates to \n",
- "\n",
+ " \n",
+ "que equivale a\n",
+ " \n",
"```julia\n",
"if a\n",
" b\n",
@@ -96,7 +96,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Now let's say we want to return the larger of two numbers. Give `x` and `y` values here:"
+ "Ahora supongamos que queremos devolver el mayor de dos números. Asigna valores a `x` y `y` aquí:"
]
},
{
@@ -124,7 +124,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Using the `if` and `else` keywords, we might write:"
+ "Usando las palabras clave `if` y `else`, podríamos escribir:"
]
},
{
@@ -155,7 +155,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "and as a ternary operator, the conditional looks like this:"
+ "y como operador ternario, la condicional se ve así:"
]
},
{
@@ -182,13 +182,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "#### with short-circuit evaluation\n",
- "\n",
- "We've already seen expressions with the syntax\n",
+ "#### con evaluación de cortocircuito (short-circuit)\n",
+ " \n",
+ "Ya hemos visto expresiones con la sintaxis\n",
"```julia\n",
"a && b\n",
"```\n",
- "to return true if both `a` and `b` are true. Of course, if `a` is false, Julia doesn't even need to know the value of `b` in order to determine that the overall result will be false. So Julia doesn't even need to check what `b` is; it can just \"short-circuit\" and immediately return `false`. The second argument `b` might be a more complicated expression like a function call with a side-effect, in which case it won't even be called:"
+ "para devolver verdadero si tanto `a` como `b` son verdaderos. Por supuesto, si `a` es falso, Julia ni siquiera necesita saber el valor de `b` para determinar que el resultado será falso. Así que Julia puede simplemente \"cortar\" y devolver `false` inmediatamente. El segundo argumento `b` podría ser una expresión más complicada como una llamada a función con efecto secundario, en cuyo caso ni siquiera se ejecutará:"
]
},
{
@@ -242,7 +242,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "On the other hand, if `a` is true, Julia knows it can just return the value of `b` as the overall expression. This means that `b` doesn't necessarily need evaluate to `true` or `false`! `b` could even be an error:"
+ "Por otro lado, si `a` es verdadero, Julia sabe que puede devolver el valor de `b` como el resultado de la expresión. Esto significa que `b` no necesariamente debe evaluarse a `true` o `false`. ¡Incluso `b` podría ser un error!"
]
},
{
@@ -277,7 +277,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Similarly, check out the `||` operator, which also uses short-circuit evaluation to perform the \"or\" operation."
+ "De manera similar, observa el operador `||`, que también usa evaluación de cortocircuito para realizar la operación \"o\"."
]
},
{
@@ -328,10 +328,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Exercises\n",
- "\n",
+ "### Ejercicios\n",
+ " \n",
"#### 5.1 \n",
- "Write a conditional statement that prints a number if the number is even and the string \"odd\" if the number is odd."
+ "Escribe una sentencia condicional que imprima un número si el número es par y la cadena \"odd\" si el número es impar."
]
},
{
@@ -346,7 +346,7 @@
"metadata": {},
"source": [
"#### 5.2 \n",
- "Rewrite the code from 5.1 using a ternary operator."
+ "Reescribe el código del ejercicio 5.1 usando un operador ternario."
]
},
{
diff --git a/5 - Functions.ipynb b/5 - Functions.ipynb
index 39f1bb9..bd0d399 100644
--- a/5 - Functions.ipynb
+++ b/5 - Functions.ipynb
@@ -4,21 +4,21 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "# Functions\n",
- "\n",
- "Topics:\n",
- "1. How to declare a function\n",
- "2. Duck-typing in Julia\n",
- "3. Mutating vs. non-mutating functions\n",
- "4. Some higher order functions"
+ "# Funciones\n",
+ " \n",
+ "Temas:\n",
+ "1. Cómo declarar una función\n",
+ "2. Duck-typing en Julia\n",
+ "3. Funciones mutantes vs. no mutantes\n",
+ "4. Algunas funciones de orden superior"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "## How to declare a function\n",
- "Julia gives us a few different ways to write a function. The first requires the `function` and `end` keywords"
+ "## Cómo declarar una función\n",
+ "Julia nos da varias formas de escribir una función. La primera requiere las palabras clave `function` y `end`"
]
},
{
@@ -69,7 +69,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "We can call either of these functions like this:"
+ "Podemos llamar a cualquiera de estas funciones así:"
]
},
{
@@ -113,7 +113,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Alternatively, we could have declared either of these functions in a single line"
+ "Alternativamente, podríamos haber declarado cualquiera de estas funciones en una sola línea"
]
},
{
@@ -197,7 +197,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Finally, we could have declared these as \"anonymous\" functions"
+ "Finalmente, podríamos haber declarado estas como funciones \"anónimas\""
]
},
{
@@ -281,10 +281,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Duck-typing in Julia\n",
- "*\"If it quacks like a duck, it's a duck.\"*
\n",
- "Julia functions will just work on whatever inputs make sense.
\n",
- "For example, `sayhi` works on the name of this minor tv character, written as an integer..."
+ "## Duck-typing en Julia\n",
+ "*\"Si grazna como un pato, es un pato.\"*
\n",
+ "Las funciones en Julia funcionarán con cualquier entrada que tenga sentido.
\n",
+ "Por ejemplo, `sayhi` funciona con el nombre de este personaje menor de TV, escrito como un entero..."
]
},
{
@@ -308,7 +308,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "And `f` will work on a matrix. "
+ "Y `f` funcionará con una matriz."
]
},
{
@@ -362,7 +362,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "`f` will also work on a string like \"hi\" because `*` is defined for string inputs as string concatenation."
+ "`f` también funcionará con una cadena como \"hi\" porque `*` está definido para entradas de tipo string como concatenación de cadenas."
]
},
{
@@ -389,7 +389,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "On the other hand, `f` will not work on a vector. Unlike `A^2`, which is well-defined, the meaning of `v^2` for a vector, `v`, is not a well-defined algebraic operation. "
+ "Por otro lado, `f` no funcionará con un vector. A diferencia de `A^2`, que está bien definido, el significado de `v^2` para un vector `v` no es una operación algebraica bien definida."
]
},
{
@@ -452,11 +452,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Mutating vs. non-mutating functions\n",
- "\n",
- "By convention, functions followed by `!` alter their contents and functions lacking `!` do not.\n",
- "\n",
- "For example, let's look at the difference between `sort` and `sort!`.\n"
+ "## Funciones mutantes vs. no mutantes\n",
+ " \n",
+ "Por convención, las funciones que terminan con `!` alteran su contenido y las que no tienen `!` no lo hacen.\n",
+ " \n",
+ "Por ejemplo, veamos la diferencia entre `sort` y `sort!`."
]
},
{
@@ -532,9 +532,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "`sort(v)` returns a sorted array that contains the same elements as `v`, but `v` is left unchanged.
\n",
- "\n",
- "On the other hand, when we run `sort!(v)`, the contents of v are sorted within the array `v`."
+ "`sort(v)` devuelve un arreglo ordenado que contiene los mismos elementos que `v`, pero `v` permanece sin cambios.
\n",
+ " \n",
+ "En cambio, cuando ejecutamos `sort!(v)`, el contenido de `v` se ordena dentro del mismo arreglo."
]
},
{
@@ -587,17 +587,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Some higher order functions\n",
- "\n",
+ "## Algunas funciones de orden superior\n",
+ " \n",
"### map\n",
- "\n",
- "`map` is a \"higher-order\" function in Julia that *takes a function* as one of its input arguments. \n",
- "`map` then applies that function to every element of the data structure you pass it. For example, executing\n",
- "\n",
+ " \n",
+ "`map` es una función de \"orden superior\" en Julia que *toma una función* como uno de sus argumentos de entrada. \n",
+ "`map` aplica esa función a cada elemento de la estructura de datos que le pases. Por ejemplo, ejecutar\n",
+ " \n",
"```julia\n",
"map(f, [1, 2, 3])\n",
"```\n",
- "will give you an output array where the function `f` has been applied to all elements of `[1, 2, 3]`\n",
+ "te dará un arreglo de salida donde la función `f` se ha aplicado a todos los elementos de `[1, 2, 3]`\n",
"```julia\n",
"[f(1), f(2), f(3)]\n",
"```"
@@ -630,9 +630,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Here we've squared all the elements of the vector `[1, 2, 3]`, rather than squaring the vector `[1, 2, 3]`.\n",
- "\n",
- "To do this, we could have passed to `map` an anonymous function rather than a named function, such as"
+ "Aquí hemos elevado al cuadrado todos los elementos del vector `[1, 2, 3]`, en lugar de elevar al cuadrado el vector `[1, 2, 3]`.\n",
+ " \n",
+ "Para esto, podríamos haber pasado a `map` una función anónima en vez de una función con nombre, como"
]
},
{
@@ -659,7 +659,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "via"
+ "¡Eso es todo por ahora sobre funciones!\n",
+ " \n",
+ "En la siguiente sección, aprenderemos sobre paquetes en Julia."
]
},
{
@@ -689,16 +691,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "and now we've cubed all the elements of `[1, 2, 3]`!"
+ "¿Preguntas o dudas sobre funciones en Julia? ¡No dudes en preguntar!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### broadcast\n",
- "\n",
- "`broadcast` is another higher-order function like `map`. `broadcast` is a generalization of `map`, so it can do every thing `map` can do and more. The syntax for calling `broadcast` is the same as for calling `map`"
+ "## Resumen\n",
+ "- Las funciones en Julia se definen con la palabra clave `function` o con una sintaxis abreviada.\n",
+ "- Se pueden pasar funciones como argumentos a otras funciones.\n",
+ "- Las funciones anónimas son útiles para operaciones rápidas y sencillas."
]
},
{
@@ -728,17 +731,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "and again, we've applied `f` (squared) to all the elements of `[1, 2, 3]` - this time by \"broadcasting\" `f`!\n",
- "\n",
- "Some syntactic sugar for calling `broadcast` is to place a `.` between the name of the function you want to `broadcast` and its input arguments. For example,\n",
- "\n",
- "```julia\n",
- "broadcast(f, [1, 2, 3])\n",
- "```\n",
- "is the same as\n",
- "```julia\n",
- "f.([1, 2, 3])\n",
- "```"
+ "### Ejercicios propuestos\n",
+ "1. Escribe una función que reciba un número y devuelva su valor absoluto.\n",
+ "2. Escribe una función que reciba un vector y devuelva el promedio de sus elementos.\n",
+ "3. Escribe una función que reciba dos números y devuelva el mayor de ellos.\n",
+ "4. Escribe una función anónima que multiplique por 10 cada elemento de un vector.\n",
+ "5. Usa `map` para aplicar la función del punto anterior a `[1, 2, 3, 4, 5]`."
]
},
{
@@ -768,27 +766,40 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Notice again how different this is from calling \n",
- "```julia\n",
- "f([1, 2, 3])\n",
- "```\n",
- "We can square every element of a vector, but we can't square a vector!"
+ "¿Listo para seguir? ¡Vamos a aprender sobre paquetes en Julia!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "To drive home the point, let's look at the difference between\n",
- "\n",
+ "## Soluciones a los ejercicios\n",
+ "1. \n",
"```julia\n",
- "f(A)\n",
+ "function valor_absoluto(x)\n",
+ " return abs(x)\n",
+ "end\n",
"```\n",
- "and\n",
+ "2. \n",
"```julia\n",
- "f.(A)\n",
+ "function promedio(v)\n",
+ " return sum(v) / length(v)\n",
+ "end\n",
"```\n",
- "for a matrix `A`:"
+ "3. \n",
+ "```julia\n",
+ "function mayor(a, b)\n",
+ " return a > b ? a : b\n",
+ "end\n",
+ "```\n",
+ "4. \n",
+ "```julia\n",
+ "multiplicar_por_10 = x -> x * 10\n",
+ "```\n",
+ "5. \n",
+ "```julia\n",
+ "map(multiplicar_por_10, [1, 2, 3, 4, 5])\n",
+ "```"
]
},
{
@@ -841,12 +852,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "As before we see that for a matrix, `A`,\n",
- "```\n",
- "f(A) = A^2 = A * A\n",
- "``` \n",
- "\n",
- "On the other hand,"
+ "¡Felicidades! Ahora sabes cómo definir y usar funciones en Julia, incluyendo funciones anónimas y cómo pasarlas como argumentos."
]
},
{
@@ -876,9 +882,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "contains the squares of all the entries of `A`.\n",
- "\n",
- "This dot syntax for broadcasting allows us to write relatively complex compound elementwise expressions in a way that looks natural/closer to mathematical notation. For example, we can write"
+ "¿Quieres practicar más? Intenta crear funciones para resolver problemas cotidianos, como calcular el área de un círculo o convertir temperaturas de Celsius a Fahrenheit."
]
},
{
@@ -908,7 +912,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "instead of"
+ "¡Nos vemos en la siguiente lección!"
]
},
{
@@ -938,17 +942,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "and the two will perform exactly the same."
+ "---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Exercises\n",
- "\n",
- "#### 6.1 \n",
- "Write a function `add_one` that adds 1 to its input."
+ "# Recursos adicionales\n",
+ "- [Documentación oficial de Julia: Funciones](https://docs.julialang.org/en/v1/manual/functions/)\n",
+ "- [Más ejemplos de funciones en Julia](https://juliabyexample.helpmanual.io/)\n",
+ "- [Funciones anónimas en Julia](https://docs.julialang.org/en/v1/manual/functions/#man-anonymous-functions)"
]
},
{
diff --git a/6 - Packages.ipynb b/6 - Packages.ipynb
index aaa7003..279053c 100644
--- a/6 - Packages.ipynb
+++ b/6 - Packages.ipynb
@@ -4,31 +4,31 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "# Packages\n",
- "\n",
- "Julia has over 2000 registered packages, making packages a huge part of the Julia ecosystem.\n",
- "\n",
- "Even so, the package ecosystem still has some growing to do. Notably, we have first class function calls to other languages, providing excellent foreign function interfaces. We can easily call into python or R, for example, with `PyCall` or `Rcall`.\n",
- "\n",
- "This means that you don't have to wait until the Julia ecosystem is fully mature, and that moving to Julia doesn't mean you have to give up your favorite package/library from another language! \n",
- "\n",
- "To see all available packages, check out\n",
- "\n",
+ "# Paquetes\n",
+ " \n",
+ "Julia tiene más de 2000 paquetes registrados, por lo que los paquetes son una parte fundamental del ecosistema de Julia.\n",
+ " \n",
+ "Aun así, el ecosistema de paquetes sigue creciendo. Destaca la capacidad de llamar funciones de otros lenguajes, proporcionando excelentes interfaces de funciones externas. Por ejemplo, podemos llamar fácilmente a Python o R con `PyCall` o `Rcall`.\n",
+ " \n",
+ "¡Esto significa que no tienes que esperar a que el ecosistema de Julia esté completamente maduro, y que mudarte a Julia no implica renunciar a tus paquetes o librerías favoritas de otros lenguajes!\n",
+ " \n",
+ "Para ver todos los paquetes disponibles, visita:\n",
+ " \n",
"https://julialang.org/packages/\n",
- "\n",
- "For now, let's learn how to use a package."
+ " \n",
+ "Por ahora, aprendamos cómo usar un paquete."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "The first time you use a package on a given Julia installation, you need to use the package manager to explicitly add it:"
+ "La primera vez que usas un paquete en una instalación de Julia, necesitas usar el gestor de paquetes para agregarlo explícitamente:"
]
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": null,
"metadata": {},
"outputs": [
{
@@ -48,6 +48,7 @@
}
],
"source": [
+ "# Usar el gestor de paquetes para instalar Example\n",
"using Pkg\n",
"Pkg.add(\"Example\")"
]
@@ -56,15 +57,16 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Every time you use Julia (start a new session at the REPL, or open a notebook for the first time, for example), you load the package with the `using` keyword"
+ "Cada vez que usas Julia (inicias una nueva sesión en el REPL o abres un notebook por primera vez, por ejemplo), cargas el paquete con la palabra clave `using`:"
]
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
+ "# Cargar el paquete Example\n",
"using Example"
]
},
@@ -72,20 +74,20 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "In the source code of `Example.jl` at\n",
+ "En el código fuente de `Example.jl` en:\n",
"https://github.com/JuliaLang/Example.jl/blob/master/src/Example.jl\n",
- "we see the following function declared\n",
- "\n",
+ "vemos la siguiente función declarada:\n",
+ " \n",
"```\n",
"hello(who::String) = \"Hello, $who\"\n",
"```\n",
- "\n",
- "Having loaded `Example`, we should now be able to call `hello`"
+ " \n",
+ "Habiendo cargado `Example`, ahora deberíamos poder llamar a `hello`."
]
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"metadata": {},
"outputs": [
{
@@ -100,19 +102,20 @@
}
],
"source": [
- "hello(\"it's me. I was wondering if after all these years you'd like to meet.\")"
+ "# Llamar a la función hello del paquete Example\n",
+ "hello(\"soy yo. Me preguntaba si después de todos estos años te gustaría encontrarte.\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "Now let's play with the Colors package"
+ "Ahora juguemos con el paquete Colors"
]
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": null,
"metadata": {},
"outputs": [
{
@@ -126,15 +129,17 @@
}
],
"source": [
+ "# Instalar el paquete Colors\n",
"Pkg.add(\"Colors\")"
]
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
+ "# Cargar el paquete Colors\n",
"using Colors"
]
},
@@ -142,12 +147,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Let's create a palette of 100 different colors"
+ "Vamos a crear una paleta de 100 colores diferentes"
]
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": null,
"metadata": {},
"outputs": [
{
@@ -298,6 +303,7 @@
}
],
"source": [
+ "# Crear una paleta de 100 colores distintos\n",
"palette = distinguishable_colors(100)"
]
},
@@ -305,12 +311,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "and then we can create a randomly checkered matrix using the `rand` command"
+ "Luego podemos crear una matriz aleatoria a cuadros usando el comando `rand`:"
]
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": null,
"metadata": {},
"outputs": [
{
@@ -347,6 +353,7 @@
}
],
"source": [
+ "# Crear una matriz aleatoria de colores de la paleta\n",
"rand(palette, 3, 3)"
]
},
@@ -354,17 +361,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "In the next notebook, we'll use a new package to plot datasets."
+ "En el siguiente notebook, usaremos un nuevo paquete para graficar conjuntos de datos."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Exercises\n",
- "\n",
- "#### 7.1 \n",
- "Load the Primes package (source code at https://github.com/JuliaMath/Primes.jl )."
+ "### Ejercicios\n",
+ " \n",
+ "#### 7.1\n",
+ "Carga el paquete Primes (código fuente en https://github.com/JuliaMath/Primes.jl )."
]
},
{
@@ -372,7 +379,10 @@
"execution_count": null,
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "# Cargar el paquete Primes\n",
+ "using Primes"
+ ]
},
{
"cell_type": "code",
@@ -400,8 +410,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "#### 7.2 \n",
- "Verify that you can now use the function `primes` to grab all prime numbers under 1,000,000 and store it in variable `primes_list`"
+ "#### 7.2\n",
+ "Verifica que ahora puedes usar la función `primes` para obtener todos los números primos menores a 1,000,000 y guárdalos en la variable `primes_list`."
]
},
{
@@ -409,7 +419,10 @@
"execution_count": null,
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "# Obtener todos los primos menores a 1,000,000 y guardarlos en primes_list\n",
+ "primes_list = primes(1000000)"
+ ]
},
{
"cell_type": "code",
@@ -430,6 +443,7 @@
},
"outputs": [],
"source": [
+ "# Verificar que primes_list contiene los primos hasta 1,000,000\n",
"@assert primes_list == primes(1000000)"
]
}
diff --git a/7 - Plotting.ipynb b/7 - Plotting.ipynb
index 30e4a7e..b05aed1 100644
--- a/7 - Plotting.ipynb
+++ b/7 - Plotting.ipynb
@@ -3,14 +3,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# Plotting\n",
- "\n",
- "## Basics\n",
- "There are a few different ways to plot in Julia (including calling PyPlot).
\n",
- "\n",
- "Here we'll show you how to use `Plots.jl`. If it's not installed yet, you need to use the package manager to install it, and Julia will precompile it for you the first time you use it:"
- ]
+ "source": "# Graficación\n\n## Conceptos básicos\nExisten algunas formas diferentes de graficar en Julia (incluyendo llamar a PyPlot).
\n\nAquí te mostraremos cómo usar `Plots.jl`. Si aún no está instalado, necesitas usar el administrador de paquetes para instalarlo, y Julia lo precompilará por ti la primera vez que lo uses:"
},
{
"cell_type": "code",
@@ -185,11 +178,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "One of the advantages to `Plots.jl` is that it allows you to seamlessly change backends. In this notebook, we'll try out the `gr()` and `plotlyjs()` backends.
\n",
- "\n",
- "In the name of scientific inquiry, let's use this notebook to examine the relationship between the global temperature and the number of pirates between roughly 1860 and 2000."
- ]
+ "source": "Una de las ventajas de `Plots.jl` es que te permite cambiar de backends (motores de graficación) de manera seamless (sin interrupciones). En este notebook, probaremos los backends `gr()` y `plotlyjs()` .
\n\nEn nombre de la investigación científica, usemos este notebook para examinar la relación entre la temperatura global y el número de piratas entre aproximadamente 1860 y 2000."
},
{
"cell_type": "code",
@@ -204,9 +193,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "Plots supports multiple backends — that is, libraries that actually do the drawing — all with the same API. To start out, let's try the GR backend. You choose it with a call to `gr()`:"
- ]
+ "source": "Plots soporta múltiples backends — es decir, librerías que realmente hacen el dibujo — todos con la misma API. Para comenzar, probemos el backend GR. Lo seleccionas con una llamada a `gr()`:"
},
{
"cell_type": "code",
@@ -231,9 +218,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "and now we can use commands like `plot` and `scatter` to generate plots."
- ]
+ "source": "y ahora podemos usar comandos como `plot` y `scatter` para generar gráficos."
},
{
"cell_type": "code",
@@ -373,13 +358,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "The `!` at the end of the `scatter!` function name makes `scatter!` a mutating function, indicating that the scattered points will be added onto the pre-existing plot.\n",
- "\n",
- "In contrast, see what happens when you replace `scatter!` in the above with the non-mutating function `scatter`.\n",
- "\n",
- "Next, let's update this plot with the `xlabel!`, `ylabel!`, and `title!` commands to add more information to our plot."
- ]
+ "source": "El `!` al final del nombre de la función `scatter!` hace que `scatter!` sea una función mutante, indicando que los puntos dispersos se agregarán al gráfico preexistente.\n\nEn contraste, observa lo que sucede cuando reemplazas `scatter!` arriba con la función no mutante `scatter`.\n\nA continuación, actualicemos este gráfico con los comandos `xlabel!`, `ylabel!`, y `title!` para agregar más información a nuestro gráfico."
},
{
"cell_type": "code",
@@ -520,9 +499,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "This still doesn't look quite right. The number of pirates has decreased since 1860, so reading the plot from left to right is like looking backwards in time rather than forwards. Let's flip the x axis to better see how pirate populations have caused global temperatures to change over time!"
- ]
+ "source": "Esto todavía no se ve del todo correcto. El número de piratas ha disminuido desde 1860, así que leer el gráfico de izquierda a derecha es como mirar hacia atrás en el tiempo en lugar de hacia adelante. ¡Giremos el eje x para ver mejor cómo las poblaciones de piratas han causado que las temperaturas globales cambien con el tiempo!"
},
{
"cell_type": "code",
@@ -661,13 +638,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "And there we have it!\n",
- "\n",
- "Note: We've had some confusion about this exercise. :) This is a joke about how people often conflate correlation and causation.\n",
- "\n",
- "**Without changing syntax, we can create this plot with the UnicodePlots backend**"
- ]
+ "source": "¡Y ahí lo tenemos!\n\nNota: Hemos tenido algo de confusión sobre este ejercicio. :) Esto es una broma sobre cómo la gente a menudo confunde correlación y causalidad.\n\n**Sin cambiar la sintaxis, podemos crear este gráfico con el backend UnicodePlots**"
},
{
"cell_type": "code",
@@ -734,23 +705,12 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "And notice how this second plot differs from the first! Using text like this is a little silly in a Jupyter notebook where we have fancy drawing capabilities, but it can be very useful for quick and dirty visualization in a terminal."
- ]
+ "source": "¡Y observa cómo este segundo gráfico difiere del primero! Usar texto así es un poco tonto en un notebook de Jupyter donde tenemos capacidades de dibujo sofisticadas, pero puede ser muy útil para visualización rápida y sucia en una terminal."
},
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "### Exercises\n",
- "\n",
- "#### 8.1 \n",
- "Given\n",
- "```julia\n",
- "x = -10:10\n",
- "```\n",
- "plot y vs. x for $y = x^2$. You may want to change backends back again."
- ]
+ "source": "### Ejercicios\n\n#### 8.1 \nDados\n```julia\nx = -10:10\n```\ngrafica y vs. x para $y = x^2$. Es posible que quieras cambiar de nuevo los backends."
},
{
"cell_type": "code",
@@ -762,10 +722,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "#### 8.2 \n",
- "Execute the following code"
- ]
+ "source": "#### 8.2 \nEjecuta el siguiente código"
},
{
"cell_type": "code",
@@ -783,9 +740,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "and then create a $4x1$ plot that uses `p1`, `p2`, `p3`, and `p4` as subplots."
- ]
+ "source": "y luego crea un gráfico $4x1$ que use `p1`, `p2`, `p3`, y `p4` como subgráficos."
},
{
"cell_type": "code",
@@ -824,4 +779,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
-}
+}
\ No newline at end of file
diff --git a/8 - Multiple dispatch.ipynb b/8 - Multiple dispatch.ipynb
index eb1ae92..e15983f 100644
--- a/8 - Multiple dispatch.ipynb
+++ b/8 - Multiple dispatch.ipynb
@@ -3,24 +3,12 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# Multiple dispatch"
- ]
+ "source": "# Múltiple despacho"
},
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "In this notebook we'll explore **multiple dispatch**, which is a key feature of Julia.\n",
- "\n",
- "Multiple dispatch makes software *generic* and *fast*!\n",
- "\n",
- "#### Starting with the familiar\n",
- "\n",
- "To understand multiple dispatch in Julia, let's start with what we've already seen.\n",
- "\n",
- "We can declare functions in Julia without giving Julia any information about the types of the input arguments that function will receive:"
- ]
+ "source": "En este notebook exploraremos el **múltiple despacho**, que es una característica clave de Julia.\n\n¡El múltiple despacho hace que el software sea *genérico* y *rápido*!\n\n#### Empezando con lo familiar\n\nPara entender el múltiple despacho en Julia, comencemos con lo que ya hemos visto.\n\nPodemos declarar funciones en Julia sin darle a Julia ninguna información sobre los tipos de los argumentos de entrada que la función recibirá:"
},
{
"cell_type": "code",
@@ -45,9 +33,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "and then Julia will determine on its own which input argument types make sense and which do not:"
- ]
+ "source": "y luego Julia determinará por sí misma qué tipos de argumentos de entrada tienen sentido y cuáles no:"
},
{
"cell_type": "code",
@@ -95,13 +81,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "#### Specifying the types of our input arguments\n",
- "\n",
- "However, we also have the *option* to tell Julia explicitly what types our input arguments are allowed to have.\n",
- "\n",
- "For example, let's write a function `foo` that only takes strings as inputs."
- ]
+ "source": "#### Especificando los tipos de nuestros argumentos de entrada\n\nSin embargo, también tenemos la *opción* de decirle a Julia explícitamente qué tipos se permite que tengan nuestros argumentos de entrada.\n\nPor ejemplo, escribamos una función `foo` que solo tome cadenas como entradas."
},
{
"cell_type": "code",
@@ -126,11 +106,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "We see here that in order to restrict the type of `x` and `y` to `String`s, we just follow the input argument name by a double colon and the keyword `String`.\n",
- "\n",
- "Now we'll see that `foo` works on `String`s and doesn't work on other input argument types."
- ]
+ "source": "Vemos aquí que para restringir el tipo de `x` y `y` a `String`s, simplemente seguimos el nombre del argumento de entrada con dos puntos y la palabra clave `String`.\n\nAhora veremos que `foo` funciona con `String`s y no funciona con otros tipos de argumentos de entrada."
},
{
"cell_type": "code",
@@ -178,9 +154,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "To get `foo` to work on integer (`Int`) inputs, let's tack `::Int` onto our input arguments when we declare `foo`."
- ]
+ "source": "Para que `foo` funcione con entradas de tipo entero (`Int`), agreguemos `::Int` a nuestros argumentos de entrada cuando declaremos `foo`."
},
{
"cell_type": "code",
@@ -222,9 +196,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "Now `foo` works on integers! But look, `foo` also still works when `x` and `y` are strings!"
- ]
+ "source": "¡Ahora `foo` funciona con enteros! Pero mira, `foo` también todavía funciona cuando `x` y `y` son cadenas!"
},
{
"cell_type": "code",
@@ -246,28 +218,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "This is starting to get to the heart of multiple dispatch. When we declared\n",
- "\n",
- "```julia\n",
- "foo(x::Int, y::Int) = println(\"My inputs x and y are both integers!\")\n",
- "```\n",
- "we didn't overwrite or replace\n",
- "```julia\n",
- "foo(x::String, y::String)\n",
- "```\n",
- "Instead, we just added an additional ***method*** to the ***generic function*** called `foo`.\n",
- "\n",
- "A ***generic function*** is the abstract concept associated with a particular operation.\n",
- "\n",
- "For example, the generic function `+` represents the concept of addition.\n",
- "\n",
- "A ***method*** is a specific implementation of a generic function for *particular argument types*.\n",
- "\n",
- "For example, `+` has methods that accept floating point numbers, integers, matrices, etc.\n",
- "\n",
- "We can use the `methods` to see how many methods there are for `foo`."
- ]
+ "source": "Esto está empezando a llegar al corazón del múltiple despacho. Cuando declaramos\n\n```julia\nfoo(x::Int, y::Int) = println(\"My inputs x and y are both integers!\")\n```\nno sobreescribimos o reemplazamos\n```julia\nfoo(x::String, y::String)\n```\nEn cambio, simplemente agregamos un ***método*** adicional a la ***función genérica*** llamada `foo`.\n\nUna ***función genérica*** es el concepto abstracto asociado con una operación particular.\n\nPor ejemplo, la función genérica `+` representa el concepto de adición.\n\nUn ***método*** es una implementación específica de una función genérica para *tipos de argumentos particulares*.\n\nPor ejemplo, `+` tiene métodos que aceptan números de punto flotante, enteros, matrices, etc.\n\nPodemos usar `methods` para ver cuántos métodos hay para `foo`."
},
{
"cell_type": "code",
@@ -297,9 +248,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "Aside: how many methods do you think there are for addition?"
- ]
+ "source": "Aparte: ¿cuántos métodos crees que hay para la adición?"
},
{
"cell_type": "code",
@@ -517,13 +466,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "So, we now can call `foo` on integers or strings. When you call `foo` on a particular set of arguments, Julia will infer the types of the inputs and dispatch the appropriate method. *This* is multiple dispatch.\n",
- "\n",
- "Multiple dispatch makes our code generic and fast. Our code can be generic and flexible because we can write code in terms of abstract operations such as addition and multiplication, rather than in terms of specific implementations. At the same time, our code runs quickly because Julia is able to call efficient methods for the relevant types.\n",
- "\n",
- "To see which method is being dispatched when we call a generic function, we can use the @which macro:"
- ]
+ "source": "Entonces, ahora podemos llamar `foo` en enteros o cadenas. Cuando llamas `foo` en un conjunto particular de argumentos, Julia inferirá los tipos de las entradas y despachará el método apropiado. *Esto* es múltiple despacho.\n\nEl múltiple despacho hace que nuestro código sea genérico y rápido. Nuestro código puede ser genérico y flexible porque podemos escribir código en términos de operaciones abstractas como adición y multiplicación, en lugar de en términos de implementaciones específicas. Al mismo tiempo, nuestro código se ejecuta rápidamente porque Julia es capaz de llamar métodos eficientes para los tipos relevantes.\n\nPara ver qué método está siendo despachado cuando llamamos a una función genérica, podemos usar el macro @which:"
},
{
"cell_type": "code",
@@ -551,9 +494,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "Let's see what happens when we use `@which` with the addition operator!"
- ]
+ "source": "¡Veamos qué sucede cuando usamos `@which` con el operador de adición!"
},
{
"cell_type": "code",
@@ -581,9 +522,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "And we can continue to add other methods to our generic function `foo`. Let's add one that takes the ***abstract type*** `Number`, which includes subtypes such as `Int`, `Float64`, and other objects you would think of as numbers:"
- ]
+ "source": "Y podemos continuar agregando otros métodos a nuestra función genérica `foo`. Agreguemos uno que tome el ***tipo abstracto*** `Number`, que incluye subtipos como `Int`, `Float64`, y otros objetos que considerarías números:"
},
{
"cell_type": "code",
@@ -608,9 +547,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "This method for `foo` will work on, for example, floating point numbers:"
- ]
+ "source": "Este método para `foo` funcionará, por ejemplo, con números de punto flotante:"
},
{
"cell_type": "code",
@@ -632,9 +569,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "We can also add a fallback, duck-typed method for `foo` that takes inputs of any type:"
- ]
+ "source": "También podemos agregar un método de reserva (fallback), con tipado pato, para `foo` que tome entradas de cualquier tipo:"
},
{
"cell_type": "code",
@@ -659,9 +594,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "Given the methods we've already written for `foo` so far, this method will be called whenever we pass non-numbers to `foo`:"
- ]
+ "source": "Dado los métodos que ya hemos escrito para `foo` hasta ahora, este método será llamado cada vez que pasemos no-números a `foo`:"
},
{
"cell_type": "code",
@@ -684,13 +617,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "### Exercises\n",
- "\n",
- "#### 9.1\n",
- "\n",
- "Extend the function `foo`, adding a method that takes only one input argument, which is of type `Bool`, and returns \"foo with one boolean!\""
- ]
+ "source": "### Ejercicios\n\n#### 9.1\n\nExtiende la función `foo`, agregando un método que tome solo un argumento de entrada, que sea de tipo `Bool`, y retorne \"foo con un booleano\""
},
{
"cell_type": "code",
@@ -702,15 +629,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "#### 9.2\n",
- "\n",
- "Check that the method being dispatched when you execute \n",
- "```julia\n",
- "foo(true)\n",
- "```\n",
- "is the one you wrote."
- ]
+ "source": "#### 9.2\n\nVerifica que el método que se despacha cuando ejecutas \n```julia\nfoo(true)\n```\nes el que tú escribiste."
},
{
"cell_type": "code",
@@ -772,4 +691,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
-}
+}
\ No newline at end of file
diff --git a/9 - Julia is fast.ipynb b/9 - Julia is fast.ipynb
index 15154e2..74bc1b9 100644
--- a/9 - Julia is fast.ipynb
+++ b/9 - Julia is fast.ipynb
@@ -3,52 +3,22 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# Julia is fast\n",
- "\n",
- "Very often, benchmarks are used to compare languages. These benchmarks can lead to long discussions, first as to exactly what is being benchmarked and secondly what explains the differences. These simple questions can sometimes get more complicated than you at first might imagine.\n",
- "\n",
- "The purpose of this notebook is for you to see a simple benchmark for yourself. One can read the notebook and see what happened on the author's Macbook Pro with a 4-core Intel Core I7, or run the notebook yourself.\n",
- "\n",
- "(This material began life as a wonderful lecture by Steven Johnson at MIT: https://github.com/stevengj/18S096/blob/master/lectures/lecture1/Boxes-and-registers.ipynb.)"
- ]
+ "source": "# Julia es rápida\n\nMuy a menudo, se utilizan benchmarks para comparar lenguajes. Estos benchmarks pueden llevar a largas discusiones, primero sobre exactamente qué se está benchmarkeando y segundo qué explica las diferencias. Estas preguntas simples a veces pueden complicarse más de lo que podrías imaginar inicialmente.\n\nEl propósito de este notebook es que veas un benchmark simple por ti mismo. Uno puede leer el notebook y ver qué sucedió en la Macbook Pro del autor con un Intel Core I7 de 4 núcleos, o ejecutar el notebook tú mismo.\n\n(Este material comenzó como una conferencia maravillosa de Steven Johnson en MIT: https://github.com/stevengj/18S096/blob/master/lectures/lecture1/Boxes-and-registers.ipynb.)"
},
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# Outline of this notebook\n",
- "\n",
- "- Define the sum function\n",
- "- Implementations & benchmarking of sum in...\n",
- " - C (hand-written)\n",
- " - C (hand-written with -ffast-math)\n",
- " - python (built-in)\n",
- " - python (numpy)\n",
- " - python (hand-written)\n",
- " - Julia (built-in)\n",
- " - Julia (hand-written)\n",
- " - Julia (hand-written with SIMD)\n",
- "- Summary of benchmarks"
- ]
+ "source": "# Resumen de este notebook\n\n- Definir la función sum\n- Implementaciones y benchmarking de sum en...\n - C (escrito a mano)\n - C (escrito a mano con -ffast-math)\n - python (incorporado)\n - python (numpy)\n - python (escrito a mano)\n - Julia (incorporado)\n - Julia (escrito a mano)\n - Julia (escrito a mano con SIMD)\n- Resumen de benchmarks"
},
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# `sum`: An easy enough function to understand"
- ]
+ "source": "# `sum`: Una función lo suficientemente fácil de entender"
},
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "Consider the **sum** function `sum(a)`, which computes\n",
- "$$\n",
- "\\mathrm{sum}(a) = \\sum_{i=1}^n a_i,\n",
- "$$\n",
- "where $n$ is the length of `a`."
- ]
+ "source": "Considera la función **sum** `sum(a)`, que calcula\n$$\n\\mathrm{sum}(a) = \\sum_{i=1}^n a_i,\n$$\ndonde $n$ es la longitud de `a`."
},
{
"cell_type": "code",
@@ -119,16 +89,12 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "The expected result is 0.5 * 10^7, since the mean of each entry is 0.5"
- ]
+ "source": "El resultado esperado es 0.5 * 10^7, ya que la media de cada entrada es 0.5"
},
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# Benchmarking a few ways in a few languages"
- ]
+ "source": "# Benchmarking de algunas formas en algunos lenguajes"
},
{
"cell_type": "code",
@@ -214,11 +180,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "The `@time` macro can yield noisy results, so it's not our best choice for benchmarking!\n",
- "\n",
- "Luckily, Julia has a `BenchmarkTools.jl` package to make benchmarking easy and accurate:"
- ]
+ "source": "El macro `@time` puede producir resultados ruidosos, ¡así que no es nuestra mejor opción para benchmarking!\n\nAfortunadamente, Julia tiene un paquete `BenchmarkTools.jl` para hacer benchmarking fácil y preciso:"
},
{
"cell_type": "code",
@@ -262,13 +224,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# 1. The C language\n",
- "\n",
- "C is often considered the gold standard: difficult on the human, nice for the machine. Getting within a factor of 2 of C is often satisfying. Nonetheless, even within C, there are many kinds of optimizations possible that a naive C writer may or may not get the advantage of.\n",
- "\n",
- "The current author does not speak C, so he does not read the cell below, but is happy to know that you can put C code in a Julia session, compile it, and run it. Note that the `\"\"\"` wrap a multi-line string."
- ]
+ "source": "# 1. El lenguaje C\n\nC a menudo se considera el estándar de oro: difícil para el humano, agradable para la máquina. Quedarse dentro de un factor de 2 de C a menudo es satisfactorio. Sin embargo, incluso dentro de C, hay muchos tipos de optimizaciones posibles que un escritor de C ingenuo puede o no puede aprovechar.\n\nEl autor actual no habla C, por lo que no lee la celda de abajo, pero está feliz de saber que puedes poner código C en una sesión de Julia, compilarlo y ejecutarlo. Ten en cuenta que `\"\"\"` envuelve una cadena de múltiples líneas."
},
{
"cell_type": "code",
@@ -588,9 +544,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "We can now benchmark the C code directly from Julia:"
- ]
+ "source": "Ahora podemos hacer benchmark del código C directamente desde Julia:"
},
{
"cell_type": "code",
@@ -3936,11 +3890,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# 2. C with -ffast-math\n",
- "\n",
- "If we allow C to re-arrange the floating point operations, then it'll vectorize with SIMD (single instruction, multiple data) instructions."
- ]
+ "source": "# 2. C con -ffast-math\n\nSi permitimos que C re-ordene las operaciones de punto flotante, entonces vectorizará con instrucciones SIMD (instrucción única, múltiples datos)."
},
{
"cell_type": "code",
@@ -4022,16 +3972,12 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# 3. Python's built in `sum` "
- ]
+ "source": "# 3. `sum` incorporado de Python"
},
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "The `PyCall` package provides a Julia interface to Python:"
- ]
+ "source": "El paquete `PyCall` proporciona una interfaz Julia para Python:"
},
{
"cell_type": "code",
@@ -4061,24 +4007,10 @@
},
{
"cell_type": "code",
- "execution_count": 24,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "PyObject "
- ]
- },
- "execution_count": 24,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# get the Python built-in \"sum\" function:\n",
- "pysum = pybuiltin(\"sum\")"
- ]
+ "outputs": [],
+ "source": "# obtener la función \"sum\" incorporada de Python:\npysum = pybuiltin(\"sum\")"
},
{
"cell_type": "code",
@@ -4176,14 +4108,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# 4. Python: `numpy` \n",
- "\n",
- "## Takes advantage of hardware \"SIMD\", but only works when it works.\n",
- "\n",
- "`numpy` is an optimized C library, callable from Python.\n",
- "It may be installed within Julia as follows:"
- ]
+ "source": "# 4. Python: `numpy` \n\n## Aprovecha el hardware \"SIMD\", pero solo funciona cuando funciona.\n\n`numpy` es una librería C optimizada, invocable desde Python.\nPuede ser instalada dentro de Julia de la siguiente manera:"
},
{
"cell_type": "code",
@@ -4364,37 +4289,14 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# 5. Python, hand-written "
- ]
+ "source": "# 5. Python, escrito a mano"
},
{
"cell_type": "code",
- "execution_count": 35,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "PyObject "
- ]
- },
- "execution_count": 35,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "py\"\"\"\n",
- "def py_sum(A):\n",
- " s = 0.0\n",
- " for a in A:\n",
- " s += a\n",
- " return s\n",
- "\"\"\"\n",
- "\n",
- "sum_py = py\"py_sum\""
- ]
+ "outputs": [],
+ "source": "py\"\"\"\ndef py_sum(A):\n s = 0.0\n for a in A:\n s += a\n return s\n\"\"\"\n\nsum_py = py\"py_sum\""
},
{
"cell_type": "code",
@@ -4496,11 +4398,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# 6. Julia (built-in) \n",
- "\n",
- "## Written directly in Julia, not in C!"
- ]
+ "source": "# 6. Julia (incorporado) \n\n## ¡Escrito directamente en Julia, no en C!"
},
{
"cell_type": "code",
@@ -4586,37 +4484,16 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# 7. Julia (hand-written) "
- ]
+ "source": "# 7. Julia (escrito a mano)"
},
{
"cell_type": "code",
- "execution_count": 43,
+ "execution_count": null,
"metadata": {
"scrolled": true
},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "mysum (generic function with 1 method)"
- ]
- },
- "execution_count": 43,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "function mysum(A) \n",
- " s = 0.0 # s = zero(eltype(a))\n",
- " for a in A\n",
- " s += a\n",
- " end\n",
- " s\n",
- "end"
- ]
+ "outputs": [],
+ "source": "function mysum(A) \n s = 0.0 # s = zero(eltype(a))\n for a in A\n s += a\n end\n s\nend"
},
{
"cell_type": "code",
@@ -4680,35 +4557,14 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# 8. Julia (hand-written w. simd) "
- ]
+ "source": "# 8. Julia (escrito a mano con simd)"
},
{
"cell_type": "code",
- "execution_count": 46,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "mysum_simd (generic function with 1 method)"
- ]
- },
- "execution_count": 46,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "function mysum_simd(A) \n",
- " s = 0.0 # s = zero(eltype(A))\n",
- " @simd for a in A\n",
- " s += a\n",
- " end\n",
- " s\n",
- "end"
- ]
+ "outputs": [],
+ "source": "function mysum_simd(A) \n s = 0.0 # s = zero(eltype(A))\n @simd for a in A\n s += a\n end\n s\nend"
},
{
"cell_type": "code",
@@ -4793,9 +4649,7 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": [
- "# Summary"
- ]
+ "source": "# Resumen"
},
{
"cell_type": "code",
@@ -4861,4 +4715,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
-}
+}
\ No newline at end of file
diff --git a/LICENSE.md b/LICENSE.md
deleted file mode 100644
index 7d084c5..0000000
--- a/LICENSE.md
+++ /dev/null
@@ -1,20 +0,0 @@
- Copyright (c) 2018-2020: Julia Computing, Inc.
-
-> Permission is hereby granted, free of charge, to any person obtaining
-> a copy of this software and associated documentation files (the
-> "Software"), to deal in the Software without restriction, including
-> without limitation the rights to use, copy, modify, merge, publish,
-> distribute, sublicense, and/or sell copies of the Software, and to
-> permit persons to whom the Software is furnished to do so, subject to
-> the following conditions:
->
-> The above copyright notice and this permission notice shall be
-> included in all copies or substantial portions of the Software.
->
-> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.