本文整理汇总了Python中sympy.Symbol.get_dimensional_dependencies方法的典型用法代码示例。如果您正苦于以下问题:Python Symbol.get_dimensional_dependencies方法的具体用法?Python Symbol.get_dimensional_dependencies怎么用?Python Symbol.get_dimensional_dependencies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.Symbol
的用法示例。
在下文中一共展示了Symbol.get_dimensional_dependencies方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_dim
# 需要导入模块: from sympy import Symbol [as 别名]
# 或者: from sympy.Symbol import get_dimensional_dependencies [as 别名]
def get_dim(self, dim):
"""
Find a specific dimension which is part of the system.
dim can be a string or a dimension object. If no dimension is found,
then return None.
"""
#TODO: if the argument is a list, return a list of all matching dims
found_dim = None
#TODO: use copy instead of direct assignment for found_dim?
if isinstance(dim, string_types):
dim = Symbol(dim)
if dim.is_Symbol:
for d in self._dims:
if dim in (d.name, d.symbol):
found_dim = d
break
elif isinstance(dim, Dimension):
for i, idim in enumerate(self._dims):
if dim.get_dimensional_dependencies() == idim.get_dimensional_dependencies():
return idim
return found_dim