Hello all, I was adding a test case for an issue where I encountered assertion error, I do not have much idea about it. Can someone guide me how it can be resolved?
Traceback (most recent call last):
File "/home/shardul/sympy/sympy/series/tests/test_series.py", line 208, in test_issue_9173
assert Q.series(y, n=3) == b_2y**2 + b_1y + b_0 + O(y**3)
>>> from sympy import * >>> from sympy.abc import y >>> var('p_0 p_1 p_2 p_3 b_0 b_1 b_2') (p_0, p_1, p_2, p_3, b_0, b_1, b_2) >>> Q = (p_0 + (p_1 + (p_2 + p_3/y)/y)/y)/(1 + ((p_3/(b_0*y) + (b_0*p_2 - b_1*p_3)/b_0**2)/y + (b_0**2*p_1 - b_0*b_1*p_2 - p_3*(b_0*b_2 - b_1**2))/b_0**3)/y) >>> Q.series(y, n=3) y*(b_0*p_2/p_3 + b_0*(-p_2/p_3 + b_1/b_0)) + y**2*(b_0*p_1/p_3 + b_0*p_2*(-p_2/p_3 + b_1/b_0)/p_3 + b_0*(-p_1/p_3 + (p_2/p_3 - b_1/b_0)**2 + b_1*p_2/(b_0*p_3) + b_2/b_0 - b_1**2/b_0**2)) + b_0 + O(y**3) >>> simplify(y*(b_0*p_2/p_3 + b_0*(-p_2/p_3 + b_1/b_0)) + y**2*(b_0*p_1/p_3 + b_0*p_2*(-p_2/p_3 + b_1/b_0)/p_3 + b_0*(-p_1/p_3 + (p_2/p_3 - b_1/b_0)**2 + b_1*p_2/(b_0*p_3) + b_2/b_0 - b_1**2/b_0**2)) + b_0 + O(y**3)) b_2*y**2 + b_1*y + b_0 + O(y**3)
RecursionError(for specifics, sympy/sympy#9449 )? Any hints you can give would be great as I'm seeing this part of the codebase for the first time. Should I focus on the statements before the recursion happens or during (I have tried printing values during both but still wasn't able to figure anything out)?
parse_expr()with a bit of transformation logic to ensure the expressions are well-formatted in ways SymPy expects. I am stumped by one thing, though. Some of my expressions contain functions are logical (boolean) , so I get expressions like
f(x) & g(y). But the default transformations turn these into Functions, which aren't considered
Booleans, and thus cause
TypeErrors when used as arguments to
Function-like symbol that counts as a Boolean type for these purposes? Is there some better way to achieve this?
pquoto make the numerator order lower than the denominator order. However, the result I get makes no sense, when I subtract (quotient + remainder/denominator) from the original fraction, the answer is not zero as it should be. I've tested on a simple case of (2x + 1)/(x + 1) and the answer was fine there.
I want the following expression to be simplified in terms of v, I preferred collect() method but it is giving same expression as input .
input expression :
(8*c**4*v**2 + 6*c**2*v**4 + 5*v**6)/(16*c**6) + 1
5*v**6/(16*c**6) + 3*v**4/(8*c**4) + v**2/(2*c**2) + 1
>>> collect((8*c**4*v**2 + 6*c**2*v**4 + 5*v**6)/(16*c**6) + 1 , v) 1 + (8*c**4*v**2 + 6*c**2*v**4 + 5*v**6)/(16*c**6)
Can anyone suggest better method to do this task
sin(acos(cos(a) * cos(pi / 2 - 2 * γ)))evaluates directly to
sqrt(-sin(2*γ)**2*cos(a)**2 + 1), which is something that I don't want. is there a way to tell SymPy to not perform this sort of simplification?
from sympy.core.expr import UnevaluatedExpr sin(UnevaluatedExpr(acos(cos(a) * cos(pi / 2 - 2 * γ))))
I am Shatakshi, a third-year Computer Science undergraduate student at Mody University, India.
I have previously worked on research papers so I am comfortable with python and theoretical concepts of Machine Learning and their implementation.
This is the first time I will be contributing to a big project with so many contributors. I have read the instructions to contribute. It will be really helpful if I can get some clue on how to start contributing to this kind of projects.
There can be issues parallelizing things with SymPy because of serialization bugs.
@asmeurer K so, the best way to do this is by serialising a function that wraps lambidfy rather than creating your lambidfied function first then trying to serialise that. Thi is working for me in task nicely
def numba_func(consts): model = sp.lambdify(tuple(consts.keys()),integral,"mpmath") return model(*tuple(consts.values())) out = client.map(numba_func, consts_list) result = client.gather(out)