Separate all values in an expression: (a-1)/b --> ((a/1)*(1/b))-(1/b)

Ethrex

New member
Joined
Feb 27, 2018
Messages
3
For code I am writing, I have a goal to change an expression such that all values can be represented as a simple fraction where 1 is either the numerator or denominator -- and each fraction cannot be separated by division. Sounds crazy, I know - this is more of an exercise than anything.

Is this even possible? For example:

(a-1)/b --> ((a/1)*(1/b))-(1/b)

I have found I am able to do this with a lot of algebraic expressions. However, if a + or - exists in a denominator, I don't seem to be able to break it out. For example:

a/(b-1)

The best I can do is: (a/1)*(1/(b-1))

Just fyi, right now I am not seeking to solve for log, exp, etc, just +-/* operators...

Thanks!
 

Subhotosh Khan

Super Moderator
Staff member
Joined
Jun 18, 2007
Messages
18,134
For code I am writing, I have a goal to change an expression such that all values can be represented as a simple fraction where 1 is either the numerator or denominator -- and each fraction cannot be separated by division. Sounds crazy, I know - this is more of an exercise than anything.

Is this even possible? For example:

(a-1)/b --> ((a/1)*(1/b))-(1/b)

I have found I am able to do this with a lot of algebraic expressions. However, if a + or - exists in a denominator, I don't seem to be able to break it out. For example:

a/(b-1)

The best I can do is: (a/1)*(1/(b-1))

Just fyi, right now I am not seeking to solve for log, exp, etc, just +-/* operators...

Thanks!
How about:


a/(b-1) = 1/[(b-1)/a] = 1/[{(b/1)*(1/a) - (1/a)}]
 

stapel

Super Moderator
Staff member
Joined
Feb 4, 2004
Messages
15,943
For code I am writing, I have a goal to change an expression such that all values can be represented as a simple fraction where 1 is either the numerator or denominator -- and each fraction cannot be separated by division. Sounds crazy, I know - this is more of an exercise than anything.
If you restrict yourself to using only fractions which have "1" as the numerator, you'll be in the Egyptian context. They may have figured out pyramids, but fractions were a bit of a struggle for them! ;)
 

Ethrex

New member
Joined
Feb 27, 2018
Messages
3
Thanks Subhotosh Khan, I think you got the right idea. You have successfully isolated the denominators from having addition/subtraction. Unfortunately the whole expression becomes a reciprocal itself. Is there any way to avoid that? I am trying to not have multiple layers of division, and in fact leave any division at the lowest layer (no more than a 1 or a variable in the numerator or denominator). I suspect it is not possible.

stapel, that was an interesting read for sure!
 

Ethrex

New member
Joined
Feb 27, 2018
Messages
3
So I figured out this:

a/(b-1)
= a * (1/(b-1))
= a * ((b-1)^-1) // negative exponent

Is there any way to distribute the exponent to b and -1 to separate them?
 
Top