Przeglądaj źródła

Fixing the equations and some markdown

Rafael Arce Nazario 9 lat temu
rodzic
commit
2ba97142c3
1 zmienionych plików z 35 dodań i 37 usunięć
  1. 35
    37
      README.md

+ 35
- 37
README.md Wyświetl plik

@@ -40,6 +40,7 @@ Antes de llegar al laboratorio debes:
40 40
 3. haber tomado el quiz Pre-Lab que se encuentra en Moodle.
41 41
 
42 42
 ---
43
+
43 44
 ---
44 45
 
45 46
 
@@ -50,9 +51,9 @@ Una *ecuación cuadrática* tiene la forma
50 51
 
51 52
 $$y = a x^2+ b x + c,$$
52 53
 
53
-donde $a, b, c$ son números reales y $a\not=0$. La gráfica de una ecuación cuadrática es una *parábola* que abre hacia arriba si $a > 0$ y abre hacia abajo si $a < 0$. 
54
+donde $$a, b, c$$ son números reales y $$a\not=0$$. La gráfica de una ecuación cuadrática es una *parábola* que abre hacia arriba si $$a > 0$$ y abre hacia abajo si $$a < 0$$. 
54 55
 
55
-Una gráfica interseca el eje de $x$ cuando $y=0$. Por lo tanto, si una parábola interseca el eje de $x$, los intersectos están dados por las soluciones reales de la ecuación
56
+Una gráfica interseca el eje de $$x$$ cuando $$y=0$$. Por lo tanto, si una parábola interseca el eje de $$x$$, los intersectos están dados por las soluciones reales de la ecuación
56 57
 
57 58
 $$0 = a x^2 + b x + c.$$
58 59
 
@@ -60,9 +61,9 @@ Las soluciones a la ecuación anterior se pueden obtener utilizando la *fórmula
60 61
 
61 62
 $$x=\frac{-b±\sqrt{b^2-4ac}}{2a}.$$
62 63
 
63
-Nota que si el *discriminante*  $b^2-4ac$ de la fórmula cuadrática es negativo, los valores de $x$ serán números imaginarios y no se pueden graficar en el plano cartesiano porque los puntos $(x,y)$ en este plano tienen coordenadas que son números reales. Por lo tanto, si el discriminante es negativo, la parábola no interseca el eje de $x$. Si el discriminate es igual a $0$, entonces la parábola interseca el eje de $x$ en un solo punto (solo el vértice toca el eje de $x$).
64
+Nota que si el *discriminante*  $$b^2-4ac$$ de la fórmula cuadrática es negativo, los valores de $$x$$ serán números imaginarios y no se pueden graficar en el plano cartesiano porque los puntos $$(x,y)$$ en este plano tienen coordenadas que son números reales. Por lo tanto, si el discriminante es negativo, la parábola no interseca el eje de $$x$$. Si el discriminate es igual a $$0$$, entonces la parábola interseca el eje de $$x$$ en un solo punto (solo el vértice toca el eje de $$x$$).
64 65
 
65
-Si el discriminante es positivo, la fórmula cuadrática nos dá dos soluciones a la ecuación $0 = a x^2 + b x + c$ y estas soluciones son los intersectos en el eje de $x$. Por ejemplo, supón que la fórmula cuadrática nos dá dos valores 
66
+Si el discriminante es positivo, la fórmula cuadrática nos dá dos soluciones a la ecuación $$0 = a x^2 + b x + c$$ y estas soluciones son los intersectos en el eje de $$x$$. Por ejemplo, supón que la fórmula cuadrática nos dá dos valores 
66 67
 
67 68
 $$x=x_1$$
68 69
 $$x=x_2$$
@@ -72,13 +73,13 @@ Entonces,
72 73
 $$a x^2 + b x + c = a(x-x_1)(x-x_2),$$
73 74
 
74 75
 
75
-donde $x_1$ y $x_2$ son los cortes en el eje de $x$. Si $a<0$, la gráfica de la parábola será similar a la de la Figura 1.
76
+donde $$x_1$$ y $$x_2$$ son los cortes en el eje de $$x$$. Si $$a<0$$, la gráfica de la parábola será similar a la de la Figura 1.
76 77
 
