Expression that alternates between 0 and 1?

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

User avatar
Rippy
Posts: 2101
Joined: Sun Jul 22, 2007 11:27 pm UTC
Location: Ontario, Can o' Duh

Expression that alternates between 0 and 1?

Postby Rippy » Tue Oct 06, 2009 8:03 pm UTC

We have to find a closed form equation for a sum in my algebra assignment. I found something that is so friggin' close: It is perfect except that you need to add 1 for odd values of n. The TA hinted that for one question you might have to split it into even and odd cases, and that's what I did, and that's how I'll hand it in since it's due tomorrow. But I'm still curious as to whether there's any way of making it work algebraically, sort of like how you can apply [math](-1)^n[/math] to make a sequence alternate sign for example.

I can post the full question if anyone's curious and wants to have a go at it, it was kind of fun to work out although not too difficult (minus the half hour I spent trying to get it to work before I found out you were allowed to split up the cases...)

User avatar
rat4000
r/ratsgonewild
Posts: 451
Joined: Mon Feb 09, 2009 7:51 pm UTC

Re: Expression that alternates between 0 and 1?

Postby rat4000 » Tue Oct 06, 2009 8:10 pm UTC

(-1)^n + n modulo 2?

It is basically what you did, true, but it doesn't involve splitting cases...

User avatar
antonfire
Posts: 1772
Joined: Thu Apr 05, 2007 7:31 pm UTC

Re: Expression that alternates between 0 and 1?

Postby antonfire » Tue Oct 06, 2009 8:17 pm UTC

You have an expression which alternates between -1 and 1. Find a function which takes -1 to 0 and 1 to 1.
Jerry Bona wrote:The Axiom of Choice is obviously true; the Well Ordering Principle is obviously false; and who can tell about Zorn's Lemma?

stephentyrone
Posts: 778
Joined: Mon Aug 11, 2008 10:58 pm UTC
Location: Palo Alto, CA

Re: Expression that alternates between 0 and 1?

Postby stephentyrone » Tue Oct 06, 2009 8:36 pm UTC

antonfire wrote:You have an expression which alternates between -1 and 1. Find a function which takes -1 to 0 and 1 to 1.


Very much this. There's absolutely no need for splitting cases.
GENERATION -16 + 31i: The first time you see this, copy it into your sig on any forum. Square it, and then add i to the generation.

User avatar
Rippy
Posts: 2101
Joined: Sun Jul 22, 2007 11:27 pm UTC
Location: Ontario, Can o' Duh

Re: Expression that alternates between 0 and 1?

Postby Rippy » Tue Oct 06, 2009 9:33 pm UTC

That would be the Heaviside function, unless there's something similar that I'm unaware of. Heaviside works, but it has cases within it, so technically it's not all that different. Is there some other function I'm not thinking of?

User avatar
Macbi
Posts: 941
Joined: Mon Apr 09, 2007 8:32 am UTC
Location: UKvia

Re: Expression that alternates between 0 and 1?

Postby Macbi » Tue Oct 06, 2009 9:36 pm UTC

No, all you need is a function (any function at all!) such that f(-1)=0 and f(1)=1

There are several simple functions that do this.
    Indigo is a lie.
    Which idiot decided that websites can't go within 4cm of the edge of the screen?
    There should be a null word, for the question "Is anybody there?" and to see if microphones are on.

stephentyrone
Posts: 778
Joined: Mon Aug 11, 2008 10:58 pm UTC
Location: Palo Alto, CA

Re: Expression that alternates between 0 and 1?

Postby stephentyrone » Tue Oct 06, 2009 10:52 pm UTC

Hint: plot the points (-1,0) and (1,1). You're looking for a function that passes through both of them. [imath]f(x) = \frac14(x+1)^2[/imath] is one such function; can you think of a simpler one?
GENERATION -16 + 31i: The first time you see this, copy it into your sig on any forum. Square it, and then add i to the generation.

d0nk3y_k0n9
Posts: 97
Joined: Sun May 03, 2009 4:27 pm UTC

Re: Expression that alternates between 0 and 1?

Postby d0nk3y_k0n9 » Tue Oct 06, 2009 11:07 pm UTC

