General function that represents a series of 1 and 0

In summary, there is a solution for summation that gives the sequence 1,1,1,1,1,1,1,1,1,1,1,1,1,1,...
  • #1
Emilijo
36
0
How can I get a general function that represents a series of 1 and 0, for example :
1,0,1,0,1,0,1,0...; but also
1,1,0,1,1,0,1,1,0...;
1,1,1,0,1,1,1,0,1... and so on; the first one is not difficult: a = n mod 2; where a=1 or 0; n=1,2,3...
but if n=1 than a=2 (for the first one), and 2 is not solution
That s one of the other difficulties in that problem.

So I just need a general function for an x number of 1 (1,1,1,1...1,0,1,1,1,1,...0...). Always after a certain period of number 1 comes 0
The function must be valuable for all n; as you can see in my example when I put n=1, a=2, and that isn t solution
 
Physics news on Phys.org
  • #2


well if p is a prime number, then

f(n) = np-1 mod p will work.

but if we want a function where the 0's come every six places, this approach won't work:

f(n) = n5 mod 6 gives:

(1,2,3,4,5,0,1,2,3,4,5,0,...)
 
  • #3


I want a general formula for all terms, including a function where the 0 s come every six places, and if its possible without primes.
The function must be strictly given for ALL TERMS and proven
 
Last edited:
  • #4


What's wrong with divides? (Or not divides in this case.)
 
  • #5


Can you give an example including that function f(n) = np-1 mod p for
the series 1,1,1,0,1,1,1,0...; what is n in your case, which prime I have to put instead p... Explain this function.
 
Last edited:
  • #6


Let w be a primitive m+1'th root of unity, say [itex]w = e^{i\frac{2\pi}{m+1}}[/itex].

Look at [tex]x_n = \frac{1+w^n+w^{2n}+...+w^{mn}}{m+1}.[/tex]

We will have that [itex]x_0 = 1, x_1 = x_2 = ... = x_m = 0[/itex]. And then it repeats itself.

If we take [itex]y_n = 1-x_{n+1}[/itex] we will get the series [itex]y_1,y_2,... = 1,1,...,1,0,1,,1,...,1...[/itex] where there are m 1's for each repeat.

The reason for this is that for each n [itex]w^n[/itex] is a k'th root of unity for some divisor k of m+1. k = 1 only when n is a multiple of m+1, i.e. n=0,m+1,2(m+1),... and so on. For these n [itex]x_n[/itex] will of course be 1.

When n is not a multiple of m+1, then k will not be equal to 1, and [itex]1+w^n + (w^n)^2 +...+(w^n)^{k-1} = 0[/itex]. So the series [itex]1+w^n+w^{2n}+...+w^{mn} = (1+w^n + (w^n)^2 + ... + (w^n)^{k-1}) + (w^n)^k(1+w^n + (w^n)^2 + ... + (w^n)^{k-1}) + ... + (w^n)^{k(\frac{m+1}{k})-1)}(1+w^n + (w^n)^2 + ... + (w^n)^{k-1}) = 0[/itex], and thus [itex]x_n = 0[/itex]. Note that for prime m+1, k will be equal to m+1 for all n except multiples of m+1.

For your first example we will get [itex]y_n = 1-\frac{1+(-1)^{n+1}}{2} = \frac{1-(-1)^{n+1}}{2}[/itex], as -1 is a primitive 2nd root of unity.

Generally [tex]y_n = \frac{m-(w^{n+1}+w^{2(n+1)}+...+w^{m(n+1)})}{m+1},[/tex] or [tex]\frac{m-(e^{i\frac{2\pi(n+1)}{m+1}}+e^{i\frac{2\pi 2(n+1)}{m+1}}+...+e^{i\frac{2\pi m(n+1)}{m+1}})}{m+1}.[/tex]
 
Last edited:
  • #7


I'll repeat, what's wrong with "divides"? The sequence {a divides n} for a given a and n comprising the positive integers is the opposite of what you want. Take the logical negation and voila! there is your set of sequences.

By the way, you have a missing sequence, the trivial sequence, in your set of sequences. It is the sequence 0,0,0,... So let's start with this in terms of "divides". 1 divides every positive integer, so the sequence given by {dn;1} where dn;1 is 1 divides n is the sequence of all ones (or all true). The logical negation of this sequence yields the trivial series 0,0,0,... .

Now look at using 2 as the divisor. 2 does not divide 1, it divides 2, it does not divide 3, and so on. Thus {dn;2} = {2 divides n} yields 0,1,0,1,... . The logical negation of this sequence yields 1,0,1,0,... : your first example.

Now look at using 3 the divisor. 3 divides n results in the sequence 0,0,1,0,0,1,... . The logical negation yields 1,1,0,1,1,0 : your second example. Doing the same with 4 yields 1,1,1,0,1,1,1,0,...

Divides (or does not divide) is exactly what you want here.
 
  • #8


