Open in CoCalc

# Hur man finner information

Sage stödjer tabulatorkomplettering vilket innebär att man endast behöver skriva inledningen av t.ex. en funktion och trycka på tab så fyller Sage ut resten av funktionsnamnet. Om det finns flera funktioner som inleds med samma följd bokstäver visas en lista över dem.

## Manualer

SageMath - Help and Support finns ett stortt urval av manualer och liknande resurser som t.ex. Screencasts and Videos.

## Inbyggd hjälp

Förutom de manualer som du hittar på Sages officiella hemsida är varje funktion dokumenterad och tillgänglig med help eller ett frågetecken direkt efter funktionen.
gcd?

File: /projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/arith/misc.py
Signature : gcd(a, b=None, **kwds)
Docstring :
The greatest common divisor of a and b, or if a is a list and b is
omitted the greatest common divisor of all elements of a.

INPUT:

* "a,b" - two elements of a ring with gcd or

* "a" - a list or tuple of elements of a ring with gcd

Additional keyword arguments are passed to the respectively called
methods.

OUTPUT:

The given elements are first coerced into a common parent. Then,
their greatest common divisor *in that common parent* is returned.

EXAMPLES:

sage: GCD(97,100)
1
sage: GCD(97*10^15, 19^20*97^2)
97
sage: GCD(2/3, 4/5)
2/15
sage: GCD([2,4,6,8])
2
sage: GCD(srange(0,10000,10))  # fast  !!
10

Note that to take the gcd of n elements for n not= 2 you must put
the elements into a list by enclosing them in "[..]".  Before #4988
the following wrongly returned 3 since the third parameter was just
ignored:

sage: gcd(3,6,2)
Traceback (most recent call last):
...
TypeError: gcd() takes at most 2 arguments (3 given)
sage: gcd([3,6,2])
1

Similarly, giving just one element (which is not a list) gives an
error:

sage: gcd(3)
Traceback (most recent call last):
...
TypeError: 'sage.rings.integer.Integer' object is not iterable

By convention, the gcd of the empty list is (the integer) 0:

sage: gcd([])
0
sage: type(gcd([]))
<type 'sage.rings.integer.Integer'>

help(euler_phi)

Help on instance of Euler_Phi in module sage.arith.misc: class Euler_Phi | Return the value of the Euler phi function on the integer n. We | defined this to be the number of positive integers <= n that are | relatively prime to n. Thus if n<=0 then | euler_phi(n) is defined and equals 0. | | INPUT: | | | - n - an integer | | | EXAMPLES:: | | sage: euler_phi(1) | 1 | sage: euler_phi(2) | 1 | sage: euler_phi(3) | 2 | sage: euler_phi(12) | 4 | sage: euler_phi(37) | 36 | | Notice that euler_phi is defined to be 0 on negative numbers and | 0. | | :: | | sage: euler_phi(-1) | 0 | sage: euler_phi(0) | 0 | sage: type(euler_phi(0)) | <type 'sage.rings.integer.Integer'> | | We verify directly that the phi function is correct for 21. | | :: | | sage: euler_phi(21) | 12 | sage: [i for i in range(21) if gcd(21,i) == 1] | [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] | | The length of the list of integers 'i' in range(n) such that the | gcd(i,n) == 1 equals euler_phi(n). | | :: | | sage: len([i for i in range(21) if gcd(21,i) == 1]) == euler_phi(21) | True | | The phi function also has a special plotting method. | | :: | | sage: P = plot(euler_phi, -3, 71) | | AUTHORS: | | - William Stein | | - Alex Clemesha (2006-01-10): some examples | | Methods defined here: | | __call__(self, n) | Calls the euler_phi function. | | EXAMPLES:: | | sage: Euler_Phi()(10) | 4 | sage: Euler_Phi()(720) | 192 | | __repr__(self) | Returns a string describing this class. | | EXAMPLES:: | | sage: Euler_Phi().__repr__() | 'Number of positive integers <=n but relatively prime to n' | | plot(self, xmin=1, xmax=50, pointsize=30, rgbcolor=(0, 0, 1), join=True, **kwds) | Plot the Euler phi function. | | INPUT: | | | - xmin - default: 1 | | - xmax - default: 50 | | - pointsize - default: 30 | | - rgbcolor - default: (0,0,1) | | - join - default: True; whether to join the | points. | | - **kwds - passed on | | EXAMPLES:: | | sage: p = Euler_Phi().plot() | sage: p.ymax() | 46.0

## Fritextsökning i dokumentation för Sage

Med funktionen search_doc skapar man en hyperlänk till Google.
search_doc('find primitive root')

Use this link to search: find primitive root