Computer Science Canada real values with drawfilloval() |
Author: | piemaster [ Wed Feb 28, 2007 8:09 pm ] | ||
Post subject: | real values with drawfilloval() | ||
We recently started [and some of us have finished] a Turing unit in class. we have an "alternate assignment" that was not actually assigned, but provided for extra fun. it goes as following. Create a graphing calc screen that will output a graph based upon the above function. Plot the above function when give then domain {-3.2<x<=3.2} the function mentioned is this. ((4 * (x ** 3)) + (3 * (x ** 2)) - (2 * x) + 6) / (x + 9) the following is the code i have so far.
as you can see, i have a function that calculates the y value for the center of the circle [which is a plot point on the graph, the x value is initially -3.2 and increases incrementally till 3.2] the error Turing throws at me is Argument is the wrong type. I assume this means I cant use a decimal value for either coordinate in the drawfilloval. is there any way around this? ps: I'm new here, if this post is completely out of bounds please lmk. Its not for homework, just for fun and i have valid , self-written code. pps: I'm also new to turing, so if im going about this in a completely idiotic manner, please don't judge |
Author: | Clayton [ Wed Feb 28, 2007 8:15 pm ] |
Post subject: | Re: real values with drawfilloval() |
you simply have to take the real value that you are getting and round() it to an integer. This makes sense because you can't have 1/2 a pixel right? |
Author: | piemaster [ Wed Feb 28, 2007 8:21 pm ] | ||
Post subject: | RE:real values with drawfilloval() | ||
but if i do that, wont the graph be inaccurate? i understand you can have half a pixel, but then is the problem given flawed? thanks for the help btw //edit: if i edit the code to look something like this:
the output kaboomerates itself. |