WSQ14 – Scilab

First you must watch this tutorial video
It is really helpful.

For the download click here: http://www.scilab.org/download/latest

Something that makes sense to me, is that MathLab and SciLab are kind of similar programs that could help programers to do their stuff.

For me it’s just a really great program that works for programers like wolfram alpha. It is really helpful for any numeric analysis, create matrix, vectors, etc.
The spanish manual for Scilab it’s on this link.

Thank you, and see you next time.

Quiz 7

This quiz in fact, it’s one of the things I do on physics class. Here are the instructions:

“Create a function called dot_product that receives two lists of numbers (say list1 and
list2). The function returns what is the dot product of the two lists.

For full marks, if the lists are not the same size, then the function should return the
special value of NaN (which represents not a number).”

Captura de pantalla 2016-05-06 a las 9.32.51

I created two lists with arrays. And then the dot_product functions works with the formula s (for sum) –> s = s + (list1 [i] * list2 [2]); That inside of a for loop.

It was very easy, because of I know the formula from my physics class.

Here’s my GitHub if you want the code.

If you didn’t understand the dot product, for any reason, here’s a link that explains that topic.

FINAL PROJECT – SUDOKU

My partner in this assignment was Miguel Sandoval. At first we were discussing about what to do for the final project. But he gave the idea of doing one project from another year of the same course of TC101. So we actually look at this page of a year ago, from the TC101 Winter 2015 group.

We decide to do a Sudoku.

Captura de pantalla 2016-05-04 a las 15.56.30Captura de pantalla 2016-05-04 a las 15.56.54 Basically , we build our code based blog posts from students in that course . Also it was very helpful this website , to understand some concepts and to create the code. This web page was very useful too.
We did this almost all the time separated, so we could not make a video. But Ken himself, he made a video explaining the basics of the project. How it should work and stuff. If you want to take a look a his video it’s right here.

These are the specifications:

  • Create a text based version of a Sudoku.
  • Include all the rules and instructions that apply to the game.

Here’s the link to my GitHub for the code. And here’s the second one for the text file.

Working with Miguel was hard at the beginning because we had a lack of communication about the class. And we had troubles finding the topic, but it was he’s idea to do this project and I think he did the most part of the job. I believe he’s an incredible buddy to work with, and at the end, he won’t let you down.
So we stayed one afternoon in the library and we didn’t go home until the project was finished.

Any doubt, please let us know. Thank you, and we hope to see somewhere in the future.

 

WSQ12 (The Good One)

This page can help you to understand this assignment.

We needed to create a program that asks the user for a word which will be your search word and the name of a file to open and search for that word. Then create a function that will receive two parameters (both string) representing those two data points. This function returns the number of occurrences of that word in that file.

Take a look at this:

Captura de pantalla 2016-04-08 a las 11.59.12Captura de pantalla 2016-04-08 a las 12.38.25

First things first. You’ll need these libraries: iostream, string, fstream.

In the int main, you need to declare word, tipo and line as Strings. And the count, you can call it if you want it, but you don’t have to if you don’t wanna”.
And you ask for the word you will look for, and save it into “word”.
And then it asks for the name of the file, save it on tipo.

Well for the find_word() function you declare word and tipo. You equal the count to zero.
The ifstream my file.tipo will look for the file. If the code finds it, the file will open.
The you need to use a while loop (not do-while), with the parameter of getline(myline, line) that will read line by line the file. And if the line equals the word, the count will be count++. This will be ir until the file is done with lines. Then you need to close the file with myfile.close().
In case you couldn’t find it, the else should say “No se encontró” or whatever you want.

The function must return the total count.

Here’s my GitHub link to this code.

Quiz 6

Captura de pantalla 2016-04-07 a las 16.25.17Captura de pantalla 2016-04-07 a las 16.25.47

In this quiz, you needed to create a program which give you de Greatest Common Divisor between 2 numbers that you’ll provide.
This is possible using Euclid’s algorithm.

Just by following the Euclid’s algorithm, you can built the code and it really works.
But one of the thing that I add is, that if the numbers you give to the program are both zero, you will get an ERROR, because 0/0 it’s not defined. So they doesn’t have a GCD.

Here is my GitHub link to my code.

Good luck, and see you around.

Yo Soy 196

Captura de pantalla 2016-04-07 a las 15.34.05Captura de pantalla 2016-04-07 a las 15.34.35Captura de pantalla 2016-04-07 a las 15.35.15

We needed to create a program that asks the user for two pieces of data:

  • The lower bound of the sequence
  • The upper bound of the sequence
Then you check the values from the lower bound (inclusive) to the upper bound (inclusive) and make a report of them. During the analysis of each number, if a Lychrel number is found it should be reported immediately with something like “Found a Lychrel number: 196”
One of my friends, Lalo Maciel, helped with this assignment so here it is.
This page helped also. https://mattmccutchen.net/bigint/

Here’s my code in GitHub.

WSQ10

Captura de pantalla 2016-04-07 a las 14.17.31Captura de pantalla 2016-04-07 a las 14.17.48

This code is must of all, arrays and function. We needed to create a program that asks the user for 10 numbers  (floating point). Store those numbers in a list. Show to the user the total, average and standard deviation of those numbers.
Also you will need the cmath library for this one in the Standard deviation. If you don’t know what it is, look in here.

To get the 10 numbers with an array, you will use const int which is a constant integer which will be NUMBER_OF_NUMBERS = 10, so it will not change in the entire code.
To get all the numbers you’ll use an array and the “for loop” and they will save it in x[i].
The use a function func (float numbers[], number_of_numbers) with all the procedure that are required.

 

Here’s my GitHub link for my Code.