D H is right. And to add to that, if you want complex sequences (repeating pulse train rather than a simple rectangular wave) then just Boolean-OR multiple divide terms.
 
  • #9


D H's solution is perfectly fine, it's more or less the definition of the sequences in question.
 
  • #10


disregardthat s function is fine but what if there is a huge number of 1
1,1,1,1,1,1,1,1,1,1,1,1,1,...,1,0,1,...; than there is a lot of calculating;
does exist a summation of
∑_(k=1, to m) e^((2iπk(n+1))/(m+1))
 
  • #11


streber said:
disregardthat s function is fine but what if there is a huge number of 1
1,1,1,1,1,1,1,1,1,1,1,1,1,...,1,0,1,...; than there is a lot of calculating;
does exist a summation of
∑_(k=1, to m) e^((2iπk(n+1))/(m+1))

Well, you don't have to do it manually. You already know what the number is anyway.
 
  • #12


Yes, but I need that function for sth else and I have to get a general function
Is there exists a solution of summation that gave streber?
 
  • #13


Oh, and I can t understand deveno s function; can u explain me
f(n) = n^(p-1) mod p; what if I had a composite number?
 
  • #14


I tried to solve the summation by wolfram alpha, but the program doesn t give me a solution. Have you another function but with mod function or sth else, as if H D s function, but his function works just for primes.
 
  • #15


Emilijo said:
Yes, but I need that function for sth else and I have to get a general function

Sorry this doesn't make sense.

When you say
1,1,1,1,...,1,0,1,1,...
you need to know beforehand where that first 0 is. Otherwise you can't write down the problem. As soon as you fix where that first 0 is, D H's formula gives the answer immediately.

So if your problem is "first zero is at 105" then "negation of 105 divides x" is the answer.
Similarly if "first zero is at m" then "negation of m divides x" is the answer.
 
  • #16


[itex]1-\left\lfloor\frac{n}{6}\right\rfloor + \left\lfloor\frac{n-1}{6}\right\rfloor[/itex]
 
  • #17


Xitami, n = 13.

Edit: Scratch that. I mucked my calculations.
 
Last edited:
  • #18


Exactly pwsnafu. To properly define your sequences you already have the means to calculate each term.

The solution n (mod 2) to the sequence 1,0,1,0,... is more or less a repetition of the definition itself. I thought you wanted an algebraic solution to the sequences.
 
  • #19


Just suggestion, and I have only completed high-level maths at a high-school standard so far, so I apologize if I get this messed up, but...
Pehaps a sine function of another sine function with a different, complicated period formed by a polynomial? This could be adjusted so that on the integers 1, 2, 3, 4, etc. give the resulting values 1, 1, 0, 1, etc.
I'm unsure as to how to how to prove this, but it makes sense (I think).
 
  • #20


Kael42 said:
Just suggestion, and I have only completed high-level maths at a high-school standard so far, so I apologize if I get this messed up, but...
Pehaps a sine function of another sine function with a different, complicated period formed by a polynomial? This could be adjusted so that on the integers 1, 2, 3, 4, etc. give the resulting values 1, 1, 0, 1, etc.
I'm unsure as to how to how to prove this, but it makes sense (I think).

Good idea with trigonometric functions, what about this: [tex]x_n = \lceil \sin(\frac{2 \pi n}{m+1}) \rceil[/tex]?

x_n from for n from 1 to m will be 1, x_(m+1) will be 0, and so the sequence repeats.

The problem with polynomials of higher degree is that they cannot be periodic, so I think it would be hard to accomplish that which you describe.
 
  • #21


disregardthat said:
The problem with polynomials of higher degree is that they cannot be periodic, so I think it would be hard to accomplish that which you describe.

Actually that would work. We know that
[itex]f(x) = \sin(2 \pi x / L)[/itex]
has period L, so in our example L=6.

Then all we need to do is find the Newton polynomial solving
[itex]f(0) \mapsto 0[/itex]
[itex]f(1) \mapsto 1[/itex]
[itex]f(2) \mapsto 1[/itex]
and so on. Call this p(y).

Then [itex]p \circ f (x)[/itex] gives what we want.
 
  • #22


That's right, I was thinking about sin(p(2*pi x/L)), but p(sin(2*pi x/L)) is what Kael wanted. Good thinking.
 
Last edited:
  • #23


