Bijective numeration - how to understand it?

Converting from decimal to a bijective number system with some base. It helps me to think about it like this...

Digits in number | max numbers that can be stored (in this case base 26)
0	+1 (empty string)
1	+26
2	+26*26
3	+26*26*26
4	+26*26*26*26

You can do it without the nice equations, but a bunch of math stuff later you get...

function toBijectiveNumber(number = 0, digitSet = 'abcdefghijklmnopqrstuvwxyz')
{
	let digits = Math.floor(Math.log((digitSet.length - 1) * number + 1) / Math.log(digitSet.length));
	let offset = (Math.pow(digitSet.length, digits) - 1) / (digitSet.length - 1);
	number -= offset;

This basically subtracts all the extra numbers from previous digits and just leaves the 26*26*26*26 for a number that needs 4 digits for example. Then it's just like converting a number to another base...

	let str = '';
	for(let i = 0; i < digits; i++)
	{
		str += digitSet[number % digitSet.length];
		number = Math.floor(number / digitSet.length);
	}
	return str;
}

This works, but then I also found this piece of code, which does it much simpler, but I can't figure out why it works...

function toBijectiveNumber(number = 0, digitSet = 'abcdefghijklmnopqrstuvwxyz')
{
	let str = '';
	for(;;)
	{
		number--;
		str += digitSet[number % digitSet.length];
		if(number < digitSet.length) break;
		number = Math.floor(number / digitSet.length);
	}
	return str;
}

Why does it work? It seems like it should get a different result.

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Codec_xyz
πŸ“…︎ Dec 05 2021
🚨︎ report
injective, surjective, bijective: how would I go about proving this?

https://imgur.com/a/CAiN8Me

πŸ‘︎ 9
πŸ’¬︎
πŸ‘€︎ u/LifeEmergency
πŸ“…︎ Jun 22 2021
🚨︎ report
Oetem. A simple bijective numeral system born out of a tally system.
πŸ‘︎ 37
πŸ’¬︎
πŸ‘€︎ u/VoiceofNonsense
πŸ“…︎ Aug 21 2021
🚨︎ report
Want to map an arbitrary interval (a,b) to R where we know that (-1,1) maps to R in bijective fashion

If we construct a bijective map from (a,b) to (-1,1) then we have our answer. I did the following: let f(a) = -1 and f(b) = 1 then found a slope m = f(b) - f(a) / b - a = 2 / b - a then using the fact that f(a) = -1 we have f(x) - f(a) = (2 / b - a)(x - a) f(x) = (2 / b - a)(x - a) + f(a)

f(x) = (2 / b - a)(x - a) - 1

f is bijective from (a,b) to (-1,1) where a not equal to b. We can rule out a = b since if that were the case then (a,b) = (a,a) cannot be mapped to R.

I would like to know if this line of reasoning works

Edit: I am realizing now that with f we are mapping [a,b] onto [-1,1] from that can we still conclude that (a,b) maps to (-1,1)? Can't we just restrict the domain and consider (a,b) subset of [a,b]?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/markleal123
πŸ“…︎ Jul 08 2021
🚨︎ report
Is there a way to have a random bijective map between two integer ranges without having an array of said range?

Hi, I think it is worthwhile to give some context to this question. This is being done in Meteor/Apollo/MongoDB/React, but the question is language-agnostic.

I'm trying to create an endless feed of random user posts without repeats. This is typically done with pagination, but the issue with pagination is that it is returned in a fixed order as it appears in the database. What I am trying to achieve is random pagination.

So if I have say 100 entries in my database, my current big picture idea is that I generate a random seed on the client upon page load, and send that seed back and forth for pagination, and to have a function which takes in this seed to bijectively map to an entry in the database.

Here I will illustrate an example. Suppose my database has 1,000 queries (numbered & indexed 1 - 1000 for simplicity). Client A sends seed A along with the offset (0) and limit (10). The limit here will always be constant at 10, and the offset is the only changing value, which is the sum of all previous limits.

Now, what should happen is I obtain 10 random unique integers in the range [1,1000], based on the seed, offset, and limit. So with typical pagination, I will retrieve the data from indices 1 to 10. But now with this seed, I need to injectively map the numbers [1,10] to a random unique selection of 10 integers within the range [1,1000].