I can think of a really, really simple way to change what you've got into what you want, but I'm not sure if you want us to just give you the answer. The hints people have posted above should lead you to it anyway, so I'm going to put what my answer would be into spoilers.

Spoiler:
[math]\frac{(-1)^n+1}{2}[/math]

User avatar
Macbi
Posts: 941
Joined: Mon Apr 09, 2007 8:32 am UTC
Location: UKvia

Re: Expression that alternates between 0 and 1?

Postby Macbi » Wed Oct 07, 2009 6:23 am UTC

Of course it might be nicer to use a continuous periodic function like sin(x)
    Indigo is a lie.
    Which idiot decided that websites can't go within 4cm of the edge of the screen?
    There should be a null word, for the question "Is anybody there?" and to see if microphones are on.

mr-mitch
Posts: 477
Joined: Sun Jul 05, 2009 6:56 pm UTC

Re: Expression that alternates between 0 and 1?

Postby mr-mitch » Wed Oct 07, 2009 7:01 am UTC

Quite simple.

Spoiler:
[math]\frac{(-1)^n+1}{2}[/math]is 0 for odd n and 1 for even n You could also take one and divide by -2 for the opposite odd/even n's...which is the same as n mod 2, or for the first one, (n+1) mod 2

Bobobo
Posts: 11
Joined: Sun Aug 31, 2008 2:37 am UTC
Location: Melbourne

Re: Expression that alternates between 0 and 1?

Postby Bobobo » Wed Oct 07, 2009 12:59 pm UTC

i'm curious, what was the question?

User avatar
Rippy
Posts: 2101
Joined: Sun Jul 22, 2007 11:27 pm UTC
Location: Ontario, Can o' Duh

Re: Expression that alternates between 0 and 1?

Postby Rippy » Thu Oct 15, 2009 3:01 pm UTC

mr-mitch wrote:Quite simple.

Spoiler:
[math]\frac{(-1)^n+1}{2}[/math]is 0 for odd n and 1 for even n You could also take one and divide by -2 for the opposite odd/even n's...which is the same as n mod 2, or for the first one, (n+1) mod 2

This is was what I was trying to figure out, and what I'm guessing most people were trying to point me towards. Someone else had found it and I was quite frustrated to have not thought of it. I'm pretty sure it just overcomplicates the question, but hey, maybe someone can make it work.

Here's the question: it was a graded assignment so I didn't want to be too specific at the time:

Find a closed form formula for [math]\sum^n_{i=1}(−1)^i(2i − 1)^2[/math] for n ≥ 1

If anyone can find a single closed-form equation for that sum and prove its validity, I would be very interested to see it. It's pretty straightforward to prove for two equations (by showing the odd case produces the even for n+1, and vice-versa), which is what I settled for, but I'm sure it's possible with a single equation.

User avatar
Macbi
Posts: 941
Joined: Mon Apr 09, 2007 8:32 am UTC
Location: UKvia

Re: Expression that alternates between 0 and 1?

Postby Macbi » Thu Oct 15, 2009 3:53 pm UTC

Nicest I can get it:
Spoiler:
[math]\frac{(4n^2-1)(-1)^n+1}{2}[/math]
or even:
[math]\frac{(4n^2-1)cos(\pi n)+1}{2}[/math]
or,
[math]\frac{(2n+1)(2n-1)cos(\pi n)+1}{2}[/math]
    Indigo is a lie.
    Which idiot decided that websites can't go within 4cm of the edge of the screen?
    There should be a null word, for the question "Is anybody there?" and to see if microphones are on.

User avatar
BlackSails
Posts: 5315
Joined: Thu Dec 20, 2007 5:48 am UTC

Re: Expression that alternates between 0 and 1?

Postby BlackSails » Fri Oct 16, 2009 12:52 am UTC

Rippy wrote:
If anyone can find a single closed-form equation for that sum and prove its validity, I would be very interested to see it. It's pretty straightforward to prove for two equations (by showing the odd case produces the even for n+1, and vice-versa), which is what I settled for, but I'm sure it's possible with a single equation.


fixed link

It looks like some sort of growing sine function. -n*sin(n), e^n*sin(n), something like that


Return to “Mathematics”

Who is online

Users browsing this forum: No registered users and 13 guests