·SciLab· #WSQ 14

Qué rollo banda… jaja en este post les platicaré sobre este programa llamado Scilab. Para empezar, no pude descargarlo por cuestiones de seguridad que Apple se inventa en sus computadoras y toda esa onda aunque la verdad me dio flojera investigar más a fondo sobre cómo hacer que lo abriera pero en fin, busqué varios videos y aquí está mi reseña.

SciLab es un programa que puede ser de gran utilidad para cualquier área que involucre el análisis numérico. Nos permite crear gráficas en 2-d y 3-d así como cálculos de funciones y un sin fin de posibilidades hablando de las matemáticas.

Es muy interesante todo lo que puedes hacer con este programa, ya sea cuando tienes demasiado tiempo libre o cuando de verdad lo necesitas. Bueno, esto es todo para este post, estoy guardando las palabras de despedida para el próximo que será el último… Disculpen, me ganó  el lado sentimental…

 

·Exam 2· #WSQ 13

Aquí están mis programas del examen parcial. Debido a que esta semana me traen como esclavo (qué raro del Tec) con el taller vertical y proyectos finales, no les pondré una descripción de cómo hice cada programa. Solo el de fibonacci no lo he podido hacer con loop pero espero en un rato libre… Suerte en su taller vertical!

Programa 1: Crear un triángulo de T

Captura de pantalla 2016-04-19 a las 2.26.48 p.m.

Programa 2: Elevar un número a cierta potencia.

Captura de pantalla 2016-04-19 a las 2.27.56 p.m.

Programa 3: Sucesión de Fibonacci usando loop (en este caso es con recursion).

Captura de pantalla 2016-04-19 a las 2.33.00 p.m.

Programa 4: Ver si una palabra es palíndromo o no.

Captura de pantalla 2016-04-19 a las 2.34.37 p.m.

·Word Count· #WSQ12

Hello people! Here is my WSQ12 in which I was told to create a program that could find a certain word (given by the user) in a text file (also given by the user). 

So let’s start with the function. I created a function called find_word and its job was like the name, to find the word in the text file. There are two string variables: the word that the user is looking for and ‘sample’, that is the text file given by the user. The ‘ifstream myfile allows you to look for the text file on your computer. Then I put an if statement that says ‘if the file is open do this…’. As you want to find a word as many times as it appears in the text file, you must analyze each line of the text file, here is where the getline  helps you. This function goes by every line and then with the comparison, you can find the word and the counter increases.

Then you have to close the file with myfile.close() 

Captura de pantalla 2016-03-29 a las 12.09.11 p.m.

And here is the rest of the program, where I ask for the word and the name of the text file. Then I just called my function and that’s it. The result was in the function find_word.

Captura de pantalla 2016-03-29 a las 12.10.37 p.m.

You can look at my code here in GitHub. Feel free to comment.

Thank you Ken for the help with this program!! 

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/

·YoSoy196· #WSQ11

So the time has come….and to be honest, I have no idea of how this works. This story starts when Ken told us that this would be the most difficult program that we might create on this course. I was motivated at first in trying to create it but all the happiness and motivation just was gone. My friend Dario was working in this program for a week and it finally worked. He promised me that he would explain it to me how it works, but the day never came. Now I have to admit that I just copied his program, but I will try to do it by myself later, and hopefully it will work.

Here is the code (obviously from Dario’s mind) on GitHub. 

HAHAHAHA DARIO WAS LIKE THIS WHEN HE THOUGHT THE PROGRAM HAD FINALLY WORKED AND HE WAS WAITING THAT IT COMPILED. DON’T FORGET TO VISIT HIS BLOG RIGHT HERE: https://dariomagana10.wordpress.com

1qe1nhe0fi0vy

Alex H.

Quiz #6

Hello everyone! Now we have a new quiz, and we’re supposed to create a program that calculates the greatest common divisor of two integers… pretty easy hahaha

We’re going to ask the user to give those values (obviously integers because… I don’t know, integers rules!) and the program will calculate the greatest common divisor using the Euclid’s algorithm. Now what the… is the Euclid’s algorithm?? Here you can see what it is…

Captura de pantalla 2016-04-04 a las 7.59.51 p.m.

Now let’s create the program. The function called MasterAguayo is where the magic happens. It takes two values and by using ‘if statements’ we are switching the numbers using modules and all that stuff. 

Captura de pantalla 2016-04-04 a las 8.08.34 p.m.

It is pretty easy to understand this algorithm and you’re supposed to know how it works if you’re at college… if that’s not the case, well don’t worry because there is a lot of information available on the web. 

Here is my code via GitHub. You can check it out and feel free to do whatever you want with it. 

