All published worksheets from http://sagenb.org
Image: ubuntu2004
File: /usr/local/sage2/local/lib/python2.6/site-packages/sage/functions/trig.py
Type: <class ‘sage.functions.trig.Function_sin’>
Definition: sin(*args, coerce=True, hold=False, dont_call_method_on_arg=False)
Docstring:
The sine function.
EXAMPLES:
sage: sin(0) 0 sage: sin(x).subs(x==0) 0 sage: sin(2).n(100) 0.90929742682568169539601986591 sage: loads(dumps(sin)) sin
File: /usr/local/sage2/local/lib/python2.6/site-packages/sage/combinat/combinat.py
Type: <type ‘function’>
Definition: fibonacci(n, algorithm=’pari’)
Docstring:
Returns the n-th Fibonacci number. The Fibonacci sequence F_n is defined by the initial conditions F_1=F_2=1 and the recurrence relation F_{n+2} = F_{n+1} + F_n. For negative n we define F_n = (-1)^{n+1}F_{-n}, which is consistent with the recurrence relation.
INPUT:
- algorithm - string:
- "pari" - (default) - use the PARI C library’s fibo function.
- "gap" - use GAP’s Fibonacci function
Note
PARI is tens to hundreds of times faster than GAP here; moreover, PARI works for every large input whereas GAP doesn’t.
EXAMPLES:
sage: fibonacci(10) 55 sage: fibonacci(10, algorithm='gap') 55sage: fibonacci(-100) -354224848179261915075 sage: fibonacci(100) 354224848179261915075sage: fibonacci(0) 0 sage: fibonacci(1/2) ... TypeError: no conversion of this rational to integer