# Reducing a fraction containing numbers in numerical form

I am looking for a function that would transform a fraction of the form:

$$\frac{1.0\times 10^{-10}}{1.0\times 10^{-11}+1.0\times 10^{-12}\,x}$$

into this: $$\frac{1.0}{1.0\times 10^{-1}+1.0\times 10^{-2}\,x}$$

or this: $$\frac{100.0}{10.0+1.0\,x}\;.$$

I've tried Simplify and FullSimplify but they don't work this way.

Any help will be appreciated.

Oh, when I tried Simplify, it was a harder case of something like

$$\frac{1.0\times 10^{-10}+1.0\times 10^{-12}\,x}{1.0\times 10^{-11}+1.0\times 10^{-12}\,x}$$

Actually, Simplify works for the previous fraction but does not simplify this one.

However, answer by Carl Woll (in the comments) works perfectly for both. Thank you!

• Perhaps N @ Simplify @ Rationalize[expr, 0]? May 5, 2021 at 22:10
• Cancel yields the desired result (last one). May 5, 2021 at 22:16
• With v12.2 on a Mac, just using Simplify produces the last result requested, 100./(10. + 1.*x) May 6, 2021 at 0:52
• ((1.0*10^-10 + 1.0*10^-12*x)/(1.0*10^-11 + 1.0*10^-12*x) // Cancel) /. {1. -> 1} works also. May 6, 2021 at 23:19
• @Somos Oh, yes, that's right. So, yarchik's answer is also valid. Thanks.
– mdi
May 6, 2021 at 23:28

Easiest way:

(1.0 10^-10)/(1.0 10^-11 + 1.0 10^-12 x) // Together

(*100./(1. x + 10.)*)


There are several ways of doing this. Here are two that come first into mind.

expr = (1.0*10^-10)/(1.0*10^-11 + 1.0*10^-12*x);

1/Simplify[Denominator[expr]/Numerator[expr]]

(* 1/(0.1 + 0.01 x) *)

MapAt[Simplify[Divide[#, Numerator[expr]]] &, expr, {{1}, {2, 1}}]

(* 1./(0.1 + 0.01 x)  *)


Have fun!

How about this. Dividing both the numerator and denominator by the prefactor of x .Works for both expressions.

expr = (1.0*10^-10)/(1.0*10^-11 + 1.0*10^-12*x)

fac = Cases[expr, Times[aa_, x] -> aa, \[Infinity]][[1]];
(Numerator[expr ]/fac // Simplify)/
(Denominator[expr]/fac // Simplify)

(*   100./(10. + 1. x)   *)

expr = (1.0*10^-10 + 1.0*10^-12*x)/(1.0*10^-11 + 1.0*10^-12*x
)


With more complicated expressions use MantissaExponent

expr = (1.0*10^-10 + 1.1*10^-12*x)/(1.0*10^-11 + 3.5*10^-12*x)

fac = Cases[expr, Times[aa_, x] -> aa, \[Infinity]][[1]];

(Numerator[expr]/10^Last@MantissaExponent[fac] // Simplify)/
(Denominator[expr]/10^Last@MantissaExponent[fac] // Simplify)

(*   (10. + 0.11 x)/(1. + 0.35 x)   *)