Browse Source

Arreglando README. Mejore figuras.

Rafael Arce Nazario 8 years ago
parent
commit
0f5d388a67
4 changed files with 77 additions and 31 deletions
  1. 77
    31
      README.md
  2. BIN
      images/circuloAngulo01.png
  3. BIN
      images/circuloPuntos01.png
  4. BIN
      images/segment01.png

+ 77
- 31
README.md View File

64
 
64
 
65
 ---
65
 ---
66
 
66
 
67
-![figura1.jpg](images/figura1.jpg)
67
+![figura1.jpg](images/circuloAngulo01.png)
68
 
68
 
69
 <b>Figura 1.</b> Círculo con centro en el origen y radio $r$.
69
 <b>Figura 1.</b> Círculo con centro en el origen y radio $r$.
70
 
70
 
72
 
72
 
73
 ---
73
 ---
74
 
74
 
75
-Para graficar una curva que está definida usando ecuaciones paramétricas, computamos los valores de $x$ y $y$ para un conjunto de valores del parámetro. Por ejemplo, para $r = 2$, algunos de los valores son
75
+Para graficar una curva que está definida usando ecuaciones paramétricas, computamos los valores de $x$ y $y$ para un conjunto de valores del parámetro. Por ejemplo, la Figura 2 resalta los valores de $t$, $x$ y $y$ para el círculo con $r = 2$.
76
 
76
 
77
 ---
77
 ---
78
 
78
 
79
-| $t$ | $x$ | $y$ |
80
-|-----|-----|-----|
81
-| $0$ | $2$ | $0$ |
82
-| $\frac{\pi}{4}$ | $\frac{\sqrt{2}}{2}$ | $\frac{\sqrt{2}}{2}$ |
83
-| $\frac{\pi}{2}$ | $0$ | $2$ |
84
 
79
 
80
+![figura2.jpg](images/circuloPuntos01.png)
85
 
81
 
86
 **Figura 2.** Algunas coordenadas de los puntos $(x,y)$ del círculo con radio $r=2$ y centro en el origen.
82
 **Figura 2.** Algunas coordenadas de los puntos $(x,y)$ del círculo con radio $r=2$ y centro en el origen.
87
 
83
 
96
 
92
 
97
 **Instrucciones**
93
 **Instrucciones**
98
 
94
 
99
-1.	Carga a Qt el proyecto `prettyPlot`  haciendo doble "click" en el archivo `prettyPlot.pro` que se encuentra en la carpeta `Documents/eip/Expressions-PrettyPlots` de tu computadora. También puedes ir a `http://bitbucket.org/eip-uprrp/expressions-prettyplots` para descargar la carpeta `Expressions-PrettyPlots` a tu computadora.
95
+1.	Carga a Qt Creator el proyecto `prettyPlot`  haciendo doble "click" en el archivo `prettyPlot.pro` que se encuentra en la carpeta `Documents/eip/Expressions-PrettyPlots` de tu computadora. También puedes ir a `http://bitbucket.org/eip-uprrp/expressions-prettyplots` para descargar la carpeta `Expressions-PrettyPlots` a tu computadora.
100
 
96
 
101
 2. Configura el proyecto y ejecuta el programa marcando la flecha verde en el menú de la izquierda de la ventana de Qt Creator. El programa debe mostrar una ventana parecida a la Figura 3.
97
 2. Configura el proyecto y ejecuta el programa marcando la flecha verde en el menú de la izquierda de la ventana de Qt Creator. El programa debe mostrar una ventana parecida a la Figura 3.
102
 
98
 
103
 	---
99
 	---
104
 
100
 
105
-	![figura3.png](images/figura3.png)
101
+	![figura3.png](images/segment01.png)
106
 
102
 
107
 	<b>Figura 3.</b> Segmento de línea desplegado por el programa <i>PrettyPlot</i>.
103
 	<b>Figura 3.</b> Segmento de línea desplegado por el programa <i>PrettyPlot</i>.
108
 
