Open cream68 opened 1 month ago
I am using the following lambda function to apply sqrt to variables with units:
lambda
sqrt
sqrt = lambda x: x.sqrt()
This works very well until I force the units using .prefix('something') on the variables used inside the sqrt function:
.prefix('something')
super(Physical, self).__setattr__("value", float(value)) ^^^^^^^^^^^^ TypeError: float() argument must be a string or a real number, not 'complex'
Is there a way to circumvent this problem or a better approach to ensure sqrtworks with prefixed units?
Thank you for your help!
I am using the following
lambda
function to applysqrt
to variables with units:sqrt = lambda x: x.sqrt()
This works very well until I force the units using
.prefix('something')
on the variables used inside thesqrt
function:Is there a way to circumvent this problem or a better approach to ensure
sqrt
works with prefixed units?Thank you for your help!