What type of mathematical function is this?

Suppose a function f(x) was defined so that an inversion around the decimal point occured.

ie.

f(1.2) = 2.1
f(13.2) = 2.31

From what I remember, this function is one to one and onto for rational numbers. I have no idea how I know that, but I’m pretty sure that it means that each number has it’s own unique solution within the set of rational numbers.

Now suppose we define a new function as g(x) = f(f(x) + f(x)). All of the sudden I think that g(x) is one to one and onto for all real numbers. But if you try to plot it, you get a graph that seems to be fractal in it’s dimension. The problem of course is that you can never compute all of the in-between numbers.

What type of math is this, and is it useful in any way?

ROL and ROR are pretty useful in assembly language (base 2)
Logical, Shift, Rotate and Bit Instructions

Holy crap! I knew I was venturing into complicated territory, but I have no idea what any of that means. I left my math roots way back fifteen years ago. What is all that?

Allright, I get RCL and RCR, but I don’t get ROL and ROR.

It’s not all that complicated, just part of most assembly languages, that are used to program computer microprocessors.

None of the rotation instructions work here. Rotating (a, b, c, d) left will give you (b, c, d, a), (c, d, a, b), (d, a, b, c), and finally (a, b, c, d), but not (d, c, b, a), which is what you need to get 2.31 from 13.2.

The function in the OP is easy to express in your favorite programming language as a string function, but it can’t be written as a numerical function because its value depends on the base of its input. f(2.0[sub]10[/sub]) = 0.2[sub]10[/sub] = 1/5, but f(10.0[sub]2[/sub]) = 0.01[sub]2[/sub] = 1/4.

Wait a minute. If x is a repeating decimal (like 1/3), what would f(x) be?

The real difference betwen assembly language stuff and g(x) is that g(x) is one to one and onto for the entire set of real numbers, but atleast RCL and RCR are only one to one and onto for rational numbers.

All rationals? How do you define f(1/3), or any other repeating decimal?

ETA:

OK, somebody beat me to it while I was posting. Maybe the third simulposter will at least use a different number for an example.

What you need is a transpose instruction, which is relatively rare on modern computers. As ultrafilter noted, the value is dependent on the base of the positional number system. Still, a similar function exists for binary numbers. Assuming a 32-bit word size and 16.16 fixed-point format, a 32-bit transpose instruction does the job in a single instruction time.

0001001000110100.0000000000000000 --> 0000000000000000.0010110001001000

Good point. f(x) is not one to one and onto for all rational numbers, but for all non-repeating rational numbers. What about g(x)? Is g(x) one to one and onto for all rational numbers?

You’d still have to exclude repeating decimals, since g(x) is defined in terms of f(x). (Unless there’s some tricksy way of expanding the range of f(x) to allow for things like f(1/3).)

I suspect g(x) is one-to-one and onto for all terminating-decimal numbers, because you can invert it: g[sup]-1[/sup] = f( f(x)/2 ). But that’s just off the top of my head; I hesitate to call it a proof.