Constructing a 2-periodic extension of the absolute value function using floor and ceiling functions
up vote
0
down vote
favorite
I am trying to use floor and ceiling functions to construct a 2-periodic extension of the function $f(x) = |x|, -1 leq x leq 1$.
Through trial an error I have been able to show that:
$f(x) = 1 - bigg( lfloor x rfloor - 2 lfloor frac{lfloor x rfloor}{2} rfloor)(x - lfloor x rfloor) + (lfloor x-1 rfloor - 2lfloor{frac{lfloor x-1 rfloor}{2}}rfloor)(lceil x-1 rceil -(x-1)bigg)$
However, this formula does not work when $x$ is an even integer since it gives 1 instead of 0.
Is there an easier way to do this?
floor-function ceiling-function
add a comment |
up vote
0
down vote
favorite
I am trying to use floor and ceiling functions to construct a 2-periodic extension of the function $f(x) = |x|, -1 leq x leq 1$.
Through trial an error I have been able to show that:
$f(x) = 1 - bigg( lfloor x rfloor - 2 lfloor frac{lfloor x rfloor}{2} rfloor)(x - lfloor x rfloor) + (lfloor x-1 rfloor - 2lfloor{frac{lfloor x-1 rfloor}{2}}rfloor)(lceil x-1 rceil -(x-1)bigg)$
However, this formula does not work when $x$ is an even integer since it gives 1 instead of 0.
Is there an easier way to do this?
floor-function ceiling-function
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to use floor and ceiling functions to construct a 2-periodic extension of the function $f(x) = |x|, -1 leq x leq 1$.
Through trial an error I have been able to show that:
$f(x) = 1 - bigg( lfloor x rfloor - 2 lfloor frac{lfloor x rfloor}{2} rfloor)(x - lfloor x rfloor) + (lfloor x-1 rfloor - 2lfloor{frac{lfloor x-1 rfloor}{2}}rfloor)(lceil x-1 rceil -(x-1)bigg)$
However, this formula does not work when $x$ is an even integer since it gives 1 instead of 0.
Is there an easier way to do this?
floor-function ceiling-function
I am trying to use floor and ceiling functions to construct a 2-periodic extension of the function $f(x) = |x|, -1 leq x leq 1$.
Through trial an error I have been able to show that:
$f(x) = 1 - bigg( lfloor x rfloor - 2 lfloor frac{lfloor x rfloor}{2} rfloor)(x - lfloor x rfloor) + (lfloor x-1 rfloor - 2lfloor{frac{lfloor x-1 rfloor}{2}}rfloor)(lceil x-1 rceil -(x-1)bigg)$
However, this formula does not work when $x$ is an even integer since it gives 1 instead of 0.
Is there an easier way to do this?
floor-function ceiling-function
floor-function ceiling-function
asked 16 hours ago
1123581321
10017
10017
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
If you can also use trigonometric functions, then there are several ways to do it.
If we can construct a graph like the following, which I will call $r(x)$ then $f(x)=r(x)+r(-x)$ will almost be what you want depending whether or not $f(2k)=1$ and $f(2k+1)=0$ for all integers $k$.
First, let us create a periodic "cutting" function
$$ c(x)=lfloor1+sinpi xrfloor $$
Now look at the graph of
$$ g(x)=lceil xrceil-x $$
If we multiply $g(x)$ and $c(x)$ we will get a function whose graph looks like the first graph above. So we define
begin{eqnarray}
r(x)&=&g(x)c(x)\
&=&(lceil xrceil-x)lfloor1+sinpi xrfloor
end{eqnarray}
And let
begin{eqnarray}
f_0(x)&=&r(x)+r(-x)\
&=&(lceil xrceil-x)lfloor1+sinpi xrfloor+(lceil -xrceil+x)lfloor1-sinpi xrfloor
end{eqnarray}
This function has the following graph
This is almost what we want, but we need to correct the missing points by adding a function which equals one for all even integers and equals zero elsewhere. A function such as
$$ c(x)=leftlfloorfrac{1+cospi x}{2}rightrfloor $$
So we define
$$ f(x)=(lceil xrceil-x)lfloor1+sinpi xrfloor+(lceil -xrceil+x)lfloor1-sinpi xrfloor+leftlfloorfrac{1+cospi x}{2}rightrfloor $$
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
If you can also use trigonometric functions, then there are several ways to do it.
If we can construct a graph like the following, which I will call $r(x)$ then $f(x)=r(x)+r(-x)$ will almost be what you want depending whether or not $f(2k)=1$ and $f(2k+1)=0$ for all integers $k$.
First, let us create a periodic "cutting" function
$$ c(x)=lfloor1+sinpi xrfloor $$
Now look at the graph of
$$ g(x)=lceil xrceil-x $$
If we multiply $g(x)$ and $c(x)$ we will get a function whose graph looks like the first graph above. So we define
begin{eqnarray}
r(x)&=&g(x)c(x)\
&=&(lceil xrceil-x)lfloor1+sinpi xrfloor
end{eqnarray}
And let
begin{eqnarray}
f_0(x)&=&r(x)+r(-x)\
&=&(lceil xrceil-x)lfloor1+sinpi xrfloor+(lceil -xrceil+x)lfloor1-sinpi xrfloor
end{eqnarray}
This function has the following graph
This is almost what we want, but we need to correct the missing points by adding a function which equals one for all even integers and equals zero elsewhere. A function such as
$$ c(x)=leftlfloorfrac{1+cospi x}{2}rightrfloor $$
So we define
$$ f(x)=(lceil xrceil-x)lfloor1+sinpi xrfloor+(lceil -xrceil+x)lfloor1-sinpi xrfloor+leftlfloorfrac{1+cospi x}{2}rightrfloor $$
add a comment |
up vote
0
down vote
If you can also use trigonometric functions, then there are several ways to do it.
If we can construct a graph like the following, which I will call $r(x)$ then $f(x)=r(x)+r(-x)$ will almost be what you want depending whether or not $f(2k)=1$ and $f(2k+1)=0$ for all integers $k$.
First, let us create a periodic "cutting" function
$$ c(x)=lfloor1+sinpi xrfloor $$
Now look at the graph of
$$ g(x)=lceil xrceil-x $$
If we multiply $g(x)$ and $c(x)$ we will get a function whose graph looks like the first graph above. So we define
begin{eqnarray}
r(x)&=&g(x)c(x)\
&=&(lceil xrceil-x)lfloor1+sinpi xrfloor
end{eqnarray}
And let
begin{eqnarray}
f_0(x)&=&r(x)+r(-x)\
&=&(lceil xrceil-x)lfloor1+sinpi xrfloor+(lceil -xrceil+x)lfloor1-sinpi xrfloor
end{eqnarray}
This function has the following graph
This is almost what we want, but we need to correct the missing points by adding a function which equals one for all even integers and equals zero elsewhere. A function such as
$$ c(x)=leftlfloorfrac{1+cospi x}{2}rightrfloor $$
So we define
$$ f(x)=(lceil xrceil-x)lfloor1+sinpi xrfloor+(lceil -xrceil+x)lfloor1-sinpi xrfloor+leftlfloorfrac{1+cospi x}{2}rightrfloor $$
add a comment |
up vote
0
down vote
up vote
0
down vote
If you can also use trigonometric functions, then there are several ways to do it.
If we can construct a graph like the following, which I will call $r(x)$ then $f(x)=r(x)+r(-x)$ will almost be what you want depending whether or not $f(2k)=1$ and $f(2k+1)=0$ for all integers $k$.
First, let us create a periodic "cutting" function
$$ c(x)=lfloor1+sinpi xrfloor $$
Now look at the graph of
$$ g(x)=lceil xrceil-x $$
If we multiply $g(x)$ and $c(x)$ we will get a function whose graph looks like the first graph above. So we define
begin{eqnarray}
r(x)&=&g(x)c(x)\
&=&(lceil xrceil-x)lfloor1+sinpi xrfloor
end{eqnarray}
And let
begin{eqnarray}
f_0(x)&=&r(x)+r(-x)\
&=&(lceil xrceil-x)lfloor1+sinpi xrfloor+(lceil -xrceil+x)lfloor1-sinpi xrfloor
end{eqnarray}
This function has the following graph
This is almost what we want, but we need to correct the missing points by adding a function which equals one for all even integers and equals zero elsewhere. A function such as
$$ c(x)=leftlfloorfrac{1+cospi x}{2}rightrfloor $$
So we define
$$ f(x)=(lceil xrceil-x)lfloor1+sinpi xrfloor+(lceil -xrceil+x)lfloor1-sinpi xrfloor+leftlfloorfrac{1+cospi x}{2}rightrfloor $$
If you can also use trigonometric functions, then there are several ways to do it.
If we can construct a graph like the following, which I will call $r(x)$ then $f(x)=r(x)+r(-x)$ will almost be what you want depending whether or not $f(2k)=1$ and $f(2k+1)=0$ for all integers $k$.
First, let us create a periodic "cutting" function
$$ c(x)=lfloor1+sinpi xrfloor $$
Now look at the graph of
$$ g(x)=lceil xrceil-x $$
If we multiply $g(x)$ and $c(x)$ we will get a function whose graph looks like the first graph above. So we define
begin{eqnarray}
r(x)&=&g(x)c(x)\
&=&(lceil xrceil-x)lfloor1+sinpi xrfloor
end{eqnarray}
And let
begin{eqnarray}
f_0(x)&=&r(x)+r(-x)\
&=&(lceil xrceil-x)lfloor1+sinpi xrfloor+(lceil -xrceil+x)lfloor1-sinpi xrfloor
end{eqnarray}
This function has the following graph
This is almost what we want, but we need to correct the missing points by adding a function which equals one for all even integers and equals zero elsewhere. A function such as
$$ c(x)=leftlfloorfrac{1+cospi x}{2}rightrfloor $$
So we define
$$ f(x)=(lceil xrceil-x)lfloor1+sinpi xrfloor+(lceil -xrceil+x)lfloor1-sinpi xrfloor+leftlfloorfrac{1+cospi x}{2}rightrfloor $$
answered 4 hours ago
John Wayland Bales
13.7k21137
13.7k21137
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2995900%2fconstructing-a-2-periodic-extension-of-the-absolute-value-function-using-floor-a%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password