Results 1 to 12 of 12
Like Tree1Thanks
  • 1 Post By mfb

Math Help - functionfinding

  1. #1
    Newbie
    Joined
    Jun 2012
    From
    Croatia
    Posts
    15

    functionfinding

    How to find function that have values:
    f(0)=0, f(1)=0, f(2)=0, f(3)=0,... for period T=1
    f(0)=0, f(1)=1, f(2)=0, f(3)=1,... for period T=2
    f(0)=0, f(1)=1, f(2)=1, f(3)=0, f(4)=1, f(5)=1, f(6)=0,... for period T=3
    f(0)=0, f(1)=1, f(2)=1, f(3)=1, f(4)=0, f(5)=1, f(6)=1, f(7)=1, f(8)=0,... for T=4
    f(0)=0, f(1)=1, f(2)=1,..., f(n-1)=1, f(n)=0, f(n+1)=1,...,f(2n)=0,f(2n+1)=1,... T=n

    or shortly:
    0000000000000 T=1
    0101010101010 T=2
    0110110110110 T=3
    0111011101110 T=4
    ...

    So, I need general function in two variables f(n,T)
    The function must NOT have MOD, CEILING or FLOOR function.

    Please, give me an example for T = 3 or T = 4.
    Thanks
    Follow Math Help Forum on Facebook and Google+

  2. #2
    mfb
    mfb is offline
    Junior Member
    Joined
    Jun 2012
    From
    Germany
    Posts
    72
    Thanks
    5

    Re: functionfinding

    What about a combination cos(\frac{2\pi n x}{T}) (n=0...[T/2])?
    Basically the result of a fourier transformation, using the symmetry to get rid of the sin expressions.

    In the T=3 case:
    2/3-2/3cos(2pi x/3) goes 0110110...

    In the T=4 case:
    cos(0) goes 1, 1, 1, 1, 1,...
    cos(2pi x/4) goes 1, 0, -1, 0, 1, ...
    cos(4pi x/4) goes 1, -1, 1, -1, 1, ...

    This gives you three interesting equations, using a0 to a2 as coefficients:

    a0+a1+a2=0 (for f(0)=0)
    a0-a2=1 (for f(1)=1)
    a0-a1+a2=1 (for f(2)=1)

    This is solved by a=3/4, b=-1/2, c=-1/4

    Task for you: Check that 3/4 cos(0) - 1/2 cos(pi x/2) - 1/4 cos(pi x) is a solution.
    And perform a fourier transformation for the general formula.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jun 2012
    From
    Croatia
    Posts
    15

    Re: functionfinding

    Quote Originally Posted by mfb View Post
    What about a combination cos(\frac{2\pi n x}{T}) (n=0...[T/2])?
    Basically the result of a fourier transformation, using the symmetry to get rid of the sin expressions.

    In the T=3 case:
    2/3-2/3cos(2pi x/3) goes 0110110...

    In the T=4 case:
    cos(0) goes 1, 1, 1, 1, 1,...
    cos(2pi x/4) goes 1, 0, -1, 0, 1, ...
    cos(4pi x/4) goes 1, -1, 1, -1, 1, ...

    This gives you three interesting equations, using a0 to a2 as coefficients:

    a0+a1+a2=0 (for f(0)=0)
    a0-a2=1 (for f(1)=1)
    a0-a1+a2=1 (for f(2)=1)

    This is solved by a=3/4, b=-1/2, c=-1/4

    Task for you: Check that 3/4 cos(0) - 1/2 cos(pi x/2) - 1/4 cos(pi x) is a solution.
    And perform a fourier transformation for the general formula.

    But, is there a general function where I just put n and T, and I get solutions (1 or 0),
    without doing all these stuff for certain period?
    The formula has to be very practical so I can just put T=100 or T=1000... and n for example 379 and I get the value of the function.
    Last edited by Emilijo; June 29th 2012 at 02:14 AM.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,545
    Thanks
    780

    Re: functionfinding

    I don't have a ready answer, but may I ask why you can't use MOD, CEILING or FLOOR? Can you use piecewise-defined functions?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Jun 2012
    From
    Croatia
    Posts
    15

    Re: functionfinding

    Quote Originally Posted by emakarov View Post
    I don't have a ready answer, but may I ask why you can't use MOD, CEILING or FLOOR? Can you use piecewise-defined functions?
    I canīt use piecewise-defined functions. The problem must be solved only by elementary functions including any method (as fourier series, anything),
    but no piecewise. The reason is that function must be derivable. Piecewise are not.
    Last edited by Emilijo; June 29th 2012 at 04:21 AM.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,545
    Thanks
    780

    Re: functionfinding

    Quote Originally Posted by Emilijo View Post
    The reason is that function must be derivable. Piecewise are not.
    You can easily construct a required piecewise differentiable function from parabolas and constants.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    Jun 2012
    From
    Croatia
    Posts
    15

    Re: functionfinding

    Quote Originally Posted by emakarov View Post
    You can easily construct a required piecewise differentiable function from parabolas and constants.
    No, in some points the function will not be differentiable.
    Follow Math Help Forum on Facebook and Google+

  8. #8
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,545
    Thanks
    780

    Re: functionfinding

    What about the following function f(x) on [0, 1]?

    f(x)=\begin{cases}2x^2&0\le x\le1/2\\-2x^2+4x-1&1/2<x\le1\end{cases}
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    Jun 2012
    From
    Croatia
    Posts
    15

    Re: functionfinding

    Well, I must have general function so I can just put n and T, I need function in "one piece",
    no in 2 or more parts.
    Follow Math Help Forum on Facebook and Google+

  10. #10
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,545
    Thanks
    780

    Re: functionfinding

    Using parabolas on the sides and a constant in the middle, you can easily write a general piecewise function. In addition, this function is going to be dramatically cheaper computationally than a combination of a 1000 sines.
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Newbie
    Joined
    Jun 2012
    From
    Croatia
    Posts
    15

    Re: functionfinding

    yes, but I need a function in one piece.
    Follow Math Help Forum on Facebook and Google+

  12. #12
    mfb
    mfb is offline
    Junior Member
    Joined
    Jun 2012
    From
    Germany
    Posts
    72
    Thanks
    5

    Re: functionfinding

    Do you want a smooth function, which can be differentiated as many times as you want? Even this can be solved with piecewise-definitions:
    f(x)=1-\exp(\frac{-1}{1-x^2}) for |x-nT|<1 with any integer n, f(x)=1 otherwise.

    If you want cos-compositions, evaluate the fourier transformation. Which is your task, not mine.
    Thanks from Emilijo
    Follow Math Help Forum on Facebook and Google+

Search Tags


/mathhelpforum @mathhelpforum