On Tue, Nov 8, 2011 at 6:40 AM, Chris Smith <[email protected]> wrote:
>>> V2 = 5*D*(9*D**4*exp(2*r2/D) - 9*D**4 + 9*D**3*r1*exp(2*r2/D) - 9*D**3* &
>>>      r1 - 9*D**3*r2*exp(2*r2/D) - 9*D**3*r2 + 3*D**2*r1**2*exp(2*r2/D &
>>>      ) - 3*D**2*r1**2 - 9*D**2*r1*r2*exp(2*r2/D) - 9*D**2*r1*r2 + 3*D &
>>>      **2*r2**2*exp(2*r2/D) - 3*D**2*r2**2 - 3*D*r1**2*r2*exp(2*r2/D) - &
>>>      3*D*r1**2*r2 + 3*D*r1*r2**2*exp(2*r2/D) - 3*D*r1*r2**2 + r1**2*r2 &
>>>      **2*exp(2*r2/D) - r1**2*r2**2)*exp(-r1/D - r2/D)/(2*r1**3*r2**3)
>
> It would be much nicer for the reader if textwrap's fill were used for this:
>
>>>> import textwrap
>>>> text = lambda x: textwrap.TextWrapper(
> ...     width=60,
> ...     break_long_words=False
> ...     ).fill(str(x))
>>>>
>>>> V2 = S('5*D*(9*D**4*exp(2*r2/D) - 9*D**4 + 9*D**3*r1*exp(2*r2/D) - 
>>>> 9*D**3*r1
>  - 9*D**3*r2*exp(2*r2/D) - 9*D**3*r2 + 3*D**2*r1**2*exp(2*r2/D) - 
> 3*D**2*r1**2 -
>  9*D**2*r1*r2*exp(2*r2/D) - 9*D**2*r1*r2 + 3*D**2*r2**2*exp(2*r2/D) - 
> 3*D**2*r2*
> *2 - 3*D*r1**2*r2*exp(2*r2/D) -3*D*r1**2*r2 + 3*D*r1*r2**2*exp(2*r2/D) - 
> 3*D*r1*
> r2**2 + r1**2*r2**2*exp(2*r2/D) - r1**2*r2**2)*exp(-r1/D - 
> r2/D)/(2*r1**3*r2**3)
> ')
>>>> print text(V2)
> 5*D*(9*D**4*exp(2*r2/D) - 9*D**4 + 9*D**3*r1*exp(2*r2/D) -
> 9*D**3*r1 - 9*D**3*r2*exp(2*r2/D) - 9*D**3*r2 +
> 3*D**2*r1**2*exp(2*r2/D) - 3*D**2*r1**2 -
> 9*D**2*r1*r2*exp(2*r2/D) - 9*D**2*r1*r2 +
> 3*D**2*r2**2*exp(2*r2/D) - 3*D**2*r2**2 -
> 3*D*r1**2*r2*exp(2*r2/D) - 3*D*r1**2*r2 +
> 3*D*r1*r2**2*exp(2*r2/D) - 3*D*r1*r2**2 +
> r1**2*r2**2*exp(2*r2/D) - r1**2*r2**2)*exp(-r1/D -
> r2/D)/(2*r1**3*r2**3)
>
> FWIW...

In Fortran, one has to append the line continuation character "&" for
each line above (just like you have to use "\" in Python in most
cases).

This should go into sympy/printing/fcode.py.

Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" 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?hl=en.

Reply via email to