0
$\begingroup$

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.

[edit]

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!

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

3 Answers 3

1
$\begingroup$

Easiest way:

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

(*100./(1. x + 10.)*)
$\endgroup$
0
$\begingroup$

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!

$\endgroup$
0
0
$\begingroup$

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)   *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.