Status: Accepted
Owner: [email protected]
Labels: Type-Defect Priority-Medium NeedsReview

New issue 2154 by [email protected]: pprint Sum and Product needed
http://code.google.com/p/sympy/issues/detail?id=2154

pprint has some builtin methods for handling vertical and horizontal objects, but a 2-d object like a sum sign presents a bit of a problem. I've attempted a workaround solution that produces the following:

h[1] >>> s=Sum(i,i);pprint(s)

__
\ `
 )  i
/_,
 i
h[1] >>> s=Sum(i,(i,1));pprint(s)

_____
\    `
 )     i
/____,
 i = 1
h[1] >>> s=Sum(i,(i,1,3));pprint(s)
   3
_____
\    `
 )     i
/____,
 i = 1
h[1] >>> s=Sum(x/(x+y), (x,1, 10));pprint(s)
   10
_____
\    `
 \       x
  )    -----
 /     x + y
/____,
 x = 1
h[1] >>> s=Sum(x/(x+y), (x,1, a/b));pprint(s)
   a
   -
   b
_____
\    `
 \       x
  )    -----
 /     x + y
/____,
 x = 1
h[1] >>> s=Sum(x**2/(x+y), (x,1, a/b),(y,1,4));pprint(s)
          a
          -
   4      b
_____  _____
\    ` \    `
 \      \        2
  \      \      x
  /      /    -----
 /      /     x + y
/____, /____,
 y = 1  x = 1
h[1] >>> s=Sum(x**2/(x+y), (x,1, a/b),(y,a/b**2,4));pprint(s)
           a
           -
   4       b
______  _____
\     ` \    `
 \       \        2
  \       \      x
  /       /    -----
 /       /     x + y
/_____, /____,
     a   x = 1
 y = --
      2
     b

All the sum sign heights are based on the argument height; they are all padded on the right by one space. If anyone has suggestions or wants to test this out please see my pprintSum branch in smichr's github account.

(I'm not sure if I should immediately put this as a pull request or let it simmer here for a while and only put it there when the code is truly ready to go based on dicussion...so I'm not putting a pull request in yet.)

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to