104
 
109
 	---
105
 	---
110
 
106
 
111
-3. El archivo `main.cpp` (en Sources) contiene la función `main()` donde estarás añadiendo código. Abre ese archivo y estudia el código. La línea `XYPlotWindow wLine;` crea el objeto `wLine` que será la ventana en donde se dibujará una gráfica, en este caso la gráfica de un segmento. Observa el ciclo `for`. En este ciclo se genera una serie de valores para $t$ y se computa un valor de $x$ y $y$ para cada valor de $t$. Cada par ordenado $(x,y)$  es añadido a la gráfica del segmento por el método `AddPointToGraph(x,y)`. Luego del ciclo se invoca el método `Plot()`, que "dibuja" los puntos, y el método `show()`, que muestra la gráfica. Los *métodos* son funciones que nos permiten trabajar con los datos de los objetos. Nota que cada uno de los métodos se escribe luego de `wLine`, seguido de un punto. En una experiencia de laboratorio posterior aprenderás más sobre objetos y practicarás como crearlos e invocar sus métodos.
112
-
113
-	Las expresiones que tiene tiene tu programa para $x$ y $y$  son ecuaciones paramétricas  para la línea que pasa por el origen y tiene el mismo valor para las  coordenadas en $x$ y $y$. Explica por qué la línea solo va desde 0 hasta aproximadamente 6.
107
+3. El archivo `main.cpp` (en Sources) contiene la función `main()` donde estarás añadiendo código. Abre ese archivo y estudia el código. 
108
+
109
+    ```cpp
110
+    QApplication a(argc, argv);
111
+    XYPlotWindow wLine;
112
+    XYPlotWindow wCircle;
113
+    XYPlotWindow wHeart;
114
+    XYPlotWindow wButterfly;
115
+    
116
+    double y = 0.00;
117
+    double x = 0.00;
118
+    double increment = 0.01;
119
+    
120
+    for (double t = 0; t < 2*M_PI; t = t + increment) {      
121
+        // parametric equations
122
+        x = t;
123
+        y = t;
124
+
125
+        // add x and y as a point in the graph
126
+        wLine.AddPointToGraph(x,y);
127
+    }
128
+    
129
+    // After all the points have been added, plot and show the graph
130
+    wLine.Plot();
131
+    wLine.show();
132
+    ```
133
+
134
+    La línea `XYPlotWindow wLine;` crea el objeto `wLine` que será la ventana en donde se dibujará una gráfica, en este caso la gráfica de un segmento. Observa el ciclo `for`. En este ciclo se genera una serie de valores para $t$ y se computa un valor de $x$ y $y$ para cada valor de $t$. Cada par ordenado $(x,y)$  es añadido a la gráfica del segmento por el método `AddPointToGraph(x,y)`. Luego del ciclo se invoca el método `Plot()`, que "dibuja" los puntos, y el método `show()`, que muestra la gráfica. Los *métodos* son funciones que nos permiten trabajar con los datos de los objetos. Nota que cada uno de los métodos se escribe luego de `wLine`, seguido de un punto. En una experiencia de laboratorio posterior aprenderás más sobre objetos y practicarás cómo crearlos e invocar sus métodos.
135
+
136
+	Las expresiones que tiene tu programa para $x$ y $y$  son ecuaciones paramétricas para la línea que pasa por el origen y tiene el mismo valor para las  coordenadas en $x$ y $y$. Explica por qué la línea solo va desde 0 hasta aproximadamente 6.
114
 
137
 
115
 4.	Ahora escribirás el código necesario para graficar un círculo. La línea `XYPlotWindow wCircle;` crea el objeto `wCircle` para la ventana donde se graficará el círculo. Usando como inspiración el código para graficar el segmento, escribe el código necesario para que tu  programa grafique un círculo de radio 3 con centro en el origen.  Ejecuta tu programa y, si es necesario, modifica el código hasta que obtengas la gráfica correcta. Recuerda que el círculo debe graficarse dentro del objeto `wCircle`. Por esto, al invocar los métodos `AddPointToGraph(x,y)`, `Plot` y `show`, éstos deben ser precedidos por `wCircle`, por ejemplo, `wCircle.show()`.
