Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
MTH4105 Introduction to Mathematical Computing Feedback Exercises 5: Plotting, strings and drawing School of Mathematical Sciences © 2016 by Dr Francis J. Wright Answer the questions below in a copy of the answer template document available from QMplus. Your coursework submissions provide evidence that you are engaging with this module. Failure to submit coursework may result in you being deregistered. When answering the questions, use standard typography for any mathematical notation that you include. Use hyperlinks for any web references and spell check the document before submitting it. Upload you completed answer document to QMplus by the deadline, which will normally be about a week after each question sheet is released on QMplus. The precise deadline and submission mechanism are specified in QMplus. You will be provided with feedback on your answers and I will release example solutions after the submission deadline. Question 1 1 /2 1 /3 1 /4 Plot the graphs of x , x , x , x as functions of x together on the same axes for x % 2 with a legend that clearly identifies the plots. My answer > plot x, x MTH4105 / FJW x 1 /2 , x 1 /3 , x 1 /4 , x =K2 ..2, legend = x , x 1 /2 , x 1 /3 , 1 /4 Page 1 of 5 13-Oct-2016 2 1.5 1 0.5 K2 K1 0 1 2 x x x x 1/3 x 1/4 Question 2 A Pythagorean triple can be defined as a sequence of natural numbers a, b, c with 2 2 2 a ! b ! c such that a Cb = c , and a triangle with sides of these lengths is therefore right-angled. Four small Pythagorean triples are (3, 4, 5), (5, 12, 13), (7, 24, 25) and (8, 15, 17). Plot the corresponding right-angled triangles in different colours superimposed on one plot, all with the right angle at the origin, the side of length a going vertically up and the side of length b going horizontally to the right. Include a suitable title and legend and ensure that the plot is geometrically correct. It is probably easiest to construct each plot separately and then display them together. My answer This is probably the easiest approach: > P d plot 0, 0 , 0, 3 , 4, 0 , 0, 0 , legend = "(3, 4, 5)", colour = red , plot 0, 0 , 0, 5 , 12, 0 , 0, 0 , legend = "(5, 12, 13)", colour = blue , plot 0, 0 , 0, 7 , 24, 0 , 0, 0 , legend = "(7, 24, 25)", colour = green , plot 0, 0 , 0, 8 , 15, 0 , 0, 0 , legend = "(8, 15, 17)", colour = violet : > plots:-display P, scaling = constrained, title = "Four small right-angled triangles based on Pythagorean triples" MTH4105 / FJW Page 2 of 5 13-Oct-2016 Four small right-angled triangles based on Pythagorean triples 8 6 4 2 0 0 5 10 (3, 4, 5) (8, 15, 17) 15 (5, 12, 13) 20 (7, 24, 25) Here is an alternative using only the plot function: > plot 0, 0 , 0, 3 , 4, 0 , 0, 0 , 0, 0 , 0, 5 , 12, 0 , 0, 0 , 0, 0 , 0, 7 , 24, 0 , 0, 0 , 0, 0 , 0, 8 , 15, 0 , 0, 0 , legend = "(3, 4, 5)", "(5, 12, 13)", "(7, 24, 25)", "(8, 15, 17)" , scaling = constrained, title = "Four small right-angled triangles based on Pythagorean triples" Four small right-angled triangles based on Pythagorean triples 8 6 4 2 0 0 5 10 (3, 4, 5) (8, 15, 17) (5, 12, 13) 15 20 (7, 24, 25) Question 3 2 Plot the rotated parabola x = y for 0 % x % 9,K3 % y % 3 as (what looks like) a single blue curve in two ways: a) as a single curve defined implicitly by using the implicitplot function in the plots package; b) as the graphs of the two functions corresponding to y =G x combined on a single MTH4105 / FJW Page 3 of 5 13-Oct-2016 b) plot. In both cases, include a suitable title and label the axes with the variables x and y. What differences do you notice between the two plots? My answer 2 > plots:-implicitplot x = y , x = 0 ..9, y =K3 ..3, colour = blue, title 2 = typeset "The parabola ", x = y 2 The parabola x = y 3 2 1 0 y 1 2 3 4 5 6 7 8 9 x K1 K2 K3 x ,K x , x = 0 ..9, 'y', colour = blue, title = typeset "The parabola ", x > plot =y MTH4105 / FJW 2 Page 4 of 5 13-Oct-2016 The parabola x = y2 3 2 y 1 0 1 2 3 4 5 6 7 8 9 x K1 K2 K3 The two plots differ in that Maple places the vertical axis label y differently and the implicit plot is less smooth, especially near the origin where the curvature is highest. [Remark: Generally, implicit plots tend to be less smooth than plots of graphs of functions because of the underlying algorithms used.] MTH4105 / FJW Page 5 of 5 13-Oct-2016