Issue 3024 in sympy: simplify() doesn't work without extra factor

0 views
Skip to first unread message

sy...@googlecode.com

unread,
Jan 22, 2012, 6:02:56 PM1/22/12
to sympy-...@googlegroups.com
Status: Accepted
Owner: ----
Labels: Type-Defect Priority-Medium Simplify

New issue 3024 by asme...@gmail.com: simplify() doesn't work without extra
factor
http://code.google.com/p/sympy/issues/detail?id=3024

In [140]: a = integrate(exp(-I*(k*sqrt(t) + x/(2*sqrt(t)))**2), (k, -oo,
oo), conds='none')

In [141]: a
Out[141]:
⎛ 2 ⎛ -3⋅ⅈ⋅π⎞ ⎞
⎜ 3⋅ⅈ⋅π ⅈ⋅x ⎜ ──────⎟ ⎟
⎜ - ───── + ──── ⎜ 4 ⎟ 2⎟
⎜ 4 4⋅t ⎜x⋅ℯ ⎟ 3⋅ⅈ⋅π ⅈ⋅x ⎟
2 ⎛ ⎛ ⅈ⋅π⎞ ⎞
⎜ π⋅x⋅ℯ ⋅erf⎜─────────⎟ - ───── + ────⎟
-ⅈ⋅x ⎜ ⎜ ───⎟ ⎟ ⅈ⋅π
⎜ ⎜ ___ ⎟ 4 4⋅t ⎟
───── ⎜ ⎜ 4 ⎟ ⎟ ───
⎜ ⎝ 2⋅╲╱ t ⎠ π⋅x⋅ℯ ⎟ 4⋅t
___ ⎜ ⎜ x⋅ℯ ⎟ ⎟ 4
ⅈ⋅⎜- ────────────────────────────────── + ───────────────────⎟⋅ℯ
ⅈ⋅╲╱ π ⋅⎜- erf⎜───────⎟ + 1⎟⋅ℯ
⎜ ___ ___
⎟ ⎜ ⎜ ___⎟ ⎟
⎝ 2⋅╲╱ t 2⋅╲╱ t
⎠ ⎝ ⎝2⋅╲╱ t ⎠ ⎠
───────────────────────────────────────────────────────────────────── -
─────────────────────────────────

___ ___
╲╱ π
⋅x 2⋅╲╱ t

In [142]: simplify(a)
Out[142]:
⎛ ⎛4 ____ ⎞ ⎛4 ____ ⎞ ⎞
4 ____ ___ ⎜ ⎜╲╱ -1 ⋅x⎟ 4 ____ ⎜╲╱ -1 ⋅x⎟ 4 ____⎟
-╲╱ -1 ⋅ⅈ⋅╲╱ π ⋅⎜erf⎜────────⎟ + ╲╱ -1 ⋅erf⎜────────⎟ + 1 - ╲╱ -1 ⎟
⎜ ⎜ ___ ⎟ ⎜ ___ ⎟ ⎟
⎝ ⎝2⋅╲╱ t ⎠ ⎝2⋅╲╱ t ⎠ ⎠
───────────────────────────────────────────────────────────────────
___
2⋅╲╱ t

In [143]: simplify(a*exp(x**2/(4*t)))
Out[143]:
2
3⋅ⅈ⋅π x
- ───── + ───
___ 4 4⋅t
ⅈ⋅╲╱ π ⋅ℯ
──────────────────────
___
╲╱ t

But the exp(x**2/(4*t)) can be pulled out of the final expression, so
simplify() should be able to do it without it. My guess is it needs to
complete the square somewhere, but I haven't actually looked into it.

sy...@googlecode.com

unread,
Feb 21, 2012, 4:19:37 AM2/21/12
to sympy-...@googlegroups.com

Comment #1 on issue 3024 by smi...@gmail.com: simplify() doesn't work

multiplying by y is enough to make it factor, too:

>>> simplify(a*y)
-(-1)**(1/4)*I*sqrt(pi)*y/sqrt(t)


sy...@googlecode.com

unread,
Feb 21, 2012, 2:12:26 PM2/21/12
to sympy-...@googlegroups.com
Updates:
Labels: NeedsReview smichr

Comment #2 on issue 3024 by smi...@gmail.com: simplify() doesn't work

In the powsimp, the Add does not have expand_mul applied to it, while a Mul
does.

https://github.com/sympy/sympy/pull/1074

sy...@googlecode.com

unread,
Mar 5, 2012, 8:20:06 AM3/5/12
to sympy-...@googlegroups.com

Comment #3 on issue 3024 by smi...@gmail.com: simplify() doesn't work

Can you give this a review, Aaron, if you get a few minutes? It's blocking
the power rules work.

sy...@googlecode.com

unread,
Mar 9, 2012, 12:05:44 PM3/9/12
to sympy-...@googlegroups.com
Updates:
Status: Fixed

Comment #4 on issue 3024 by smi...@gmail.com: simplify() doesn't work

(No comment was entered for this change.)

Reply all
Reply to author
Forward
0 new messages