138
 4.	Ahora escribirás el código necesario para graficar un círculo. La línea `XYPlotWindow wCircle;` crea el objeto `wCircle` para la ventana donde se graficará el círculo. Usando como inspiración el código para graficar el segmento, escribe el código necesario para que tu  programa grafique un círculo de radio 3 con centro en el origen.  Ejecuta tu programa y, si es necesario, modifica el código hasta que obtengas la gráfica correcta. Recuerda que el círculo debe graficarse dentro del objeto `wCircle`. Por esto, al invocar los métodos `AddPointToGraph(x,y)`, `Plot` y `show`, éstos deben ser precedidos por `wCircle`, por ejemplo, `wCircle.show()`.
116
 
139
 
139
 
162
 
140
 7. Entrega el archivo `main.cpp` que contiene el código con las ecuaciones paramétricas de las gráficas del círculo, el corazón y la mariposa utilizando   "Entrega 1" en Moodle. Recuerda utilizar buenas prácticas de programación, incluir el nombre de los programadores y documentar tu programa.
163
 7. Entrega el archivo `main.cpp` que contiene el código con las ecuaciones paramétricas de las gráficas del círculo, el corazón y la mariposa utilizando   "Entrega 1" en Moodle. Recuerda utilizar buenas prácticas de programación, incluir el nombre de los programadores y documentar tu programa.
141
 
164
 
142
-En [3] puedes encontrar otras ecuaciones paramétricas de otras curvas interesantes.
165
+En [2] y [3] puedes encontrar otras ecuaciones paramétricas de otras curvas interesantes.
143
 
166
 
144
 
167
 
145
 ###Ejercicio 2
168
 ###Ejercicio 2
152
 
175
 
153
 1. Crea un nuevo proyecto "Non-Qt" llamado Promedio. Tu función `main()`  contendrá el código necesario para pedirle al usuario el número de A's, B's, C's, D's y F's obtenidas por el estudiante y computar el promedio de puntos para la nota (GPA por sus siglas en inglés).
176
 1. Crea un nuevo proyecto "Non-Qt" llamado Promedio. Tu función `main()`  contendrá el código necesario para pedirle al usuario el número de A's, B's, C's, D's y F's obtenidas por el estudiante y computar el promedio de puntos para la nota (GPA por sus siglas en inglés).
154
 
177
 
155
-2. Tu código debe definir las constantes $A=4, B=3, C=2, D=1, F=0$ para la puntuación de las notas, y pedirle al usuario que entre los valores para las variables $NumA$, $NumB$, $NumC$, $NumD$, $NumF$. La variable $NumA$ representará el número de cursos en los que el estudiante obtuvo $A$,  $NumB$ representará el número de cursos en los que el estudiante obtuvo $B$, etc. El programa debe desplegar el GPA del estudiante en una escala de 0 a 4 puntos. 
178
+2. Tu código debe definir las **constantes** $A=4, B=3, C=2, D=1, F=0$ para la puntuación de las notas, y pedirle al usuario que entre los valores para las variables $NumA$, $NumB$, $NumC$, $NumD$, $NumF$. La variable $NumA$ representará el número de cursos en los que el estudiante obtuvo $A$,  $NumB$ representará el número de cursos en los que el estudiante obtuvo $B$, etc. El programa debe desplegar el GPA del estudiante en una escala de 0 a 4 puntos. 
156
 
179
 
157
 
180
 
158
 
181
 
160
 
183
 
161
 	1. El promedio se obtiene sumando las puntuaciones  correspondientes a las notas obtenidas (por ejemplo, una A en un curso de 3 créditos tiene una puntuación de 12), y dividiendo esa suma por el número total de créditos.