Next, I retrieve the data at those specific indices in the DB, and send it back to client A. Now, client A scrolls down and hits the trigger to load more, so now client A sends seed A along with an offset (10) and limit (10). With the offset and limit, I have the new unseeded range, [11,20]. And this should map to a random unique selection of 10 integers within the range [1,1000] but NOT map to the integers already mapped to by the first 1-10. This means that I need to have a random bijective mapping between the ranges [1,1000] and [1,1000].

This looked like it could be solved with the Fisher-Yates shuffle which would basically give me a random permutation, and then I can predictably do this with a seeded Fisher-Yates shuffle. But it's not quite the case because I wish to avoid having to generate this array of [1,1000] on every user query. The range scales based on the number of items and once this number grows large (potentially in the millions, or more), it isn't

... keep reading on reddit ➑

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Ader453
πŸ“…︎ Jun 19 2021
🚨︎ report
proof that psychology is bijective
πŸ‘︎ 170
πŸ’¬︎
πŸ‘€︎ u/CodeCrafter1
πŸ“…︎ Apr 04 2021
🚨︎ report
is the set of real numbers bijective to the imaginary numbers
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/bakkrobe
πŸ“…︎ Mar 31 2021
🚨︎ report
[undergrad discrete math] Prove that a function has an inverse if and only if it is bijective

Hi guys.. Question in title.

I get the first part:

[[[Suppose f: X -> Y has an inverse function f^-1: Y -> X,

Prove f is surjective by showing range(f) = Y:

for any y in Y, there is some x = f^-1(y) such that f(x) = y. Hence, range(f) = Y.

Prove f is injective. Suppose x_1 and x_2 such that f(x_1) = f(x_2)

Since f^-1 exists: x_1 = f^-1(f(x_1)) = f^-1(f(x_2)) = x_2. Hence it is injective.

Hence, f is both surjective and injective, so it is bijective. ]]]

I've NO CLUE how to do the second half of the proof where I suppose f: X -> Y is a bijection and to prove it has an inverse function. Bit lost... Please help!

Sorry for no LaTeX. not sure how to put it into reddit

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/Spoony_M8
πŸ“…︎ Nov 26 2020
🚨︎ report
What would decimals look like in bijective base 10 numeration?

What would decimals look like in bijective base 10 numeration? Is it possible?

Bijective numeration is any numeral system in which every non-negative integer can be represented in exactly one way using a finite string of digits. Instead of using digits 0-9, you would use digits 1-A and never use a zero.

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/realegmusic
πŸ“…︎ Feb 07 2021
🚨︎ report
Oetem, a tally numeral system turned into a base-6 bijective numeral system
πŸ‘︎ 70
πŸ’¬︎
πŸ‘€︎ u/VoiceofNonsense
πŸ“…︎ Mar 19 2020
🚨︎ report
Finding the inverse of Cantor bijective mapping function for n-tuple input.

I was wondering if there’s a formula for the inverse of Cantor bijective mapping function for n-tuple inputs, I know there’s an inverse for n=2 and that the Cantor function is invertible for any number of inputs. What do you think? Is there such an inverse function?

πŸ‘︎ 8
πŸ’¬︎
πŸ‘€︎ u/safadimiras
πŸ“…︎ Dec 20 2020
🚨︎ report
Bijective Base-10 Tug Of War

1 2 3 4 5 6 7 8 9 X 11 12 13 14 15 16 17 18 19 1X

Get is at 7X, or -7X

πŸ‘︎ 4
πŸ’¬︎
πŸ“…︎ Apr 26 2019
🚨︎ report
Let me be your Bijective Function by Amarynceus twitter.com/amarynceus/st…
πŸ‘︎ 20
πŸ’¬︎
πŸ‘€︎ u/NewWillinium
πŸ“…︎ Aug 09 2020
🚨︎ report
Does my understanding of injective, surjective and bijective seem correct to you?

let's say that f is a function witch takes elements form A = {1,2,3,4,5} to B = {a,b,c,d,e} in this way 1->a, 2->b, 3->c, 4->e, 5->d. In this case f is a bijective function.

Ok, for a function to be bijective it needs to be injective and surjective.

An injective function means that whatever values it maps from A to B, you can not map multiple values from A to a single one from B (for example: 1->a, 2->a breaks the rule for infectivity)

