Long Division when dividend and divisor are of same size (same number of digits)

I want to know if there is some optimized method (constant complexity preferred) to obtain the quotient when the dividend and the divisor contain the same number of digits. I know about algorithm D of “The Art of Computer Programming” but there Knuth describes how to find quotient digit when the dividend is $ n+1$ in length and divisor is $ n$ . Is there any method of finding the quotient digit when they both are of the same length? Obviously I can search linearly from $ 1$ to $ base$ or use Binary search for the same but I was looking for something more optimal as my Base is very large $ (\approx 10^{18})$

Floating point arithmetic on division

I am trying to figure out how $ (x/y)$ in floating point arithmetic

$ fl(fl(x) / fl(y))$ where $ fl(x) = x(1-\delta_1)$ , $ fl(y) = y(1-\delta_2)$ , $ fl = (1-\delta_3)$

I have:

$ = x/y \cdot ((1-\delta_1)/(1-\delta_2))(1-\delta_3)$

after arithmetic

$ = x/y \cdot (\delta_3 \delta_1 – \delta_1 – \delta_3 + 1)/(1-\delta_2)$

Not sure how to fully write the rest I believe i have to shorten them using the info that $ \delta < \epsilon$ and $ \delta^2 \leq \delta$

Division erronea (Javascript)

Soy estudiante de Javascript, y estaba armando una calculadora del IMC (indice de masa corporal) para practicar un poco.

Estoy teniendo un problema con la funcion del IMC().

Les paso el codigo:

    function PuntuarMetros(numero){     n = numero.toString();     a = n.slice(0,1);     b = a + "." + n.slice(1,3);     return parseFloat(b); }  function NumeroAlCuadrado(numero){     //Agregar condicional si tiene o no "." o ","     a = PuntuarMetros(numero);         b = a * a;     c= b.toFixed(2);     return parseFloat(c); }  function DividirNumero(dividendo,divisor){     a = dividendo;     b = divisor;     c = a / b;     return c; }  function IMC(peso,altura){     a = peso;     console.warn(a)     b = NumeroAlCuadrado(altura);     console.warn(b)     c = DividirNumero(a,b);     console.warn(c)     return c; } 

Consola de Chrome:

DividirNumero(64,2.92) 21.91780821917808 64/2.92 21.91780821917808  IMC(64,171) 64 2.92 0.5856164383561644 

Como bien se puede ver, cuando realizo la division de dos numeros mediante la funcion me da como resultado “21.9”, luego pruebo dividirlo fuera de la funcion y me da el mismo resultado.

Ahora cuando lo hago dentro de la funcion de IMC, la division me la realiza de forma erronea.

Espero haya sido claro con mi problema.

Muchas gracias por la ayuda šŸ˜€

Is it good practice to replace division with multiplication when possible?

Whenever I need division, for example, condition checking, I would like to refactor the expression of division into multiplication, for example:

Original version:

if(newValue / oldValue >= SOME_CONSTANT) 

New version:

if(newValue >= oldValue * SOME_CONSTANT) 

Because I think it can avoid:

  1. Division by zero

  2. Overflow when oldValue is very small

Is that right? Is there a problem for this habit?

Multiplication and division by a morphism under the ā€œinner compositionā€ in closed monoidal categories

I asked this a week ago at math.stackexchange, without success, so I hope it will be appropriate here.

Let $ {\mathcal C}$ be a symmetric closed monoidal category, and let me denote the internal hom-functor by a fraction $ $ (X,Y)\mapsto\frac{Y}{X}, $ $ so that we have an isomorphism of functors $ $ \operatorname{Mor}(A\otimes B,C)\cong \operatorname{Mor}\left(A,\frac{C}{B}\right). $ $ As is known, $ {\mathcal C}$ is an enriched category over itself. For each objects $ A,B,C$ let me denote by $ \bullet_{A,B,C}$ the “inner composition” in $ {\mathcal C}$ as in an enriched category, i.e. the morphism $ $ \bullet_{A,B,C}:\frac{C}{B}\otimes\frac{B}{A}\to\frac{C}{A} $ $ with the corresponding properties.

I wonder if the following identity always holds $ $ \bullet_{A,C,D}\circ\left(1_{\frac{D}{C}}\otimes\frac{\varphi}{1_A}\right)= \bullet_{A,B,D}\circ\left(\frac{1_D}{\varphi}\otimes1_{\frac{B}{A}}\right) $ $ (for arbitrary objects $ A,B,C,D$ and for arbitrary morphism $ \varphi:B\to C$ ).

multiplication and division by a morphism under the inner multiplication

This is strange, I can prove this only in the case when the unit $ I$ is a separating object in $ {\mathcal C}$ (what does not always hold). Is it possible that there is a counterexample?

How to do arbitrary non-negative powered polynomial division in Mathematica?

Suppose I have a simple polynomial in $ \{a,b\}$ , defined as $ a^k-b^k \ \forall \ k\in \mathbb{Z}^{\geq0}$ . If I know one of the factor is $ (a-b)$ , is there a way to get a representation of its remaining factors in Wolfram Language?

I know one of its representation is $ \sum_{j=0}^{k-1}{(a^{(k-1)-j}\ b^j)}$ and Mathematica recognizes that

Sum[a^((k-1)-j) b^j,{j,0,k-1}] 


(a^k - b^k)/(a - b) 

But if I ask


It is unable to do anything.

Also what is the proper way to give assumptions?

Is the above expression intepreted differently if I give as


Also tried factoring directly without giving a single factor to no success,