# expression to result in -1 or 1

• Oct 1st 2011, 05:25 AM
Stuck Man
expression to result in -1 or 1
Is there an expression that results in -1 or 1 for these values of n:
1 -> -1
2 -> -1
3 -> 1
4 -> 1
5 -> -1
6 -> -1
7 -> 1
8 -> 1
9 -> -1
10 -> -1
etc.
My book has something that does not work correctly.
• Oct 1st 2011, 05:33 AM
Plato
Re: expression to result in -1 or 1
Quote:

Originally Posted by Stuck Man
Is there an expression that results in -1 or 1 for these values of n:
1 -> -1
2 -> -1
3 -> 1
4 -> 1
5 -> -1
6 -> -1
7 -> 1
8 -> 1
9 -> -1
10 -> -1
etc.
My book has something that does not work correctly.

$a_n = \left( { - 1} \right)^{\left\lfloor {\frac{{n + 1}}{2}} \right\rfloor }$ where $\left\lfloor {\frac{{n + 1}}{2}} \right\rfloor$ is the floor function (greatest integer function).
• Oct 1st 2011, 05:46 AM
chisigma
Re: expression to result in -1 or 1
Quote:

Originally Posted by Stuck Man
Is there an expression that results in -1 or 1 for these values of n:
1 -> -1
2 -> -1
3 -> 1
4 -> 1
5 -> -1
6 -> -1
7 -> 1
8 -> 1
9 -> -1
10 -> -1
etc.
My book has something that does not work correctly.

I am 'enthusiast' of circular functions so that I propose...

$a_{n}= \sqrt{2}\ \sin (1-2n)\ \frac{\pi}{4}$ (1)

Kind regards

$\chi$ $\sigma$
• Oct 1st 2011, 05:46 AM
Stuck Man
Re: expression to result in -1 or 1
Is that often featured on calculators? I don't think I've seen it before although I've heard of it in computer languages.
• Oct 1st 2011, 05:54 AM
Plato
Re: expression to result in -1 or 1
Quote:

Originally Posted by Stuck Man
Is that often featured on calculators? I don't think I've seen it before although I've heard of it in computer languages.

I know nothing about calculators, but on a CAS it is floor(x).
Look at this webpage.