handcalcs
handcalcs copied to clipboard
incorrect results when using forallpeople with handcalcs
The calculation result is incorrect when using sqrt with variables
from math import sqrt
import handcalcs.render
import forallpeople
%%render
rho_1 = 200 *kg/m**3
rho_2 = 600 *kg/m**3
aa = (200 *kg/m**3 * 600 *kg/m**3)**(1/2) # ok, direct input
bb = sqrt(200 *kg/m**3 * 600 *kg/m**3) # BAD, no units, direct input
cc = (rho_1*rho_2)**(1/2) # ok, using variable
dd = sqrt(rho_1*rho_2) # BAD, no units, using variable
ee = sqrt(rho_1.value*rho_2.value) # ok, no substitution, no units, using variable
ff = sqrt((rho_1*rho_2).value) # ok, no substitution, no units, using variable
#146
I have done some testing and found this is a problem with forallpeople rather than handcalcs. This issue has been raised on the forallpeople GitHub https://github.com/connorferster/forallpeople/issues/19) The issue has been closed with a workaround. Hope this helps.