A surjective function needs to cover all the element form B, so if A = {1,2,3,4,5} to B = {a,b,c,d,e,f} in and 1->a, 2->b, 3->c, 4->e, 5->d, f in not surjective because it doesn't map anything onto element f.

So f:N->N where f(x)=x+1 is not bijective because you can not get f(x)=0 which means it is not surjective
but f:N->N^(*) f(x)=x+1 is bijective.

Does this seem right?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/__dp_Y2k
πŸ“…︎ Feb 16 2021
🚨︎ report
Rock Paper Scissors (bijective base 3)

Counting with rocks, papers, and scissors in the bijective base 3 numeral system. Here's how to count in bijective base 3:

1, 2, 3, 11, 12, 13, 21, 22, 23, 31, 32, 33, 111, 112, 113, 121, 122, ...

  • 1: Rock

  • 2: Paper

  • 3: Scissors

The first get is at Rock Rock Rock Rock Rock Rock Rock (decimal 1093).

πŸ‘︎ 22
πŸ’¬︎
πŸ‘€︎ u/Tranquilsunrise
πŸ“…︎ May 14 2017
🚨︎ report
Is there always a computable bijection between two sets of the same cardinality?

Or are there examples where you can prove that the existing bijections are all uncomputable?

πŸ‘︎ 111
πŸ’¬︎
πŸ‘€︎ u/zoe_gone_astray
πŸ“…︎ Dec 28 2021
🚨︎ report
Found this in a textbook on algorithms. The letter R in ciphertext corresponds to both J and U in plaintext. Is this a mistake? Shouldn’t simple substitution maps like this be bijective?
πŸ‘︎ 27
πŸ’¬︎
πŸ‘€︎ u/DatBoi_BP
πŸ“…︎ Sep 21 2020
🚨︎ report
ELI5 of surjective,bijective and injective functions?

Is a function still surjective, if there exists an Y thats not matched to f(x)? What kind of function is a sine?
Edit: spelling

πŸ‘︎ 2
πŸ’¬︎
πŸ“…︎ Oct 05 2020
🚨︎ report
Can anyone explain the bijective, surjective and injective to me?

my understanding:

  1. injective f(a1)=f(a2)
  2. surjective: all a belongs to A, there exists b belongs to B, f(a)=b
  3. bijective : injective + surjective

I only know this, but I dont know the meaning/defintion of these 3 things!

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/kenli0807
πŸ“…︎ Jul 26 2020
🚨︎ report
a function must be "bijective" in order to have a inserve function. Can we construct a "trijective" function?

For f to be invertible it must be bijective.

  • f^-1 = g
  • g^-1 = f

Can we construct some kind of "trijective" function so that

  • f^-1 = g
  • g^-1 = h
  • g^-1 = f

Is it possible at all?

The -1 superscript might be inaccurate here.

Suppose this graph

https://en.wikipedia.org/wiki/File:Inverse_Function_Graph.png

by inverse f we are flipping the function by the dotted line y = x, at 180Β°. Can we flip it 120Β° at a time? So after 3 times it will be restored to the original function f. How do we calculate the intermediate g as the 120Β° flipped version of f?


Edit1: bijective/trijective is misleading. Please ignore the wording. I mean the steps it takes to restore to the original function.

πŸ‘︎ 10
πŸ’¬︎
πŸ‘€︎ u/lambdaq
πŸ“…︎ Feb 13 2020
🚨︎ report
Bijective Function by Amarynceus amarynceus.tumblr.com/pos…
πŸ‘︎ 47
πŸ’¬︎
πŸ‘€︎ u/NewWillinium
πŸ“…︎ Feb 15 2020
🚨︎ report
Can someone explain me injective, bijective, surjective functions?

Also how to find if a particular function is injective or bijective?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/hgrx
πŸ“…︎ Aug 30 2020
🚨︎ report
[Basic topology] Can you have a continuous bijective function where the inverse is not continuous?

Looking at the definition of homeomorphism on wikipedia:

>A function f:X -> Y between two topological spaces is a homeomorphism if it has the following properties:
>
>- f is a bijection (one-to-one and onto),
>
>- f is continuous,
>
>- the inverse function f^(-1) is continuous (f is an open mapping).