184
 	1. El promedio se obtiene sumando las puntuaciones  correspondientes a las notas obtenidas (por ejemplo, una A en un curso de 3 créditos tiene una puntuación de 12), y dividiendo esa suma por el número total de créditos.
162
 
185
 
163
-	2. Recuerda que, en C++, si divides dos números enteros el resultado se "truncará" y será un número entero. Utiliza "type casting": `static_cast\<tipo\>(expresión)' para resolver este problema.
186
+	2. Recuerda que, en C++, si divides dos números enteros el resultado se "truncará" y será un número entero. Utiliza "type casting": `static_cast<tipo>(expresión)` para resolver este problema.
164
 
187
 
165
-3. Verifica tu programa calculando el promedio de un estudiante que tenga dos A y dos B; ¿qué nota tendría este estudiante, A o B (la A va desde 3.5 a 4.0)?. Cuando tu programa esté correcto, guarda el archivo `main.cpp` y entrégalo  utilizando  "Entrega 2" en Moodle. Recuerda seguir las instrucciones en el uso de nombres y tipos para las variables,  incluir el nombre de los programadores, documentar tu programa y utilizar buenas prácticas de programación. 
188
+3. Verifica tu programa calculando el promedio de un estudiante que tenga dos A y dos B; ¿qué promedio tendría este estudiante?. Cuando tu programa esté correcto, guarda el archivo `main.cpp` y entrégalo  utilizando  "Entrega 2" en Moodle. Recuerda seguir las instrucciones en el uso de nombres y tipos para las variables,  incluir el nombre de los programadores, documentar tu programa y utilizar buenas prácticas de programación. 
166
 
189
 
167
 
190
 
168
 
191
 
249
 
272
 
250
 ---
273
 ---
251
 
274
 
252
-![figura1.jpg](images/figura1.jpg)
275
+![figura1.jpg](images/circuloAngulo01.png)
253
 
276
 
254
 <b>Figure 1.</b> Circle of radius $r$ and centered at the origin.
277
 <b>Figure 1.</b> Circle of radius $r$ and centered at the origin.
255
 
278
 
257
 
280
 
258
 ---
281
 ---
259
 
282
 
260
-To plot a curve that is described  by parametric equations, we compute the $x$ and $y$ values for a set of values of the parameter. For example, for $r=2$, some of the values are
283
+To plot a curve that is described  by parametric equations, we compute the $x$ and $y$ values for a set of values of the parameter. For example, Figure 2 shows the $t$, $x$ y $y$ values for some of the points in the circle with $r = 2$.
261
 
284
 
262
 
285
 
263
 ---
286
 ---
264
 
287
 
265
-| $t$ | $x$ | $y$ |
266
-|-----|-----|-----|
267
-| $0$ | $2$ | $0$ |
268
-| $\frac{\pi}{4}$ | $\frac{\sqrt{2}}{2}$ | $\frac{\sqrt{2}}{2}$ |
269
-| $\frac{\pi}{2}$ | $0$ | $2$ |
270
 
288
 
289
+![figura2.jpg](images/circuloPuntos01.png)
271
 
290
 
272
 **Figure 2.** Some of the coordinates of the points $(x,y)$ of the circle of radius $r=2$ and centered at the origin.
291
 **Figure 2.** Some of the coordinates of the points $(x,y)$ of the circle of radius $r=2$ and centered at the origin.
273
 
292
 
282
 
301
 
283
 **Instructions**
302
 **Instructions**
284
 
303
 
285
-1. Double click the file `prettyPlot.pro` that is inside the `Documents/eip/Expressions-PrettyPlots` folder to load the project `prettyPlot` into Qt. 
304
+1. Double click the file `prettyPlot.pro` that is inside the `Documents/eip/Expressions-PrettyPlots` folder to load the project `prettyPlot` into Qt Creator. 
286
 You can also download the folder `Expressions-PrettyPlots` from  `http://bitbucket.org/eip-uprrp/expressions-prettyplots`.
305
 You can also download the folder `Expressions-PrettyPlots` from  `http://bitbucket.org/eip-uprrp/expressions-prettyplots`.