77 78
 ---
78 79
 
79 80
 ![parabola.png](images/parabola.png)
80 81
 
81
-<b>Figura 1.</b> Parábola que abre hacia abajo e interseca el eje de $x$ en $x_1$ y $x_2$.
82
+<b>Figura 1.</b> Parábola que abre hacia abajo e interseca el eje de $$x$$ en $$x_1$$ y $$x_2$$.
82 83
 
83 84
 
84 85
 ---
@@ -87,11 +88,11 @@ Nota que la ecuación
87 88
 
88 89
 $$y=-(x-x_1)(x-x_2)$$
89 90
 
90
-es una ecuación cuadrática cuya parábola abre hacia abajo e  interseca el eje de $x$ en  $x_1$ y $x_2$. Por ejemplo, la ecuación
91
+es una ecuación cuadrática cuya parábola abre hacia abajo e  interseca el eje de $$x$$ en  $$x_1$$ y $$x_2$$. Por ejemplo, la ecuación
91 92
 
92 93
 $$y=-(x+2)(x-3)=-x^2+x+6$$
93 94
 
94
-es una ecuación cuadrática cuya parábola abre hacia abajo e interseca el eje de $x$ en $x_1=-2$ y $x_2=3$. Nota que, en esta ecuación, los valores de $a,b,c$  son $a=-1, \ b=1, \ c=6$.
95
+es una ecuación cuadrática cuya parábola abre hacia abajo e interseca el eje de $$x$$ en $$x_1=-2$$ y $$x_2=3$$. Nota que, en esta ecuación, los valores de $$a,b,c$$  son $$a=-1, \ b=1, \ c=6$$.
95 96
 
96 97
 ---
97 98
 
@@ -116,7 +117,7 @@ es una ecuación cuadrática cuya parábola abre hacia abajo e interseca el eje
116 117
 
117 118
 ###Ejercicio 1
118 119
 
119
-En este ejercicio implementarás la fórmula cuadrática para completar un juego en el que un sapito brinca de una hoja a otra. Asumirás que las hojas están localizadas sobre el eje de $x$ y que el brinco del sapito estará determinado por una parábola que abre hacia abajo. Si quieres que el sapito brinque de hoja a hoja, debes hayar una ecuación cuadrática cuya parábola abra hacia abajo e interseque el eje de $x$ en los lugares donde están localizadas las hojas. Tu tarea es escribir las ecuaciones para la fórmula cuadrática.
120
+En este ejercicio implementarás la fórmula cuadrática para completar un juego en el que un sapito brinca de una hoja a otra. Asumirás que las hojas están localizadas sobre el eje de $$x$$ y que el brinco del sapito estará determinado por una parábola que abre hacia abajo. Si quieres que el sapito brinque de hoja a hoja, debes hayar una ecuación cuadrática cuya parábola abra hacia abajo e interseque el eje de $$x$$ en los lugares donde están localizadas las hojas. Tu tarea es escribir las ecuaciones para la fórmula cuadrática.
120 121
 
121 122
 
122 123
 
@@ -134,7 +135,7 @@ En este ejercicio implementarás la fórmula cuadrática para completar un juego
134 135
 
135 136
     $$result=\frac{-b-\sqrt{b^2-4ac}}{2a}.$$
136 137
 
137
-    Los otros archivos del proyecto tienen código que hará pruebas a  las ecuaciones que escribiste evaluando varios valores para $a, b ,c$ y verificando que el resultado que producen las ecuaciones es el esperado.  La validación del código de un programa es una parte importante de el desarrollo de programas y proyectos.
138
+    Los otros archivos del proyecto tienen código que hará pruebas a  las ecuaciones que escribiste evaluando varios valores para $$a, b ,c$$ y verificando que el resultado que producen las ecuaciones es el esperado.  La validación del código de un programa es una parte importante de el desarrollo de programas y proyectos.
138 139
 
139 140
 4. Ejecuta el programa marcando el botón verde en el menú de la izquierda. Si las ecuaciones que escribiste están correctas, deberá aparecer una ventana parecida a la Figura 2.