I`d like something as disregardhat´s formula. Without ceiling or floor function...
Is the disregardhat´s formula correct?
If m=5 and n=7 (0,1,1,1,1,1,0), then y must be 0, but the formula gives y=1.
(In your formula, m is number of 1 and n is which number(1.,2.,3.,...). It is correct?
 
Last edited:
  • #24


DISREGARDTHAT:
You have posted a function for my problem: If I have a certain period of 1 (0,1,1,1,1,0,1,1,1,1,0), how to get a general function for f(n)? You have got a solution:
y= (m-(∑_(k=1, to m) e^((2iπk(n+1))/(m+1))))/(m+1)

I suppose that m represents a number of 1 (0,1,1,1,0,1,1,1,0: m=3), and n represents which number (for n=4, y=1; for n=5, y=0, for n=6, y=0...).
Well, If m=5, n=7 (0,1,1,1,1,1,0,), y must be 0, but the formula gives that y=1; It is formula wrong or I have not understand the meaning of m and n. If the formula is wrong, can you give an other function, but the principle must be analogic to the past function. (Without floor, ceiling, or mod function...)
Reply as soon as possible.
 
  • #25


DISREGARDTHAT:

Put n=4, m=4 in your first formula for X_n.
The formula gives wrong solution.
 
  • #26


I have already told you that my function gives the sequence (1,1,1...,1,0,1,...) and not (0,1,...,1,0,...).

If you want the latter, shift it by 1, i.e. define a new sequence Y_n = y_(n-1), where y_n is the previously define sequence.
 
  • #27


Disregardthats formula:
X_n = (w^(0n)+w^(1n)+w^(2n)+...+w^(mn))/(m+1) ; w=e^(2 i pi/(m+1))
Confusing is this summation: w^(0n)+w^(1n)+w^(2n)+...+w^(mn)
I need that summation reduced. I.e. for 1+2+3+...+k=(1+k)(k/2).
But for disergardthats summation, what is the reduced summation?

I put it in wolfram alpha as X_n = (sum_(k=0,to m) (e^(2 i pi/(m+1)))^(k*n))/(m+1)
Wolfram calculated: X_n = (-1+e^(2 i n pi))/((-1+e^((2 i n pi)/(1+m))) (1+m))
The problem is: -1+e^(2 i n pi) = 0 (for n = 0,1,2...), so the result should be always 0,
and that is not correct (for n=0, x_n=1; for n=1,2,3...,m, x_n = 0)
What is the problem?
Can anybody write down a general, reduced form of this summation(function))?
 
Last edited:
  • #28


First of all, you are reading it wrong. I define y_n to be the formula, x_n was merely preliminary. Please, read my entire post before asking questions (you made this mistake several times even after I pointed it out to you).

Anyway, the summation you need is:

x_n = sum e^(2 (i*pi*k*(n+1))/(m+1)) k=1..m

And then take y_n = (m-x_n)/(m+1).

The result of x_n from wolfram is

-(-e^(2 i n pi)+e^((2 i (1+n) pi)/(1+m)))/(-1+e^((2 i (1+n) pi)/(1+m)))

As you can see this expression is -1 unless n is a multiple of m. Hence y_n = 1 unless n is a multiple of m. When n is a multiple of m you get into trouble. The formula becomse a 0/0 expression.

However, taking the limit as n approaches m*k (a multiple of m) yields m, and hence the limit of y_n as n approaches m*k is 0. This will be the correct value, as y_n is in fact a continuous function of n for real values n.
 
  • #29


Hence, if I get -1, that is OK. But if I get 0/0, then I have to put limit.
Well, I should not do that because it seems like an algorithm
(If x=-1, then ..., if x=0/0, then...)
I should get a function where I just put m and n and I get -1 (or 1) or 0, wihout
my intervention later. Can you do that?
 

1. What is a general function that represents a series of 1 and 0?

A general function that represents a series of 1 and 0 is a mathematical expression that maps a set of input values to corresponding output values of either 1 or 0.

2. What is the purpose of using a series of 1 and 0 in a general function?

The series of 1 and 0 is often used to represent binary data, where 1 represents "on" or "true" and 0 represents "off" or "false". This is useful in computer programming and data storage.

3. Can a general function with a series of 1 and 0 have multiple outputs?

Yes, a general function with a series of 1 and 0 can have multiple outputs. For example, a binary decoder function can take in a binary number and output multiple digits based on its input.

4. How is a series of 1 and 0 used in Boolean logic?

In Boolean logic, a series of 1 and 0 is used to represent the logical values of true and false. This is important in logic gates and digital circuits, where a series of 1s and 0s can determine the output based on the input.

5. Is there a specific notation used for a general function with a series of 1 and 0?

Yes, the most common notation used for a general function with a series of 1 and 0 is the binary notation, where the function is written in the form of a binary number. For example, a function with four inputs and two outputs can be represented as 4 inputs and 2 outputs can be represented as (0101) = (01).

Similar threads

  • Linear and Abstract Algebra
Replies
2
Views
918
  • Topology and Analysis
Replies
9
Views
1K
  • Linear and Abstract Algebra
Replies
15
Views
4K
  • Linear and Abstract Algebra
Replies
1
Views
463
  • Calculus and Beyond Homework Help
Replies
3
Views
358
  • Linear and Abstract Algebra
Replies
1
Views
863
Replies
2
Views
691
  • Calculus and Beyond Homework Help
Replies
1
Views
664
  • Linear and Abstract Algebra
Replies
1
Views
584
  • Calculus and Beyond Homework Help
Replies
3
Views
166
Back
Top