source: sage/misc/defaults.py @ 0:039f6310c6fe

Revision 0:039f6310c6fe, 1.3 KB checked in by tornaria@…, 7 years ago (diff)

[project @ original sage-0.10.12]

Line 
1"""
2Defaults
3
4AUTHORS: William Stein and David Kohel
5"""
6
7#*****************************************************************************
8#       Copyright (C) 2004 William Stein <wstein@ucsd.edu>
9#
10#  Distributed under the terms of the GNU General Public License (GPL)
11#
12#    This code is distributed in the hope that it will be useful,
13#    but WITHOUT ANY WARRANTY; without even the implied warranty of
14#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15#    General Public License for more details.
16#
17#  The full text of the GPL is available at:
18#
19#                  http://www.gnu.org/licenses/
20#*****************************************************************************
21
22# default variable name
23var_name = 'x'
24
25def variable_names(n, name=None):
26    if name is None: 
27        name = var_name
28    n = int(n)
29    if n == 1:
30        return [name]
31    return tuple(['%s_%s'%(name,i) for i in range(n)])
32
33def latex_variable_names(n, name=None):
34    if name is None: 
35        name = var_name
36    n = int(n)
37    if n == 1:
38        return [name]
39    return tuple(['%s_{%s}'%(name,i) for i in range(n)])
40
41def set_default_variable_name(name, separator='_'):
42    r"""
43    Change the default variable name and separator.
44    """
45    global var_name, var_sep
46    var_name = str(name)
47    var_sep = str(separator)
Note: See TracBrowser for help on using the repository browser.