mirror of
https://github.com/vale981/SecondaryValue
synced 2025-03-04 16:41:38 -05:00
Fix pretty printing
This commit is contained in:
parent
36b6f608f7
commit
2d88701eaa
2 changed files with 5 additions and 4 deletions
|
@ -242,7 +242,7 @@ class SecondaryValue:
|
|||
|
||||
return (result, dep_values) if retdeps else result
|
||||
|
||||
def _get_derivatives(self, *args):
|
||||
def _get_derivatives(self, *args, lambdify=True):
|
||||
"""Calculates the derivatives of the expression for a given
|
||||
set of variables specified by args.
|
||||
"""
|
||||
|
@ -251,7 +251,8 @@ class SecondaryValue:
|
|||
if var not in self._derivatives:
|
||||
self._derivatives[var] = \
|
||||
sympy.lambdify(self._parsed.free_symbols,
|
||||
diff(self._parsed, var), modules=np)
|
||||
diff(self._parsed, var), modules=np)\
|
||||
if lambdify else diff(self._parsed, var)
|
||||
|
||||
return {var: self._derivatives[var] for var in args}
|
||||
|
||||
|
@ -264,7 +265,7 @@ class SecondaryValue:
|
|||
:returns: sympy expression
|
||||
"""
|
||||
|
||||
derivs = self._get_derivatives(*variables)
|
||||
derivs = self._get_derivatives(*variables, lambdify=False)
|
||||
terms = [(sympy.simplify(derivs[var]) * sympy.Dummy('Delta_' + var))**2 \
|
||||
for var in variables]
|
||||
return sympy.sqrt(sum(terms))
|
||||
|
|
2
setup.py
2
setup.py
|
@ -6,7 +6,7 @@ def readme():
|
|||
return f.read()
|
||||
|
||||
setup(name='SecondaryValue',
|
||||
version='0.1.6',
|
||||
version='0.1.7',
|
||||
description='A helper to calculate the gaussian error propagation.',
|
||||
long_description=readme(),
|
||||
long_description_content_type='text/markdown',
|
||||
|
|
Loading…
Add table
Reference in a new issue