Where the "center" value is 0, for example the sequence: 16,9,4,1,0,2,6,12,20
Is there an equation such that the right side follows n^2+n, and the left side follows n^2?
-
1"Is there an **equation**" what do you mean by "equation" here... – 2017-01-15
-
0Well, $f(x) = x^2$ if $x \le 0;$ $f(x) = x^2 + x$ if $x > 0$ will do it. Get it out of your head that math is about finding single one line "rules" to define things. If it takes pages and pages to define something precisely, as long as the final expression is well-defined, clear and unambiguous it is fine. – 2017-01-15
-
0If you are asking if there is a single polynomial ($p(x) = \sum_{i=0}^n a_i x^i = a_nx^n + a_{n-1}x^{n-1} + .... + a_1x+ a_0$) that would give those exact results, the answer is no. But "function" does not mean "polynomial". A polynomial is only type of function. There are uncountably infinite other types of functions. – 2017-01-15
-
0You should also make sure you're entire question can be answered by only looking at the body of you're question rather than having to refer to the title. – 2017-01-15
2 Answers
I don't know what kind of expression you're after, but how about $$ n^2+n\left(\frac 12 + \frac{|n|}{2n}\right) $$ which should give you what you're after for positive and negative $n$. The only problem is for $n = 0$, where this doesn't give $0$, but is undefined.
-
0Why not $n^2 + n(1/2 + |-n + 1/2| - |-n|)$ ? – 2017-01-15
-
0@fleablood I'm way too tired to check whether that works, but it looks promising. – 2017-01-15
Here's one.
$f(n) = \max(n^2, n^2 + n)$ for $n \in \mathbb Z$.
To play on Arthurs clever answer...
we want $f(n) = n^2 + n*k$ where $k = 0$ if $n\ge 0$ and $k = 1$ if $n \le 0$.
How can we find such a $k$?
Well for a positive $|n + 1| = |n| + 1$ if $n \ge 0$ and $|n + 1|=|-|n| + 1| = |n| -1$ if $n < 0$.
So $|n+1| - |n| = 1$ if $n \ge 0$ and equals $-1$ if $n < 0$ so
$|n + 1/2| - |n| + 1/2 = 1$ if $n \ge 0$ and equals $-1$ if $n < 0$ so
$|(-n) + 1/2| - |(-n)| + 1/2 = 0$ if $n \ge 0$ and equals $-1$ if $n < 0$ so we can use $k = -(|(-n) + 1/2| - |(-n)| + 1/2)$.
So $f(n) = n^2 - n*(|(-n) + 1/2| - |(-n)| + 1/2)$ will it it for you.
-
0Well, you are answering the idea of a single expression whereas "max" has an implicit "if/then" clause. Although absolute value also has an implicit but subtley hidden "if/than" clause as well.... – 2017-01-15