I have a function that takes in an integer value and returns a symbolic
fraction of it, e.g.,
```
def r(n):
return sympy.Rational(n, 261)
```
I would like to be able to provide integers and sympy.Symbols alike, but
the latter fails with
```
TypeError: invalid input: n
```
-- Right, one can simply use `n/261`.
Since Rationals appear quite frequently in my code, I would like to avoid
constructions like
```
x = n/261 if isinstance(n, sympy.Atom) else sympy.Rational(n, 261)
```
(where sympy.Atom wouldn't even cover cases like `2n+1` in either numerator
or denominator).
Is there a way to support integer and symbolic fractions from one interface?
Cheers,
Nico
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/93e23cc1-6425-44ed-bc5d-192691058377%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.