# This file is built automatically; don't edit
this = 'is a code block'
x = 1 no = 'really!' p = argwhere(x == 2)
from pylab import linspace
t = linspace(0, 1) x = t**2
from pylab import *
x = logspace(0, 1) y = x**2 figure() plot(x, y) show()
Support for Python doctest code blocks:
1+1
2
for x in range(3):
print x
0 1 2
x = 1
x = 2
1+1
2
for x in range(3):
print x
0 1 2
Two sage commands without intermediate output get joined in a single input cell; no output is produced if none is specified:
1+1
2+2
3+3
1+1
1+1
> ```{.python .input}
> 1+1
> ```
A doubly nested sage code block
1+1
def plus_grand_element(liste):
"""
Renvoie le plus grand élément de la liste
EXAMPLES::
sage: plus_grand_element([7,3,1,10,4,10,2,9])
10
sage: plus_grand_element([7])
7
"""
resultat = liste[0]
for i in range(1, len(liste)-1):
# Invariant: resultat est le plus grand element de liste[:i]
assert resultat in liste[:i]
assert all(resultat >= x for x in liste[:i])
if liste[i] > resultat:
resultat = liste[i]
return resultat
plus_grand_element([7,3,1,10,4,10,2,9])
10
Foo (Failing).
Bla:
{.python
1+1
Don't forget the mandatory new line after \` ::\` ::
sage: 1+1
note
Blah (Failing):
{.python 1+1
Foo (Failing):
{.python 1+1
Note
Blah:
1+1
Foo:
1+1
:
sage: def fusion(l1, l2): ....: sort(l1+l2)
Inline maths with math role: $x^3+\frac{1+\sqrt{2}}{\pi}$
Inline maths with default role: $x^3+\frac{1+\sqrt{2}}{\pi}$
Inline maths using dollar signs (not supported yet): $x^3+frac{1+sqrt{2}}{pi}$
$$x^3+\frac{1+\sqrt{2}}{\pi}$$This is a quote!
A simple table:
C1 | C2 |
a | b |
c | d |
A table with more formatting:
C1 | C2 |
---|---|
a | b |
c | d |
Definition
Hello, this is a block definition
Some more text
**Note**
A nested topic within the enumeration within a topic
Back to the item