Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate triggers TypeError: as_base_exp() missing 1 required positional argument: 'self #11364

Closed
gerritholl opened this issue Jul 8, 2016 · 2 comments

Comments

@gerritholl
Copy link

I'm new to sympy so I'm not sure how to

In [206]: (h, c, lmb, k, T) = symbols("h c λ k T")

In [207]: phi = sympy.Function('φ')

In [208]: sympy.integrate((2*h*c**2)/(lmb**5) * phi/(sympy.exp(h*c/(lmb*k*T)-1)), lmb)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/home/users/gholl/venv/stable-3.5/lib/python3.5/site-packages/sympy/core/cache.py in wrapper(*args, **kwargs)
     92                 try:
---> 93                     retval = cfunc(*args, **kwargs)
     94                 except TypeError:

/home/users/gholl/venv/stable-3.5/lib/python3.5/site-packages/sympy/core/operations.py in __new__(cls, *args, **options)
     40 
---> 41         c_part, nc_part, order_symbols = cls.flatten(args)
     42         is_commutative = not nc_part

/home/users/gholl/venv/stable-3.5/lib/python3.5/site-packages/sympy/core/mul.py in flatten(cls, seq)
    291                 # o = b
--> 292                 b, e = o.as_base_exp()
    293 

TypeError: as_base_exp() missing 1 required positional argument: 'self'

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-208-23bbd328d787> in <module>()
----> 1 sympy.integrate((2*h*c**2)/(lmb**5) * phi/(sympy.exp(h*c/(lmb*k*T)-1)), lmb)

/home/users/gholl/venv/stable-3.5/lib/python3.5/site-packages/sympy/core/decorators.py in __sympifyit_wrapper(a, b)
     75                 if not hasattr(b, '_op_priority'):
     76                     b = sympify(b, strict=True)
---> 77                 return func(a, b)
     78             except SympifyError:
     79                 return retval

/home/users/gholl/venv/stable-3.5/lib/python3.5/site-packages/sympy/core/decorators.py in binary_op_wrapper(self, other)
    116                     else:
    117                         return f(self)
--> 118             return func(self, other)
    119         return binary_op_wrapper
    120     return priority_decorator

/home/users/gholl/venv/stable-3.5/lib/python3.5/site-packages/sympy/core/expr.py in __mul__(self, other)
    139     @call_highest_priority('__rmul__')
    140     def __mul__(self, other):
--> 141         return Mul(self, other)
    142 
    143     @_sympifyit('other', NotImplemented)

/home/users/gholl/venv/stable-3.5/lib/python3.5/site-packages/sympy/core/cache.py in wrapper(*args, **kwargs)
     93                     retval = cfunc(*args, **kwargs)
     94                 except TypeError:
---> 95                     retval = func(*args, **kwargs)
     96                 return retval
     97 

/home/users/gholl/venv/stable-3.5/lib/python3.5/site-packages/sympy/core/operations.py in __new__(cls, *args, **options)
     39             return args[0]
     40 
---> 41         c_part, nc_part, order_symbols = cls.flatten(args)
     42         is_commutative = not nc_part
     43         obj = cls._from_args(c_part + nc_part, is_commutative)

/home/users/gholl/venv/stable-3.5/lib/python3.5/site-packages/sympy/core/mul.py in flatten(cls, seq)
    290                 #      e
    291                 # o = b
--> 292                 b, e = o.as_base_exp()
    293 
    294                 #  y

TypeError: as_base_exp() missing 1 required positional argument: 'self'

In [209]: print(sympy.__version__)
1.0

I'm not sure if I'm doing something wrong here, or if this is a bug in sympy.

@jksuom
Copy link
Member

jksuom commented Jul 9, 2016

The function phi has no argument in the integrand. Should it be a constant?

@oscarbenjamin
Copy link
Contributor

This issue is base on a misunderstanding. I think it can be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants