mazkime <[email protected]> writes:
> I encounter a problem splitting and equation on several lines using
> the backslash. Splitting works for any line, except for symbolic
> expressions where the error message '
>
> SyntaxError: invalid syntax' occurs.
>
> A little example.
> * the following lines work :
> f = x^2 \
> + 1
> print f
>
> * but those don't work :
> f(x) = x^2
> + 1
> print f
>
> Is there a special syntax to split symbolic functions ?
Probably
f(x) = x^2 \
+ 1
*should* work, but it doesn't, you're right. But in any case, I would
encourage you not to use this C-style line continuation where you put a
backslash before a line break. It leads to invisible trailing whitespace
becoming semantically meaningful, which is generally a bad thing.
In Python you have the option of doing this in a much nicer way:
f = (x^2
+ 1)
and
f(x) = (x^2
+ 1)
both work in Sage.
-Keshav
----
Join us in #sagemath on irc.freenode.net !
--
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/sage-support
URL: http://www.sagemath.org