287
 
306
 
288
 2. Configure the project and run the program by clicking the green arrow in the menu on the left side of the Qt Creator window. The program should display a window similar to the one in Figure 3.
307
 2. Configure the project and run the program by clicking the green arrow in the menu on the left side of the Qt Creator window. The program should display a window similar to the one in Figure 3.
289
 
308
 
290
 	---
309
 	---
291
 
310
 
292
-	![figura3.png](images/figura3.png)
311
+	![figura3.png](images/segment01.png)
293
 
312
 
294
 	<b>Figure 3.</b> Line segment displayed by the program <i>PrettyPlot</i>.
313
 	<b>Figure 3.</b> Line segment displayed by the program <i>PrettyPlot</i>.
295
 
314
 
297
 
316
 
298
 	---
317
 	---
299
 
318
 
300
-3. The file `main.cpp` (in Sources) contains the function `main()` where you will be adding code. Open this file and study the code. The line  `XYPlotWindow wLine;` creates the object `wLine`, that is the window that will show the plot of a graph, in this case the graph of a segment. Look at the `for` cycle. In this cycle several values for $t$ are generated and a value for $x$ and $y$ is computed for each $t$. Each ordered pair $(x,y)$ is added to the graph of the segment by the method `AddPointToGraph(x,y)`.  After the cycle, there is a call to the  method  `Plot()`, to "draw" the points in the graph, and to the method `show()`, to show the plot. The *methods* are functions that allow us to work with the data of an object. Note that each of the methods is written after `wLine`, and followed by a period. In a later laboratory experience you will learn more about objects and practice how to create them and invoke their methods.
319
+3. The file `main.cpp` (in Sources) contains the function `main()` where you will be adding code. Open this file and study the code. 
320
+
321
+    ```cpp
322
+    QApplication a(argc, argv);
323
+    XYPlotWindow wLine;
324
+    XYPlotWindow wCircle;
325
+    XYPlotWindow wHeart;
326
+    XYPlotWindow wButterfly;
327
+    
328
+    double y = 0.00;
329
+    double x = 0.00;
330
+    double increment = 0.01;
331
+    
332
+    for (double t = 0; t < 2*M_PI; t = t + increment) {      
333
+        // parametric equations
334
+        x = t;
335
+        y = t;
336
+
337
+        // add x and y as a point in the graph
338
+        wLine.AddPointToGraph(x,y);
339
+    }
340
+    
341
+    // After all the points have been added, plot and show the graph
342
+    wLine.Plot();
343
+    wLine.show();
344
+    ```
345
+
346
+    The line  `XYPlotWindow wLine;` creates the object `wLine`, that is the window that will show the plot of a graph, in this case the graph of a segment. Look at the `for` cycle. In this cycle several values for $t$ are generated and a value for $x$ and $y$ is computed for each $t$. Each ordered pair $(x,y)$ is added to the graph of the segment by the method `AddPointToGraph(x,y)`.  After the cycle, there is a call to the  method  `Plot()`, to "draw" the points in the graph, and to the method `show()`, to show the plot. The *methods* are functions that allow us to work with the data of an object. Note that each of the methods is written after `wLine`, and followed by a period. In a future laboratory experience you will learn more about objects and practice how to create them and invoke their methods.
301
 
347
 
302
 	The expressions for $x$ and $y$ are parametric equations for the line that passes through the origin and has the same value for $x$ and $y$. Explain why this line only goes from 0 to approximately 6.
348
 	The expressions for $x$ and $y$ are parametric equations for the line that passes through the origin and has the same value for $x$ and $y$. Explain why this line only goes from 0 to approximately 6.
303
 
349
 
333
 
379
 
334
 	Implement the above expressions,  change the condition for termination of the  `for` to   `t < 16*M_PI`, and look at the plot that it is displayed. It should look like a butterfly. This plot should be obtained inside an `XYPlotWindow` object called `wButterfly`.