Alex H.

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/

Quiz #5

Hello everybody, I know that I hadn’t posted anything for a while but I’m back! With all the homework and projects, I didn’t have time to upload my codes even I had them on my computer. So heres is the Quiz #5.

Basically, we are asked to create two programs: the first one is supposed to read a string and determine if it is a palindrome or not. It’s like #YoSoy196 but this one with words. Even though I haven’t done the #YoSoy196 because there are some things that I’m not understanding, here is my code for the first program. Captura de pantalla 2016-03-22 a las 12.26.42 p.m..png

As you can see, now we’re only working with boolean expressions. The options are just ‘It is a palindrome’ or ‘It is not a palindrome’. So in the main function we receive our word, which it is a string.  Then our function called esPalindromo just compare our string and determine if it’s palindrome or not.

Here is my code on GitHub. LINK

Now, the second program had to print the addition of numbers divisible by 3. The user would type some values and the program had to determine which ones were divisible by 3 and add them. And here is the code for the second program. LINK2

Captura de pantalla 2016-03-22 a las 12.34.16 p.m.

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/

 

Quiz #4

Here is my Quiz #4. First, let’s read the instructions:

Captura de pantalla 2016-04-04 a las 7.32.09 p.m..png

Basically we have to create a program that calculate the euler number, which as you can see it is an important mathematical constant. The user will give the precision wanted and the program should stop working when the last two values differ by less than the precision given by the user.

First, we create a function that calculate the factorial series from the number 1. We will use this function later when we want to calculate the algorithm of the euler number.

Captura de pantalla 2016-04-04 a las 7.35.56 p.m.

Captura de pantalla 2016-04-04 a las 7.42.51 p.m.

For this program Ken helped us in class because we had no idea of what we were doing… we created a program that showed us the multiple values of euler for a given number and that helped us to understand about setting the precision. 

Here you can see the actual code of the Quiz on GitHub.

Aaaaaand here you can see the code for the different values of e for a given number. It can help you to understand the whole question of the quiz.

Peace…

Alex H.

·Lists· #WSQ10

Bueno este blog lo escribiré en español debido a que tengo demasiada flojera para inspirarme en inglés…

En este programa tenía que crear una lista de 10 números y al final mostrar la suma de éstos, su desviación estándar y el promedio de los números. Para este programa es muy recomendable el uso de funciones.

Creé una función llamada getTotal que era la encargada de sumar todos los números. Después creé otra función llamada getAverage que era la encargada de obtener el promedio de los números, pero dentro de ésta llamé a la función getTotal, en la que ya tenía el total de la suma y solo tenía que dividirlo entre los 10 números.

Por último, para la desviación estándar tuve que buscar la fórmula y ésta usaba mi función de promedio. Tuve que pedir un poco de ayuda de mi buen amigo Darío, puedes visitar su blog aquí.

Captura de pantalla 2016-03-08 a las 12.08.01.png

También puedes encontrar el código de este programa en GitHub. Click aquí.

5nczoumgibjzo

Quiz #3

So this was the Quiz #3, and here you can see what I was supposed to do. First, create a program that calculate the distance between two points given by the user, in the cartesian plane. And the second one, was to create a program that could show you the fibonacci series of a number that was given.Captura de pantalla 2016-02-12 a las 23.24.10.png

For the first problem, you had to calculate the middle point of the two values for “x” and for “y”, then you had to apply the Pythagorean theorem in order to calculate the distance. As you can see for the value of “x” I used a variable called “a” and for the “y” value I used a variable called “b”. After you had the difference between those values (x2-x1 and y2-y1) you must use the Pythagorean theorem and that’s it. Then you had to call the distance function into the main function.

Here you can have a look of this code on GitHub. Captura de pantalla 2016-02-12 a las 18.36.04

For the second program, I worked with my friend Dario. (check out his blog HERE, he has an awesome blog). We tried to understand first the Fibonacci series and then we had to apply it to the code. We spent the rest of the class trying so many ways that we ended up stressed and pissed off with the whole world hahaha. After a few hours I gave it a second chance to this program and I searched for any information that could help me with this problem. I found this article that gave an idea of the structure of the program.

http://code.runnable.com/UqfN-4zVBhVwAAH9/solving-the-fibonacci-number-sequence-using-recursion-in-c%2B%2B-for-recursive

Here you can have a look of this code on GitHub. Captura de pantalla 2016-02-12 a las 18.35.41.png

And when the second program finally worked, I was like… #youknowthatfeel

jixctemu5rcpo

Thanks for reading! Peace…

5nczoumgibjzo

Alex H.

24294566811_7004231734_k
Another Sunrise over the

Continue reading “Quiz #3”