140 141
 
@@ -144,13 +145,11 @@ En este ejercicio implementarás la fórmula cuadrática para completar un juego
144 145
 
145 146
     <b>Figura 2.</b> Ventana del juego *Quadratic Frog*.
146 147
 
147
-
148 148
     ---
149 149
 
150
-
151 150
 5. Entrega el archivo `QuadraticFormula.cpp` que contiene las funciones las funciones `QuadraticPlus` y `QuadraticMinus` utilizando   "Entrega 1" en Moodle. Recuerda utilizar buenas prácticas de programación, incluir el nombre de los programadores y documentar tu programa.
152 151
 
153
-6. Para jugar, el sapito deberá brincar de una hoja a otra. Nota que las hojas tienen valores para $x_1$ y $x_2$. Estos valores representan los intercectos en el eje de $x$ de la parábola. Debes entrar los valores para los coeficientes $a,b,c$ de la ecuación cuadrática de modo que la gráfica sea una parábola que abra hacia abajo e interseque el eje de $x$ en los valores $x_1, x_2$ que salen en las hojas. Puedes obtener los valores de $a,b,c$ notando que 
152
+6. Para jugar, el sapito deberá brincar de una hoja a otra. Nota que las hojas tienen valores para $$x_1$$ y $$x_2$$. Estos valores representan los intercectos en el eje de $$x$$ de la parábola. Debes entrar los valores para los coeficientes $$a,b,c$$ de la ecuación cuadrática de modo que la gráfica sea una parábola que abra hacia abajo e interseque el eje de $$x$$ en los valores $$x_1, x_2$$ que salen en las hojas. Puedes obtener los valores de $$a,b,c$$ notando que 
154 153
 
155 154
  $$a x^2 + b x + c = a(x-x_1)(x-x_2),$$
156 155
 
@@ -162,16 +161,14 @@ En este ejercicio implementarás la fórmula cuadrática para completar un juego
162 161
 
163 162
 En este ejercicio escribirás un  programa para obtener el promedio de puntos para la nota de un estudiante.
164 163
 
165
-Supón que todos los cursos en la Universidad de Yauco son de $3$ créditos y que las notas tienen las siguientes puntuaciones: $A = 4$ puntos por crédito; $B = 3$ puntos por crédito; $C = 2$ puntos por crédito; $D = 1$ punto por crédito y $F = 0$ puntos por crédito. 
164
+Supón que todos los cursos en la Universidad de Yauco son de 3 créditos y que las notas tienen las siguientes puntuaciones: $$A = 4$$ puntos por crédito; $$B = 3$$ puntos por crédito; $$C = 2$$ puntos por crédito; $$D = 1$$ punto por crédito y $$F = 0$$ puntos por crédito. 
166 165
 
167 166
 **Instrucciones**
168 167
 
169 168
 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).
170 169
 
171
-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. 
172
-
173
-
174
-
170
+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. 
171
+    
175 172
     **Ayudas:** 
176 173
 
177 174
     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.
@@ -181,8 +178,11 @@ Supón que todos los cursos en la Universidad de Yauco son de $3$ créditos y qu
181 178
 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. 
182 179
 
183 180
 
181
+
182
+
183
+
184 184
 ---
185
----
185
+
186 186
 ---
187 187
 
188 188
 
@@ -229,8 +229,8 @@ Before you get to the laboratory you should have:
229 229
 
230 230
 
231 231
 ---
232
----
233 232
 
233
+---
234 234
 
235 235
 
236 236
 ##Quadratic Formula
@@ -240,9 +240,9 @@ A *quadratic equation* has a form
240 240
 
241 241
 $$y = a x^2+ b x + c,$$
242 242
 
243
-where $a, b, c$ are real numbers and $a\not=0$. The graph of a quadratic equation is a *parabola* that opens up if $a > 0$ and opens dawn if $a < 0$.
243
+where $$a, b, c$$ are real numbers and $$a\not=0$$. The graph of a quadratic equation is a *parabola* that opens up if $$a > 0$$ and opens dawn if $$a < 0$$.
244 244
 
