Re: Sawtooth formula?



"WebSnozz" <shumaker@xxxxxxxxxx> wrote:
This works perfectly with the exception of input of 40 is giving me
output of 40 on my computer. It looks like it is not definetly either
40 or 0.

You're right. I apologize. The formula I gave works fine except when x is
an integer multiple of 40. But this problem may not be easily overcome if
you really want a formula using trig and inverse trig functions.

I was hoping for something that would descend from 39 to 0 on
the inputs 39 to 40, such that input 39.9 gives something like 0.1,

If that were true, it would not truly be a sawtooth.

so
that at the input of 40, there is no question about the output being 0.

That's a different matter.

Are you just trying to program this on a computer? If so, there should be
no reason to use trig functions! Do you have available a function which
gives the remainder when x is divided by y? It might be called mod(x, y).
If so, then

Sawtooth(x) = mod(x, 40)

should be exactly what you need.

David
.



Relevant Pages

  • Re: Trig Function Linking Problems
    ... I did get the trig functions to work on one newer system. ... trig command showed that libgnat was not being linked - for some ... explicitly link it. ... One reason may be that the libgnat-3.4.so.1 was not there - but ...
    (comp.lang.ada)
  • Re: reciprocal vs inverse of trig functions
    ... with trig functions, obviously this doesn't work. ... what is the reason for that? ... sin is sin^-1? ... That is, the notation is inconsistent, but its the notation we have, and I don't mind living with it. ...
    (sci.math)
  • reciprocal vs inverse of trig functions
    ... hey everyone. ... with trig functions, obviously this doesn't work. ... what is the reason for that? ... sin is sin^-1? ...
    (sci.math)
  • Re: Sawtooth formula?
    ... David W. Cantrell wrote: ... no reason to use trig functions! ...
    (sci.math)