Is it possible to have a function that is a bijection and continuous, but the inverse is not continuous? Can you give an example?

Thanks!

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/Kurren123
πŸ“…︎ Sep 08 2020
🚨︎ report
Why is the first graph injective only? It looks bijective to me. And the third graph looks surjective, but I'm told it is neither surjective or injective.
πŸ‘︎ 16
πŸ’¬︎
πŸ‘€︎ u/D3CEO20
πŸ“…︎ May 12 2020
🚨︎ report
Bijective Balanced Little-Endian Base Ten

What a freak of a system!

Bijective- No Zero, there is a digit for the base though (123456789X, 11)

Balanced- Half positive, half negative digits (1234514Μ…13Μ…12Μ…1T10)

Little Endian- Numbers are left to right instead (123456789, 01, 11, 21, 31, 41, 51, 61, 71, 81, 91, 02, 12, 22, 32, 42, 52)

Bijective Balanced Little Endian: (12345, 4Μ…1, 3Μ…1, 2Μ…1, T1, X, 11, 21, 31, 41, 51, 4Μ…2, 3Μ…2, 2Μ…2, T2, X1, 12

Start at 1, get is at XXT1 (I think 1,000 decimal)

πŸ‘︎ 7
πŸ’¬︎
πŸ“…︎ Jun 16 2019
🚨︎ report
Bijective Base 10 | 99A (1000)

Continued from here

Thanks to /u/piyushsharma301 for the run and assist

> A bijective numeral system is one where every combination of digits represents an original number. Standard numeral systems aren't, because leading zeroes have no effect on the value. See the wiki page here

> In bijective base 10, there is no digit for 0, and the digit "A" represents ten

Get is at 199A

πŸ‘︎ 14
πŸ’¬︎
πŸ‘€︎ u/xHOCKEYx12
πŸ“…︎ Feb 06 2017
🚨︎ report
[D] Conditions for a convolution to be bijective?

Setting: I have a convolution of Image I and kernel w, J=conv2D(I,w). I is an image I of size nxn with c channels, while w is a cxcx3x3 matrix, therefore we have c 3x3 filters that can be applied to the image. We use zero-padding so that J has the same dimensionality of I.

What properties does w have to fulfill for the convolution to be invertible? It is clear that at least one such w exists, because 1x1 convolutions are a subset of 3x3 convolutions and since we have c filters, we can encode the identity, which is invertible. It is not enough for the filters to be independent, because as the input has 9c dimensions, we can still loose information.

πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/Ulfgardleo
πŸ“…︎ Oct 20 2019
🚨︎ report
Combinatorics bijective proof

I am struggling to find a function that goes between set A and set B. Can someone help me?

The problem:

Give a bijective proof: The number of n-digit binary numbers with exactly k ones equals the number of k-subsets of [n].

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/999_999_999
πŸ“…︎ Jun 12 2019
🚨︎ report
Bijective base integer

While base integer is boring, the bijective base integer is quite funny.

Base integer means the place values are ... 6 5 4 3 2 1. The number 5 would be represented as 10000. But a bijective base does not allow zeros. So the way to count in bijective base integer is this:

base 10 bijective base integer
1 1
2 2
3 11
4 12
5 21
6 111
7 112
8 121
9 211
10 1111

As you can see there is at most only one 2 and it moves to the front, when it reaches the front we add a new place to the next number.

Get is at [499 ones in a row] 12111111111111111111111111111111111111111111 (took me a while to figure it out).

πŸ‘︎ 18
πŸ’¬︎
πŸ‘€︎ u/jan_kasimi
πŸ“…︎ Feb 10 2017
🚨︎ report
Bijective Base 10

A bijective numeral system is one where every combination of digits represents an original number. Standard numeral systems aren't, because leading zeroes have no effect on the value. See the wiki page here: https://en.wikipedia.org/wiki/Bijective_numeration

In bijective base 10, there is no digit for 0, and the digit "A" represents ten. So:

Decimal Bijective base 10
1 1
2 2
3 3
9 9
10 A
11 11
12 12
99 99
100 9A
101 A1
110 AA

Get is at 99A

πŸ‘︎ 14
πŸ’¬︎
πŸ‘€︎ u/Syrrim
πŸ“…︎ Apr 17 2016
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.