245
-A graph intersects the $x$-axis when $y=0$. Therefore, if a parabola intersects the $x$-axis, the intersects are given by the real solutions to the equation
245
+A graph intersects the $$x$$-axis when $$y=0$$. Therefore, if a parabola intersects the $$x$$-axis, the intersects are given by the real solutions to the equation
246 246
 
247 247
 
248 248
 
@@ -254,9 +254,9 @@ The solutions to the previous equation can be obtained using the *quadratic form
254 254
 
255 255
 $$x=\frac{-b±\sqrt{b^2-4ac}}{2a}.$$
256 256
 
257
-Note that if the *discriminant*   $b^2-4ac$ of the quadratic formula is negative, the values of $x$ are complex numbers and are not plotted in the Cartesian plane. Therefore, if the discriminant is negative, the parabola does not intersect the $x$-axis. If the discriminant is equal to $0$, then the parabola intersects the $x$-axis in only one point (only the vertex touches the $x$-axis).
257
+Note that if the *discriminant*   $$b^2-4ac$$ of the quadratic formula is negative, the values of $$x$$ are complex numbers and are not plotted in the Cartesian plane. Therefore, if the discriminant is negative, the parabola does not intersect the $$x$$-axis. If the discriminant is equal to $0$, then the parabola intersects the $$x$$-axis in only one point (only the vertex touches the $$x$$-axis).
258 258
 
259
-If the discriminant is positive, the quadratic formula gives two solutions to the equation $0 = a x^2 + b x + c$ and these solutions are the intersects in the $x$-axis. For example, suppose that the quadratic formula gives two values
259
+If the discriminant is positive, the quadratic formula gives two solutions to the equation $$0 = a x^2 + b x + c$$ and these solutions are the intersects in the $$x$$-axis. For example, suppose that the quadratic formula gives two values
260 260
 
261 261
 
262 262
 
@@ -267,13 +267,13 @@ Then,
267 267
 
268 268
 $$a x^2 + b x + c = a(x-x_1)(x-x_2),$$
269 269
 
270
-where $x_1$ and $x_2$ are the intersects in the $x$-axis. If $a<0$, the graph of the parabola will be similar to the one in Figure 1.
270
+where $$x_1$$ and $$x_2$$ are the intersects in the $$x$$-axis. If $$a<0$$, the graph of the parabola will be similar to the one in Figure 1.
271 271
 
272 272
 ---
273 273
 
274 274
 ![parabola.png](images/parabola.png)
275 275
 
276
-<b>Figure 1.</b> Parabola that opens down and intersects the $x$-axis in $x_1$ and $x_2$.
276
+<b>Figure 1.</b> Parabola that opens down and intersects the $$x$$-axis in $$x_1$$ and $$x_2$$.
277 277
 
278 278
 
279 279
 ---
@@ -283,12 +283,12 @@ Note that the equation
283 283
 
284 284
 $$y=-(x-x_1)(x-x_2)$$
285 285
 
286
-is a quadratic equation and its parabola opens down and intersects the $x$-axis in $x_1$ and $x_2$. For example, the equation
286
+is a quadratic equation and its parabola opens down and intersects the $$x$$-axis in $$x_1$$ and $$x_2$$. For example, the equation
287 287
 
288 288
 
289 289
 $$y=-(x+2)(x-3)=-x^2+x+6$$
290 290
 
291
-is a quadratic equation with a parabola that opens down and intersects the $x$-axis at $x_1=-2$ and $x_2=3$. Note that, in this equation, the values for $a, b, c$ are  $a=-1, \ b=1, \ c=6$.
291
+is a quadratic equation with a parabola that opens down and intersects the $$x$$-axis at $$x_1=-2$$ and $$x_2=3$$. Note that, in this equation, the values for $$a, b, c$$ are  $$a=-1, \ b=1, \ c=6$$.
292 292
 
293 293
 
294 294
 ---
@@ -313,7 +313,7 @@ is a quadratic equation with a parabola that opens down and intersects the $x$-a
313 313
 
314 314
 ###Exercise 1
