当前位置: 首页>>代码示例>>Python>>正文


Python Function.quotient方法代码示例

本文整理汇总了Python中function.Function.quotient方法的典型用法代码示例。如果您正苦于以下问题:Python Function.quotient方法的具体用法?Python Function.quotient怎么用?Python Function.quotient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在function.Function的用法示例。


在下文中一共展示了Function.quotient方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_split

# 需要导入模块: from function import Function [as 别名]
# 或者: from function.Function import quotient [as 别名]
 def test_split(self):
     # If this ever breaks, we should solve the problem by writing a
     # new kind of Function that turns a lambda expression into a
     # Function.  That way, it will never be simplified.
     # f = x^2 + x
     f = Function.sum(Function.power(Function.identity(),
                                     Function.constant(2)),
                      Function.identity())
     # f(-1) = 0, f(0) = 0, f(-.5) = -.25
     # The range of f on [-1,0] is [-.25,0]
     # f([-1,0]) = [-1,1]
     # f([-1,-.5]) = [-.75,.5]
     # f([-.5,0]) = [-.5,.25]
     # This will never finish, since it asks for the exact bounds
     self.assertTrue(is_bounded(f, Interval(-1,0), Interval(-1/4,0))
                     is None)
     # g = 1/2*x^3-3/2*x
     g = Function.sum(Function.product(
             Function.constant(.5),
             Function.power(Function.identity(),
                            Function.constant(3))),
         Function.product(Function.constant(-1.5),
                          Function.identity()))
     self.assertEqual(is_bounded(g, Interval(-1.5,1.5), Interval(-.9,1)),
                      False)
     # This encounters a ValueError on the first split so should
     # return None
     h = Function.quotient(Function.constant(1), Function.identity())
     self.assertTrue(is_bounded(h, Interval(-1,1), Interval(-5,5)) is None)
开发者ID:bjthinks,项目名称:grapher,代码行数:31,代码来源:slice.py


注:本文中的function.Function.quotient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。