Browse Source

Fixing minor formatting issues

Rafael Arce Nazario 9 years ago
parent
commit
a56eb1a3b7
1 changed files with 13 additions and 37 deletions
  1. 13
    37
      README.md

+ 13
- 37
README.md View File

@@ -225,26 +225,19 @@ Before you get to the laboratory you should have:
225 225
 
226 226
 3. Taken the Pre-Lab quiz that can be found in Moodle.
227 227
 
228
----
229
----
230
-
231 228
 
232 229
 ## Parametric Equations
233 230
 
234 231
 *Parametric equations* allow us to represent a quantity as a function of one or more independent variables called *parameters*. In many occasions it is useful to represent curves using a set of parametric equations that express the coordinates of the points of the curve as functions of the parameters. For example, in your trigonometry course you should have studied that the equation of the circle of radius $$r$$ and centered at the origin has the following form:
235 232
 
236
-
237 233
 $$x^2+y^2=r^2.$$
238 234
 
239 235
 The points $$(x,y)$$ that satisfy this equation are the points that form the circle of radius $$r$$ and center at the origin. For example, the circle with $$r=2$$ and center at the origin has equation
240 236
 
241
-
242 237
 $$x^2+y^2=4,$$
243 238
 
244 239
 and its points are the ordered pairs $$(x,y)$$ that satisfy this equation. A parametric representation of the coordinates of the points in the circle of radius $$r$$ and center at the origin is:
245 240
 
246
-
247
-
248 241
 $$x=r \cos(t)$$
249 242
 
250 243
 $$y=r \sin(t),$$
@@ -299,7 +292,7 @@ In this exercise you will plot the graphs of some parametric equations of intere
299 292
 You can also download the folder `Expressions-PrettyPlots` from  `http://bitbucket.org/eip-uprrp/expressions-prettyplots`.
300 293
 
301 294
 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.
302
-
295
+    
303 296
 	---
304 297
 
305 298
 	![figura3.png](images/figura3.png)
@@ -309,46 +302,35 @@ You can also download the folder `Expressions-PrettyPlots` from  `http://bitbuck
309 302
 
310 303
 
311 304
 	---
312
-
305
+    
313 306
 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.
314
-
307
+    
315 308
 	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.
316 309
 
317
-	
318
-
319 310
 4.	You will now write the code needed to plot a circle. The line `XYPlotWindow wCircle;` creates the object `wCircle`  for the window that will contain the plot of the circle. Using as inspiration the code that plotted the segment, write the necessary code for your program to graph a circle of radius 3 and centered at the origin. Run your program and, if it is necessary, modify the code until you get the right plot. Remember that the circle should be plotted inside the `wCircle` object. Thus, when you invoke the `AddPointToGraph(x,y)`, `Plot` and `show` methods, they should be preceeded by `wCircle`; e.g. `wCircle.show()`.
320 311
 
321
-
322 312
 5. Your next task is to plot a curve with the following parametric equations:
323
-
324
-
313
+    
325 314
 	$$x=16 \sin^3(t)$$
326 315
 	$$y=13 \cos(t) - 5 \cos(2t) - 2 \cos(3t) - \cos(4t)-3.$$
327
-
328
-
316
+    
329 317
 	If you implement the equations correctly, you will see the image of a heart. This plot should be obtained inside an `XYPlotWindow` object called `wHeart`.
330
-
331 318
 	
332 319
 6.  You will now plot the curve of the following parametric equations:
333
-
334
-
320
+    
335 321
 	$$x=5\cos(t) \left[ \sin^2(1.2t) + \cos^3(6t) \right]$$
336 322
 	$$y= 10\sin(t) \left[ \sin^2(1.2t) +  \cos^3(6t) \right].$$
337
-
338
-
323
+    
339 324
 	Note that both expressions are almost the same, the only difference is that one starts  with $$5\cos(t)$$ and the other with $$10\sin(t)$$. Instead of computing $$\sin^2(1.2t) + \cos^3(6t)$$ twice, you can assign its value to another variable $$q$$ and compute $$x$$ and $$y$$ as follows:
340
-
341
-
325
+    
342 326
 	$$q =  \sin^2(1.2t) + \cos^3(6t)$$
343 327
 	$$x = 5 \cos(t)(q)$$
344 328
 	$$y = 10  \sin(t)(q).$$
345
-
346
-
329
+    
347 330
 	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`.
348 331
 
349 332
 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.
350 333
 
351
-	
352 334
 
353 335
 In [3] you can find other parametric equations of interesting curves.
354 336
 
@@ -373,27 +355,21 @@ Suppose that all courses in Cheo's University are 3 credits each and have the fo
373 355
 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).
374 356
 
375 357
 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.
376
-
358
+    
377 359
 	**Hints:** 
378
-
360
+     
379 361
 	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.
380
-
381
-
362
+    
382 363
 	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.
383 364
 
384 365
 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 "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.
385 366
 
386 367
 
387 368
 
388
-
389
-
390
----
391
----
392
-
393 369
 ##References:
394 370
 
395 371
 [1] http://mathworld.wolfram.com/ParametricEquations.html
396 372
 
397 373
 [2] http://paulbourke.net/geometry/butterfly/
398 374
 
399
-[3] http://en.wikipedia.org/wiki/Parametric_equation
375
+[3] http://en.wikipedia.org/wiki/Parametric_equation