315 315
 
316
-In this exercise you will implement the quadratic formula to complete a game in which a frog leaps from one leaf to another. You will assume that the leaves are in the $x$-axis and that the leap is determined by a parabola that opens down. If you want the frog to leap from leaf to leaf, you must find a quadratic equation with a parabola that opens down and intersects the $x$-axis in the places where the leaves are located. Your task is to write the equations for the quadratic formula.
316
+In this exercise you will implement the quadratic formula to complete a game in which a frog leaps from one leaf to another. You will assume that the leaves are in the $$x$$-axis and that the leap is determined by a parabola that opens down. If you want the frog to leap from leaf to leaf, you must find a quadratic equation with a parabola that opens down and intersects the $$x$$-axis in the places where the leaves are located. Your task is to write the equations for the quadratic formula.
317 317
 
318 318
 
319 319
 
@@ -332,7 +332,7 @@ In this exercise you will implement the quadratic formula to complete a game in
332 332
 
333 333
     $$result=\frac{-b-\sqrt{b^2-4ac}}{2a}.$$
334 334
 
335
-    The other files of the project have code that will test your equations by evaluating several choices for $a, b, c$ and verifying that the equations produce the expected result. Code validation is an important part of software development.
335
+    The other files of the project have code that will test your equations by evaluating several choices for $$a, b, c$$ and verifying that the equations produce the expected result. Code validation is an important part of software development.
336 336
 
337 337
 
338 338
 4. Run the program by clicking the green arrow in the menu on the left side of the Qt Creator window. If your equations are implemented correclty, you should obtain a window similar to the one in Figure 2.
@@ -343,13 +343,12 @@ In this exercise you will implement the quadratic formula to complete a game in
343 343
 
344 344
     <b>Figure 2.</b> Window of the game *Quadratic Frog*.
345 345
 
346
-
347 346
     ---
348 347
 
349 348
 
350 349
 5. Use "Deliver 1" in Moodle to submit the file  `QuadraticFormula.cpp` containing the code with the functions `QuadraticPlus` and `QuadraticMinus`. Remember to use good programming practices, to include the names of the programmers and to document your program.
351 350
 
352
-6. To play, the frog should leap jump from one leaf to another. Note that the leaves have values for $x_1$ and $x_2$. These values represent the intersects of the parabola with the $x$-axis. You should input the values for the coefficients $a, b, c$ of the quadratic equation so that its graph that is a parabola that opens down and intersects the $x$-axis in the values $x_1, x_2$ shown in the leaves. You can obtain these values noting that
351
+6. To play, the frog should leap jump from one leaf to another. Note that the leaves have values for $$x_1$$ and $$x_2$$. These values represent the intersects of the parabola with the $$x$$-axis. You should input the values for the coefficients $$a, b, c$$ of the quadratic equation so that its graph that is a parabola that opens down and intersects the $$x$$-axis in the values $$x_1, x_2$$ shown in the leaves. You can obtain these values noting that
353 352
 
354 353
 
355 354
  $$a x^2 + b x + c = a(x-x_1)(x-x_2),$$
@@ -363,19 +362,18 @@ In this exercise you will implement the quadratic formula to complete a game in
363 362
 
364 363
 In this exercise you will write a program to obtain a student's grade point average (GPA).
365 364
 
366
-Suppose that all courses in Cheo's University are 3 credits each and have the following point values: $A = 4$ points per credit; $B = 3$ points per credit; $C = 2$ points per credit; $D = 1$ point per credit y $F = 0$ points per credit. 
365
+Suppose that all courses in Cheo's University are 3 credits each and have the following point values: $$A = 4$$ points per credit; $$B = 3$$ points per credit; $$C = 2$$ points per credit; $$D = 1$$ point per credit y $$F = 0$$ points per credit. 
367 366
 
368 367
 **Instructions**
369 368
 
370 369
 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).
371 370
 
372
-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.
373
-
371
+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.
372
+    
374 373
     **Hints:** 
375
-
374
+    
376 375
     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.
377 376
 
378
-
379 377
     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.
380 378
 
381 379
 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.