380
 	Implement the above expressions,  change the condition for termination of the  `for` to   `t < 16*M_PI`, and look at the plot that it is displayed. It should look like a butterfly. This plot should be obtained inside an `XYPlotWindow` object called `wButterfly`.
335
 
381
 
336
-7. Use "Deliver 1" in Moodle to submit the file  `main.cpp` containing the code with the parametric equations for the graphs of the circle, the heart, and the butterfly. Remember to use good programming practices, to include the names of the programmers and to document your program.
382
+7. Use "Deliverable 1" in Moodle to submit the file  `main.cpp` containing the code with the parametric equations for the graphs of the circle, the heart, and the butterfly. Remember to use good programming practices, to include the names of the programmers and to document your program.
337
 
383
 
338
 	
384
 	
339
 
385
 
340
-In [3] you can find other parametric equations of interesting curves.
386
+In [2] and [3] you can find other parametric equations of interesting curves.
341
 
387
 
342
 
388
 
343
 
389
 
351
 
397
 
352
 1. Start a new "Non-Qt" project called "Average". Your `main()` function will contain the necessary code to ask the user for the number of A's, B's, C's, D's and F's obtained and compute the grade point average (GPA).
398
 1. Start a new "Non-Qt" project called "Average". Your `main()` function will contain the necessary code to ask the user for the number of A's, B's, C's, D's and F's obtained and compute the grade point average (GPA).
353
 
399
 
354
-2. Your code should define the constants  $A=4, B=3, C=2, D=1, F=0$ for the points per credit, and ask the user to input the values for the variables  $NumA$, $NumB$, $NumC$, $NumD$, $NumF$. The variable $NumA$ represents the number of courses in which the student obtained A, $NumB$ represents the number of courses in which the student obtained B, etc. The program should display the GPA using the 0-4 point scale.
400
+2. Your code should define the **constants**  $A=4, B=3, C=2, D=1, F=0$ for the points per credit, and ask the user to input the values for the variables  $NumA$, $NumB$, $NumC$, $NumD$, $NumF$. The variable $NumA$ represents the number of courses in which the student obtained A, $NumB$ represents the number of courses in which the student obtained B, etc. The program should display the GPA using the 0-4 point scale.
355
 
401
 
356
 	**Hints:** 
402
 	**Hints:** 
357
 
403
 
358
 	1. You can obtain the GPA by adding the credit points corresponding to the grades (for example, an A in a 3 credit course has a value of 12 points), and dividing this sum by the total number of credits.
404
 	1. You can obtain the GPA by adding the credit points corresponding to the grades (for example, an A in a 3 credit course has a value of 12 points), and dividing this sum by the total number of credits.
359
 
405
 
360
 
406
 
361
-	2. Remember that, in C++, when both operands in the division are integers, the result will also be an integer; the remainder will be discarded. Use "type casting": `static_cast\<type\>(expression)' to solve this problem.
407
+	2. Remember that, in C++, when both operands in the division are integers, the result will also be an integer; the remainder will be discarded. Use "type casting": `static_cast<type>(expression)` to solve this problem.
362
 
408
 
363
-3. Verify your program by computing the GPA of a student that has two A's and 2 B's; what is the grade of this student, A or B (A goes from 3.5 to 4 points)? When your program is correct, save the `main.cpp` file and submit it using "Deliver 2" in Moodle. Remember to follow the instructions regarding the names and types of the variables,  to include the names of the programmers, to document your program and to use good programming practices.
409
+3. Verify your program by computing the GPA of a student that has two A's and 2 B's; what is the average of this student?. When your program is correct, save the `main.cpp` file and submit it using "Deliverable 2" in Moodle. Remember to follow the instructions regarding the names and types of the variables,  to include the names of the programmers, to document your program and to use good programming practices.
364
 
410
 
365
 
411
 
366
 
412
 

BIN
images/circuloAngulo01.png View File


BIN
images/circuloPuntos01.png View File


BIN
images/segment01.png View File