Ask Your Question

Revision history [back]

I cannot take sqrt of units

I'm trying to use sagemath to evaluate equations that involve units. And when I hit a sqrt of a unit it won't evaluate it.

For example:

sage: sqrt(4*units.length.meter^2)
2*sqrt(meter^2)

The result should be 2*meter but I can't figure out how to force it to evaluate the sqrt of m^2. Even if I try to convert it like:

(sqrt(4*units.length.meter^2)).convert(units.length.meter)

I get:

ValueError: Incompatible units
click to hide/show revision 2
retagged

I cannot take sqrt of units

I'm trying to use sagemath to evaluate equations that involve units. And when I hit a sqrt of a unit it won't evaluate it.

For example:

sage: sqrt(4*units.length.meter^2)
2*sqrt(meter^2)

The result should be 2*meter but I can't figure out how to force it to evaluate the sqrt of m^2. Even if I try to convert it like:

(sqrt(4*units.length.meter^2)).convert(units.length.meter)

I get:

ValueError: Incompatible units