Topic: Calculating the remainder
What is the function for calculating a remainder in Graph? In coding languages it's a%b, but I didn't find it from the operator list. I would like to graph the attached function.
You are not logged in. Please login or register.
Graph Forums → Support → Calculating the remainder
What is the function for calculating a remainder in Graph? In coding languages it's a%b, but I didn't find it from the operator list. I would like to graph the attached function.
It is called mod in Graph.Try this in the beta version of Graph 4.4:
f(x)=Sum(Mod(x,i)-mod(x-i,i)-(x-2), i, 1, x-1)
It gives an error 56 that says "Invalid number of arguments supplied for the function 'sum'". When I write both 'sum' and 'mod' with small letters, it gives me a graph. At this point I notice that the graph is different from what it should be. Turns out that you wrote the function wrong and it should be f(x)=sum(mod(x,i)-mod(x-i,i), i, 1, x-1)-(x-2). Now, however, it gives me just a straight line, which is not the function that I expected either. Then I saw that you read my function even worse and mod(x-i,i) should actually be mod(x-1,i). NOW it's right. Thank you!
Sorry about that. I am afrad I was a little too fast, and I wasn't home when answering so I couldn't test it with Graph. I am glad you figured it out.
No problem. You made my day with those mistakes
Btw, why is that function called mod? I'm familiar with mod calculations but I hate them in this kind of use. That's because here the result is always the smallest possible positive number, but in math mod has infinite amount of results and also negative ones. Mod 3: 5 can be 2 as it's here, but it can also be -4, -1, 8, 11, 14 and so on. I know there isn't many ways how to handle such calculations with graphing software and it's practical to expect the wanted result to be the smallest positive, but it kind of made me confused.
There is the condition applied for modulo function: abs(reminder) < abs(divisor). This condition allows only two results for a calculation, positive or negative value. For Graph, there is an answer in menu item Help-Contents-Functions-Special-mod function. More detailed description can be found in http://en.wikipedia.org/wiki/Modulo_operation .
Graph Forums → Support → Calculating the remainder
Powered by PunBB, supported by Informer Technologies, Inc.
Generated in 0.011 seconds (72% PHP - 28% DB) with 10 queries