rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
{'century':'Defined to be 100 years.\nEqual to 3153600000 seconds.', 'day':'Defined to be 24 hours.\nEqual to 86400 seconds.', 'decade':'Defined to be 10 years.\nEqual to 315360000 seconds.', 'fortnight':'Defined to be 2 weeks or 14 days.\nEqual to 1209600 seconds.', 'hour':'Defined to be 60 minutes.\nEqual to 3600 sec... | {'century':'Defined to be 100 years.\nEqual to 3153600000 seconds.', 'day':'Defined to be 24 hours.\nEqual to 86400 seconds.', 'decade':'Defined to be 10 years.\nEqual to 315360000 seconds.', 'fortnight':'Defined to be 2 weeks or 14 days.\nEqual to 1209600 seconds.', 'hour':'Defined to be 60 minutes.\nEqual to 3600 sec... | def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
{'bakers_dozen':'Defined to be 13 items.', 'dozen':'Defined to be 12 items.', 'gross':'Defined to be 144 items.', 'percent':'Defined to be 1/100 of a quantity.'}, | {'bakers_dozen':'Defined to be 13 items.', 'dozen':'Defined to be 12 items.', 'gross':'Defined to be 144 items.', 'percent':'Defined to be 1/100 of a quantity.'}, | def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
{'knot':'Nautical unit of velocity defined to be a nautical mile per hour.\nApproximately equal to 0.5144 meter/second.'}, | {'knot':'Nautical unit of velocity defined to be a nautical mile per hour.\nApproximately equal to 0.5144 meter/second.'}, | def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
{'poise':'CGS unit defined to be 1/10 of pascal*second.', 'reyn':'Defined to be a pound_force*second/inch^2.\nApproximately equal to 6894.76 pascal*second.'}, | {'poise':'CGS unit defined to be 1/10 of pascal*second.', 'reyn':'Defined to be a pound_force*second/inch^2.\nApproximately equal to 6894.76 pascal*second.'}, | def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
{'stokes':'CGS unit defined to be 1/10000 of meter^2/second.'}, | {'stokes':'CGS unit defined to be 1/10000 of meter^2/second.'}, | def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
{'rhes':'Defined to be 1/poise or 10/(pascal*second).'}, | {'rhes':'Defined to be 1/poise or 10/(pascal*second).'}, | def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
{'bag':'Defined to be 3 bushels.\nApproximately equal to 0.10572 cubic meters.', 'barrel':'Defined to be 42 gallons.\nApproximately equal to 0.15899 cubic meters.', 'board_foot':'Defined to be 144 cubic inches.\nApproximately equal to 0.0023597 cubic meters.', 'bucket':'Defined to be 4 gallons.\nApproximately equal to ... | {'bag':'Defined to be 3 bushels.\nApproximately equal to 0.10572 cubic meters.', 'barrel':'Defined to be 42 gallons.\nApproximately equal to 0.15899 cubic meters.', 'board_foot':'Defined to be 144 cubic inches.\nApproximately equal to 0.0023597 cubic meters.', 'bucket':'Defined to be 4 gallons.\nApproximately equal to ... | def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
'area':'length^2', 'capacitance':'time^4*current^2/(length^2*mass)', 'charge':'current*time', 'conductance':'current^2*time^3/(mass*length^2)', 'electric_potential':'mass*length^2/(current*time^3)', 'energy':'mass*length^2/time^2', 'fiber_linear_mass_density':'mass/length', 'force':'mass*length/time^2', 'frequency':'1/... | 'area':'length^2', 'capacitance':'time^4*current^2/(length^2*mass)', 'charge':'current*time', 'conductance':'current^2*time^3/(mass*length^2)', 'electric_potential':'mass*length^2/(current*time^3)', 'energy':'mass*length^2/time^2', 'fiber_linear_mass_density':'mass/length', 'force':'mass*length/time^2', 'frequency':'1/... | def evalunitdict(): """ Replace all the string values of the unitdict variable by their evaluated forms, and builds some other tables for ease of use. This function is mainly used internally, for efficiency (and flexibility) purposes, making it easier to describe the units. EXAMPLES:: sage: sage.symbolic.units.evalun... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
- `s` -- string | - `s` -- string | def vars_in_str(s): """ Given a string like 'mass/(length*time)', return the list ['mass', 'length', 'time']. INPUT: - `s` -- string OUTPUT: - list of strings (unit names) EXAMPLES:: sage: sage.symbolic.units.vars_in_str('mass/(length*time)') ['mass', 'length', 'time'] """ return re.findall('[a-z|_]+', s) | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
- list of strings (unit names) | - list of strings (unit names) | def vars_in_str(s): """ Given a string like 'mass/(length*time)', return the list ['mass', 'length', 'time']. INPUT: - `s` -- string OUTPUT: - list of strings (unit names) EXAMPLES:: sage: sage.symbolic.units.vars_in_str('mass/(length*time)') ['mass', 'length', 'time'] """ return re.findall('[a-z|_]+', s) | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.vars_in_str('mass/(length*time)') ['mass', 'length', 'time'] | sage: sage.symbolic.units.vars_in_str('mass/(length*time)') ['mass', 'length', 'time'] | def vars_in_str(s): """ Given a string like 'mass/(length*time)', return the list ['mass', 'length', 'time']. INPUT: - `s` -- string OUTPUT: - list of strings (unit names) EXAMPLES:: sage: sage.symbolic.units.vars_in_str('mass/(length*time)') ['mass', 'length', 'time'] """ return re.findall('[a-z|_]+', s) | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
- `v` -- string, name of a unit type such as 'area', 'volume', etc. | - `v` -- string, name of a unit type such as 'area', 'volume', etc. | def unit_derivations_expr(v): """ Given derived units name, returns the corresponding units expression. For example, given 'acceleration' output the symbolic expression length/time^2. INPUT: - `v` -- string, name of a unit type such as 'area', 'volume', etc. OUTPUT: - symbolic expression EXAMPLES:: sage: sage.sy... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
- symbolic expression | - symbolic expression | def unit_derivations_expr(v): """ Given derived units name, returns the corresponding units expression. For example, given 'acceleration' output the symbolic expression length/time^2. INPUT: - `v` -- string, name of a unit type such as 'area', 'volume', etc. OUTPUT: - symbolic expression EXAMPLES:: sage: sage.sy... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.unit_derivations_expr('volume') length^3 sage: sage.symbolic.units.unit_derivations_expr('electric_potential') length^2*mass/(current*time^3) | sage: sage.symbolic.units.unit_derivations_expr('volume') length^3 sage: sage.symbolic.units.unit_derivations_expr('electric_potential') length^2*mass/(current*time^3) | def unit_derivations_expr(v): """ Given derived units name, returns the corresponding units expression. For example, given 'acceleration' output the symbolic expression length/time^2. INPUT: - `v` -- string, name of a unit type such as 'area', 'volume', etc. OUTPUT: - symbolic expression EXAMPLES:: sage: sage.sy... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.unit_derivations_expr('invalid') Traceback (most recent call last): ... KeyError: 'invalid' | sage: sage.symbolic.units.unit_derivations_expr('invalid') Traceback (most recent call last): ... KeyError: 'invalid' | def unit_derivations_expr(v): """ Given derived units name, returns the corresponding units expression. For example, given 'acceleration' output the symbolic expression length/time^2. INPUT: - `v` -- string, name of a unit type such as 'area', 'volume', etc. OUTPUT: - symbolic expression EXAMPLES:: sage: sage.sy... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
d = dict([(x,str_to_unit(x)) for x in vars_in_str(Z)]) from sage.misc.all import sage_eval Z = sage_eval(Z, d) unit_derivations[v] = Z | d = dict([(x,str_to_unit(x)) for x in vars_in_str(Z)]) from sage.misc.all import sage_eval Z = sage_eval(Z, d) unit_derivations[v] = Z | def unit_derivations_expr(v): """ Given derived units name, returns the corresponding units expression. For example, given 'acceleration' output the symbolic expression length/time^2. INPUT: - `v` -- string, name of a unit type such as 'area', 'volume', etc. OUTPUT: - symbolic expression EXAMPLES:: sage: sage.sy... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: acre = units.area.acre sage: type(acre) <class 'sage.symbolic.units.UnitExpression'> | sage: acre = units.area.acre sage: type(acre) <class 'sage.symbolic.units.UnitExpression'> | def unit_derivations_expr(v): """ Given derived units name, returns the corresponding units expression. For example, given 'acceleration' output the symbolic expression length/time^2. INPUT: - `v` -- string, name of a unit type such as 'area', 'volume', etc. OUTPUT: - symbolic expression EXAMPLES:: sage: sage.sy... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: bool(loads(dumps(acre)) == acre) True sage: type(loads(dumps(acre))) <class 'sage.symbolic.units.UnitExpression'> | sage: bool(loads(dumps(acre)) == acre) True sage: type(loads(dumps(acre))) <class 'sage.symbolic.units.UnitExpression'> | def unit_derivations_expr(v): """ Given derived units name, returns the corresponding units expression. For example, given 'acceleration' output the symbolic expression length/time^2. INPUT: - `v` -- string, name of a unit type such as 'area', 'volume', etc. OUTPUT: - symbolic expression EXAMPLES:: sage: sage.sy... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
""" Return docstring for this unit. EXAMPLES:: sage: print units.area.acre._sage_doc_() Defined to be 10 square chains or 4840 square yards. Approximately equal to 4046.856 square meters. """ return unitdocs(self) | """ Return docstring for this unit. EXAMPLES:: sage: print units.area.acre._sage_doc_() Defined to be 10 square chains or 4840 square yards. Approximately equal to 4046.856 square meters. """ return unitdocs(self) | def _sage_doc_(self): | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
- ``name`` -- string | - ``name`` -- string | def str_to_unit(name): """ Create the symbolic unit with given name. A symbolic unit is a class that derives from symbolic expression, and has a specialized docstring. INPUT: - ``name`` -- string OUTPUT: - UnitExpression EXAMPLES:: sage: sage.symbolic.units.str_to_unit('acre') acre sage: type(sage.symbolic.units... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
- UnitExpression | - UnitExpression | def str_to_unit(name): """ Create the symbolic unit with given name. A symbolic unit is a class that derives from symbolic expression, and has a specialized docstring. INPUT: - ``name`` -- string OUTPUT: - UnitExpression EXAMPLES:: sage: sage.symbolic.units.str_to_unit('acre') acre sage: type(sage.symbolic.units... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.str_to_unit('acre') acre sage: type(sage.symbolic.units.str_to_unit('acre')) <class 'sage.symbolic.units.UnitExpression'> | sage: sage.symbolic.units.str_to_unit('acre') acre sage: type(sage.symbolic.units.str_to_unit('acre')) <class 'sage.symbolic.units.UnitExpression'> | def str_to_unit(name): """ Create the symbolic unit with given name. A symbolic unit is a class that derives from symbolic expression, and has a specialized docstring. INPUT: - ``name`` -- string OUTPUT: - UnitExpression EXAMPLES:: sage: sage.symbolic.units.str_to_unit('acre') acre sage: type(sage.symbolic.units... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
EXAMPLES:: sage: units.power Collection power of units: cheval_vapeur horsepower watt | EXAMPLES:: sage: units.power Collection power of units: cheval_vapeur horsepower watt | def str_to_unit(name): """ Create the symbolic unit with given name. A symbolic unit is a class that derives from symbolic expression, and has a specialized docstring. INPUT: - ``name`` -- string OUTPUT: - UnitExpression EXAMPLES:: sage: sage.symbolic.units.str_to_unit('acre') acre sage: type(sage.symbolic.units... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
""" EXAMPLES:: sage: sage.symbolic.units.Units(sage.symbolic.units.unitdict, 'all units') Collection all units of units: acceleration ... volume """ self.__name = name self.__data = data self.__units = {} | """ EXAMPLES:: sage: sage.symbolic.units.Units(sage.symbolic.units.unitdict, 'all units') Collection all units of units: acceleration ... volume """ self.__name = name self.__data = data self.__units = {} | def __init__(self, data, name=''): | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
""" Used for pickling. We throw away all cached information. EXAMPLES:: sage: type(units.__getstate__()[0]) <type 'str'> sage: type(units.__getstate__()[1]) <type 'dict'> sage: loads(dumps(units)) == units True sage: loads(dumps(units.area)) == units.area True sage: bool(loads(dumps(units.area.acre)) == units.area.... | """ Used for pickling. We throw away all cached information. EXAMPLES:: sage: type(units.__getstate__()[0]) <type 'str'> sage: type(units.__getstate__()[1]) <type 'dict'> sage: loads(dumps(units)) == units True sage: loads(dumps(units.area)) == units.area True sage: bool(loads(dumps(units.area.acre)) == units.area.... | def __getstate__(self): | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
""" Used for unpickling. See __getstate__. EXAMPLES:: sage: state = units.__getstate__() sage: units.__setstate__(state) """ self.__name = state[0] self.__data = state[1] self.__units = {} | """ Used for unpickling. See __getstate__. EXAMPLES:: sage: state = units.__getstate__() sage: units.__setstate__(state) """ self.__name = state[0] self.__data = state[1] self.__units = {} | def __setstate__(self, state): | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
""" Compare two collections of units, or a collection of units with some other object. EXAMPLES:: sage: units.length == 10 False sage: units.length == units.length True sage: units.length == units.mass False """ if not isinstance(other, Units): return cmp(type(self), type(other)) return cmp((self.__name, self.__data)... | """ Compare two collections of units, or a collection of units with some other object. EXAMPLES:: sage: units.length == 10 False sage: units.length == units.length True sage: units.length == units.mass False """ if not isinstance(other, Units): return cmp(type(self), type(other)) return cmp((self.__name, self.__data)... | def __cmp__(self, other): | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
""" Return completions of this unit objects. This is used by the Sage command line and notebook to create the list of method names. EXAMPLES:: sage: units.area.trait_names() ['acre', 'are', 'barn', 'hectare', 'rood', 'section', 'square_chain', 'square_meter', 'township'] """ return sorted([x for x in self.__data.key... | """ Return completions of this unit objects. This is used by the Sage command line and notebook to create the list of method names. EXAMPLES:: sage: units.area.trait_names() ['acre', 'are', 'barn', 'hectare', 'rood', 'section', 'square_chain', 'square_meter', 'township'] """ return sorted([x for x in self.__data.key... | def trait_names(self): | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
""" Return the unit with the given name. EXAMPLES:: sage: units.area Collection area of units: acre are barn hectare rood section square_chain square_meter township sage: units.area.barn barn Units are cached:: sage: units.area.acre is units.area.acre True """ if self.__units.has_key(name): return self.__units[nam... | """ Return the unit with the given name. EXAMPLES:: sage: units.area Collection area of units: acre are barn hectare rood section square_chain square_meter township sage: units.area.barn barn Units are cached:: sage: units.area.acre is units.area.acre True """ if self.__units.has_key(name): return self.__units[nam... | def __getattr__(self, name): | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
""" Return string representation of this collection of units. EXAMPLES:: sage: units.__repr__() 'Collection of units: acceleration ... volume' sage: units.area.__repr__() 'Collection area of units: acre are barn hectare rood section square_chain square_meter township' """ name = self.__name + ' ' if self.__name else ... | """ Return string representation of this collection of units. EXAMPLES:: sage: units.__repr__() 'Collection of units: acceleration ... volume' sage: units.area.__repr__() 'Collection area of units: acre are barn hectare rood section square_chain square_meter township' """ name = self.__name + ' ' if self.__name else ... | def __repr__(self): | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.unitdocs('meter') 'SI base unit of length.\nDefined to be the distance light travels in vacuum in 1/299792458 of a second.' sage: sage.symbolic.units.unitdocs('amu') 'Abbreviation for atomic mass unit.\nApproximately equal to 1.660538782*10^-27 kilograms.' | sage: sage.symbolic.units.unitdocs('meter') 'SI base unit of length.\nDefined to be the distance light travels in vacuum in 1/299792458 of a second.' sage: sage.symbolic.units.unitdocs('amu') 'Abbreviation for atomic mass unit.\nApproximately equal to 1.660538782*10^-27 kilograms.' | def unitdocs(unit): """ Returns docstring for the given unit. INPUT: - ``unit`` OUTPUT: - ``string`` EXAMPLES:: sage: sage.symbolic.units.unitdocs('meter') 'SI base unit of length.\nDefined to be the distance light travels in vacuum in 1/299792458 of a second.' sage: sage.symbolic.units.unitdocs('amu') 'Abbreviat... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.unitdocs('earth') Traceback (most recent call last): ... ValueError: No documentation exists for the unit earth. | sage: sage.symbolic.units.unitdocs('earth') Traceback (most recent call last): ... ValueError: No documentation exists for the unit earth. | def unitdocs(unit): """ Returns docstring for the given unit. INPUT: - ``unit`` OUTPUT: - ``string`` EXAMPLES:: sage: sage.symbolic.units.unitdocs('meter') 'SI base unit of length.\nDefined to be the distance light travels in vacuum in 1/299792458 of a second.' sage: sage.symbolic.units.unitdocs('amu') 'Abbreviat... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
return unit_docs[unit_to_type[str(unit)]+"_docs"][str(unit)] | return unit_docs[unit_to_type[str(unit)]+"_docs"][str(unit)] | def unitdocs(unit): """ Returns docstring for the given unit. INPUT: - ``unit`` OUTPUT: - ``string`` EXAMPLES:: sage: sage.symbolic.units.unitdocs('meter') 'SI base unit of length.\nDefined to be the distance light travels in vacuum in 1/299792458 of a second.' sage: sage.symbolic.units.unitdocs('amu') 'Abbreviat... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
raise ValueError, "No documentation exists for the unit %s."%unit | raise ValueError, "No documentation exists for the unit %s."%unit | def unitdocs(unit): """ Returns docstring for the given unit. INPUT: - ``unit`` OUTPUT: - ``string`` EXAMPLES:: sage: sage.symbolic.units.unitdocs('meter') 'SI base unit of length.\nDefined to be the distance light travels in vacuum in 1/299792458 of a second.' sage: sage.symbolic.units.unitdocs('amu') 'Abbreviat... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
- `s` -- an object | - `s` -- an object | def is_unit(s): """ Returns a boolean when asked whether the input is in the list of units. INPUT: - `s` -- an object OUTPUT: - ``bool`` EXAMPLES:: sage: sage.symbolic.units.is_unit(1) False sage: sage.symbolic.units.is_unit(units.length.meter) True The square of a unit is not a unit:: sage: sage.symbolic.units... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
- ``bool`` | - ``bool`` | def is_unit(s): """ Returns a boolean when asked whether the input is in the list of units. INPUT: - `s` -- an object OUTPUT: - ``bool`` EXAMPLES:: sage: sage.symbolic.units.is_unit(1) False sage: sage.symbolic.units.is_unit(units.length.meter) True The square of a unit is not a unit:: sage: sage.symbolic.units... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.is_unit(1) False sage: sage.symbolic.units.is_unit(units.length.meter) True | sage: sage.symbolic.units.is_unit(1) False sage: sage.symbolic.units.is_unit(units.length.meter) True | def is_unit(s): """ Returns a boolean when asked whether the input is in the list of units. INPUT: - `s` -- an object OUTPUT: - ``bool`` EXAMPLES:: sage: sage.symbolic.units.is_unit(1) False sage: sage.symbolic.units.is_unit(units.length.meter) True The square of a unit is not a unit:: sage: sage.symbolic.units... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.is_unit(units.length.meter^2) False | sage: sage.symbolic.units.is_unit(units.length.meter^2) False | def is_unit(s): """ Returns a boolean when asked whether the input is in the list of units. INPUT: - `s` -- an object OUTPUT: - ``bool`` EXAMPLES:: sage: sage.symbolic.units.is_unit(1) False sage: sage.symbolic.units.is_unit(units.length.meter) True The square of a unit is not a unit:: sage: sage.symbolic.units... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.is_unit(var('meter')) True | sage: sage.symbolic.units.is_unit(var('meter')) True | def is_unit(s): """ Returns a boolean when asked whether the input is in the list of units. INPUT: - `s` -- an object OUTPUT: - ``bool`` EXAMPLES:: sage: sage.symbolic.units.is_unit(1) False sage: sage.symbolic.units.is_unit(units.length.meter) True The square of a unit is not a unit:: sage: sage.symbolic.units... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
- `expr` -- the symbolic expression converting from - `target` -- (default None) the symbolic expression converting to | - `expr` -- the symbolic expression converting from - `target` -- (default None) the symbolic expression converting to | def convert(expr, target): """ Converts units between expr and target. If target is None then converts to SI base units. INPUT: - `expr` -- the symbolic expression converting from - `target` -- (default None) the symbolic expression converting to OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.uni... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.convert(units.length.foot, None) 381/1250*meter sage: sage.symbolic.units.convert(units.mass.kilogram, units.mass.pound) 100000000/45359237*pound | sage: sage.symbolic.units.convert(units.length.foot, None) 381/1250*meter sage: sage.symbolic.units.convert(units.mass.kilogram, units.mass.pound) 100000000/45359237*pound | def convert(expr, target): """ Converts units between expr and target. If target is None then converts to SI base units. INPUT: - `expr` -- the symbolic expression converting from - `target` -- (default None) the symbolic expression converting to OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.uni... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.convert(units.mass.kilogram, units.length.foot) Traceback (most recent call last): ... ValueError: Incompatible units sage: sage.symbolic.units.convert(units.length.meter^2, units.length.foot) Traceback (most recent call last): ... ValueError: Incompatible units | sage: sage.symbolic.units.convert(units.mass.kilogram, units.length.foot) Traceback (most recent call last): ... ValueError: Incompatible units sage: sage.symbolic.units.convert(units.length.meter^2, units.length.foot) Traceback (most recent call last): ... ValueError: Incompatible units | def convert(expr, target): """ Converts units between expr and target. If target is None then converts to SI base units. INPUT: - `expr` -- the symbolic expression converting from - `target` -- (default None) the symbolic expression converting to OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.uni... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.convert(units.length.foot/units.time.second^2, units.acceleration.galileo) 762/25*galileo sage: sage.symbolic.units.convert(units.mass.kilogram*units.length.meter/units.time.second^2, units.force.newton) newton sage: sage.symbolic.units.convert(units.length.foot^3, units.area.acre*units.length... | sage: sage.symbolic.units.convert(units.length.foot/units.time.second^2, units.acceleration.galileo) 762/25*galileo sage: sage.symbolic.units.convert(units.mass.kilogram*units.length.meter/units.time.second^2, units.force.newton) newton sage: sage.symbolic.units.convert(units.length.foot^3, units.area.acre*units.length... | def convert(expr, target): """ Converts units between expr and target. If target is None then converts to SI base units. INPUT: - `expr` -- the symbolic expression converting from - `target` -- (default None) the symbolic expression converting to OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.uni... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.convert(units.pressure.pascal*units.si_prefixes.kilo, units.pressure.pounds_per_square_inch)*1.0 0.145037737730209*pounds_per_square_inch | sage: sage.symbolic.units.convert(units.pressure.pascal*units.si_prefixes.kilo, units.pressure.pounds_per_square_inch)*1.0 0.145037737730209*pounds_per_square_inch | def convert(expr, target): """ Converts units between expr and target. If target is None then converts to SI base units. INPUT: - `expr` -- the symbolic expression converting from - `target` -- (default None) the symbolic expression converting to OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.uni... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
if is_unit(x): if unit_to_type[str(x)] == 'temperature': return convert_temperature(expr, target) else: z[x] = base_units(x) | if is_unit(x): if unit_to_type[str(x)] == 'temperature': return convert_temperature(expr, target) else: z[x] = base_units(x) | def convert(expr, target): """ Converts units between expr and target. If target is None then converts to SI base units. INPUT: - `expr` -- the symbolic expression converting from - `target` -- (default None) the symbolic expression converting to OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.uni... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
return expr | return expr | def convert(expr, target): """ Converts units between expr and target. If target is None then converts to SI base units. INPUT: - `expr` -- the symbolic expression converting from - `target` -- (default None) the symbolic expression converting to OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.uni... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
for y in base_target.variables(): if is_unit(y): tz[y] = base_units(y) base_target = base_target.subs(tz) coeff = (expr/base_target).expand() if len(coeff.variables()) != 0: raise ValueError, "Incompatible units" return coeff*target | for y in base_target.variables(): if is_unit(y): tz[y] = base_units(y) base_target = base_target.subs(tz) coeff = (expr/base_target).expand() if len(coeff.variables()) != 0: raise ValueError, "Incompatible units" return coeff*target | def convert(expr, target): """ Converts units between expr and target. If target is None then converts to SI base units. INPUT: - `expr` -- the symbolic expression converting from - `target` -- (default None) the symbolic expression converting to OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.uni... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
- ``unit`` | - ``unit`` | def base_units(unit): """ Converts unit to base SI units. INPUT: - ``unit`` OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.units.base_units(units.length.foot) 381/1250*meter If unit is already a base unit, it just returns that unit:: sage: sage.symbolic.units.base_units(units.length.meter) meter... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
- `symbolic expression` | - `symbolic expression` | def base_units(unit): """ Converts unit to base SI units. INPUT: - ``unit`` OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.units.base_units(units.length.foot) 381/1250*meter If unit is already a base unit, it just returns that unit:: sage: sage.symbolic.units.base_units(units.length.meter) meter... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.base_units(units.length.foot) 381/1250*meter | sage: sage.symbolic.units.base_units(units.length.foot) 381/1250*meter | def base_units(unit): """ Converts unit to base SI units. INPUT: - ``unit`` OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.units.base_units(units.length.foot) 381/1250*meter If unit is already a base unit, it just returns that unit:: sage: sage.symbolic.units.base_units(units.length.meter) meter... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.base_units(units.length.meter) meter | sage: sage.symbolic.units.base_units(units.length.meter) meter | def base_units(unit): """ Converts unit to base SI units. INPUT: - ``unit`` OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.units.base_units(units.length.foot) 381/1250*meter If unit is already a base unit, it just returns that unit:: sage: sage.symbolic.units.base_units(units.length.meter) meter... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.base_units(units.force.newton) kilogram*meter/second^2 sage: sage.symbolic.units.base_units(units.volume.liter) 1/1000*meter^3 | sage: sage.symbolic.units.base_units(units.force.newton) kilogram*meter/second^2 sage: sage.symbolic.units.base_units(units.volume.liter) 1/1000*meter^3 | def base_units(unit): """ Converts unit to base SI units. INPUT: - ``unit`` OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.units.base_units(units.length.foot) 381/1250*meter If unit is already a base unit, it just returns that unit:: sage: sage.symbolic.units.base_units(units.length.meter) meter... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
sage: sage.symbolic.units.base_units(var('x')) x | sage: sage.symbolic.units.base_units(var('x')) x | def base_units(unit): """ Converts unit to base SI units. INPUT: - ``unit`` OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.units.base_units(units.length.foot) 381/1250*meter If unit is already a base unit, it just returns that unit:: sage: sage.symbolic.units.base_units(units.length.meter) meter... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
return unit | return unit | def base_units(unit): """ Converts unit to base SI units. INPUT: - ``unit`` OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.units.base_units(units.length.foot) 381/1250*meter If unit is already a base unit, it just returns that unit:: sage: sage.symbolic.units.base_units(units.length.meter) meter... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
return sage_eval(unitdict[unit_to_type[str(unit)]][str(unit)]) | return sage_eval(unitdict[unit_to_type[str(unit)]][str(unit)]) | def base_units(unit): """ Converts unit to base SI units. INPUT: - ``unit`` OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.units.base_units(units.length.foot) 381/1250*meter If unit is already a base unit, it just returns that unit:: sage: sage.symbolic.units.base_units(units.length.meter) meter... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
v = SR.var(unit_to_type[str(unit)]) if unit_derivations.has_key(str(v)): base = unit_derivations_expr(v) for i in base.variables(): base = base.subs({i:SR.var(value_to_unit[str(i)]['1'])}) return base*sage_eval(unitdict[str(v)][str(unit)]) else: base = SR.var(value_to_unit[str(v)]['1'])*sage_eval(unitdict[str(v)][str(u... | v = SR.var(unit_to_type[str(unit)]) if unit_derivations.has_key(str(v)): base = unit_derivations_expr(v) for i in base.variables(): base = base.subs({i:SR.var(value_to_unit[str(i)]['1'])}) return base*sage_eval(unitdict[str(v)][str(unit)]) else: base = SR.var(value_to_unit[str(v)]['1'])*sage_eval(unitdict[str(v)][str(u... | def base_units(unit): """ Converts unit to base SI units. INPUT: - ``unit`` OUTPUT: - `symbolic expression` EXAMPLES:: sage: sage.symbolic.units.base_units(units.length.foot) 381/1250*meter If unit is already a base unit, it just returns that unit:: sage: sage.symbolic.units.base_units(units.length.meter) meter... | 04717bf1b9b9ac138edf5b9001954a2a12d3790d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/04717bf1b9b9ac138edf5b9001954a2a12d3790d/units.py |
def CharacteristicSturmianWord(self, cf, alphabet=(0, 1), bits=None): r""" Returns the characteristic Sturmian word of the given slope ``cf``. The `n`-th term of the characteristic Sturmian word of an irrational slope `\alpha` is `\lfloor\alpha(n+1)\rfloor - \lfloor\alpha n\rfloor + \lfloor\alpha\rfloor`. [1] | def CharacteristicSturmianWord(self, slope, alphabet=(0, 1), bits=None): r""" Returns the characteristic Sturmian word (also called standard Sturmian word) of given slope. Over a binary alphabet `\{a,b\}`, the characteristic Sturmian word `c_\alpha` of slope `\alpha` is the infinite word satisfying `s_{\alpha,0} = ac_... | def CharacteristicSturmianWord(self, cf, alphabet=(0, 1), bits=None): r""" Returns the characteristic Sturmian word of the given slope ``cf``. | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
- ``cf`` - the slope of the word. It can be one of the following : | - ``slope`` - the slope of the word. It can be one of the following : | def CharacteristicSturmianWord(self, cf, alphabet=(0, 1), bits=None): r""" Returns the characteristic Sturmian word of the given slope ``cf``. | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
- ``bits`` - integer (optional and considered only if ``cf`` is a real number) the number of bits to consider when computing the | - ``bits`` - integer (optional and considered only if ``slope`` is a real number) the number of bits to consider when computing the | def CharacteristicSturmianWord(self, cf, alphabet=(0, 1), bits=None): r""" Returns the characteristic Sturmian word of the given slope ``cf``. | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
slope `\alpha` is the limit of the sequence: `s_0 = 1`, `s_1 = 0` | slope `\alpha` is the limit of the sequence: `s_0 = b`, `s_1 = a` | def CharacteristicSturmianWord(self, cf, alphabet=(0, 1), bits=None): r""" Returns the characteristic Sturmian word of the given slope ``cf``. | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
The characteristic sturmian word of slope `(\sqrt(3)-1)/2`:: | The characteristic sturmian word of slope `(\sqrt{3}-1)/2`:: | sage: def cf(): | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
`(\sqrt(3)-1)/2`:: | `(\sqrt{3}-1)/2`:: | sage: def cf(): | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
sturmian word of slope `(\sqrt(3)-1)/2`:: | sturmian word of slope `(\sqrt{3}-1)/2`:: | sage: def cf(): | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
NotImplementedError: The argument cf (=5/4) must be in ]0,1[. | ValueError: The argument slope (=5/4) must be in ]0,1[. | sage: def cf(): | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
if cf in RR: if not 0 < cf < 1: msg = "The argument cf (=%s) must be in ]0,1[."%cf raise NotImplementedError, msg | if slope in RR: if not 0 < slope < 1: msg = "The argument slope (=%s) must be in ]0,1[."%slope raise ValueError, msg | sage: def cf(): | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
cf = iter(CFF(cf, bits=bits)) | cf = iter(CFF(slope, bits=bits)) | sage: def cf(): | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
elif hasattr(cf, '__iter__'): cf = iter(cf) | elif hasattr(slope, '__iter__'): cf = iter(slope) | sage: def cf(): | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
raise TypeError("cf (=%s) must be a real number"%cf + | raise TypeError("slope (=%s) must be a real number"%slope + | sage: def cf(): | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
Returns the lower mechanical word. The word `s_{\alpha,\rho}` is the *lower mechanical word* with slope `\alpha` and intercept `\rho` defined by | Returns the lower mechanical word with slope `\alpha` and intercept `\rho` The lower mechanical word `s_{\alpha,\rho}` with slope `\alpha` and intercept `\rho` is defined by | def LowerMechanicalWord(self, alpha, rho=0, alphabet=None): r""" Returns the lower mechanical word. | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
\lfloor\alpha n + \rho\rfloor`. [1] | \lfloor\alpha n + \rho\rfloor` [1]. | def LowerMechanicalWord(self, alpha, rho=0, alphabet=None): r""" Returns the lower mechanical word. | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
raise NotImplementedError, msg | raise ValueError, msg | def LowerMechanicalWord(self, alpha, rho=0, alphabet=None): r""" Returns the lower mechanical word. | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
Returns the upper mechanical word. The word `s'_{\alpha,\rho}` is the *upper mechanical word* with slope `\alpha` and intercept `\rho` defined by | Returns the upper mechanical word with slope `\alpha` and intercept `\rho` The upper mechanical word `s'_{\alpha,\rho}` with slope `\alpha` and intercept `\rho` is defined by | def UpperMechanicalWord(self, alpha, rho=0, alphabet=None): r""" Returns the upper mechanical word. | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
raise NotImplementedError, msg | raise ValueError, msg | def UpperMechanicalWord(self, alpha, rho=0, alphabet=None): r""" Returns the upper mechanical word. | 84c9b810c2ff0413ad303dbed17d39757703c31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/84c9b810c2ff0413ad303dbed17d39757703c31f/word_generators.py |
def induced_subgraph_search(self, G): | def subgraph_search(self, G, induced=False): | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
Returns an induced copy of `G` in self. | Returns a copy of ``G`` in ``self``. | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
- ``G`` -- the graph whose copy we are looking for in ``self`` | - ``G`` -- the graph whose copy we are looking for in ``self``. - ``induced`` -- boolean (default: ``False``). Whether or not to search for an induced copy of ``G`` in ``self``. OUTPUT: - If ``induced=False``, return a copy of ``G`` in this graph. Otherwise, return an induced copy of ``G`` in ``self``. If ``G`` is t... | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
Brute-force | Brute-force search. | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
A Petersen Graph contains a `P_5` :: | The Petersen graph contains the path graph `P_5`:: | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
sage: h1 = g.induced_subgraph_search(graphs.PathGraph(5)) sage: h1 | sage: h1 = g.subgraph_search(graphs.PathGraph(5)); h1 | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
It also contains a Claw (`K_{1,3}`):: sage: h2 = g.induced_subgraph_search(graphs.ClawGraph()) sage: h2 | It also contains the claw `K_{1,3}`:: sage: h2 = g.subgraph_search(graphs.ClawGraph()); h2 | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
Of course both copies are isomorphic to the graphs we were looking for :: sage: h1.is_isomorphic(graphs.PathGraph(5)) | sage: I2 = g.subgraph_search(graphs.ClawGraph(), induced=True); I2 Subgraph of (Petersen graph): Graph on 4 vertices sage: I2.vertices() [0, 1, 4, 5] Of course the induced copies are isomorphic to the graphs we were looking for:: sage: I1.is_isomorphic(graphs.PathGraph(5)) | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
sage: h2.is_isomorphic(graphs.ClawGraph()) | sage: I2.is_isomorphic(graphs.ClawGraph()) | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
However, as it contains no induced subgraphs isomorphic to `P_6`, an exception is raised in this case :: sage: g.induced_subgraph_search(graphs.PathGraph(6)) Traceback (most recent call last): ... ValueError: No induced copy of the graph exists | However, the Petersen graph does not contain a subgraph isomorphic to `K_3`:: sage: g.subgraph_search(graphs.CompleteGraph(3)) is None True Nor does it contain a nonempty induced subgraph isomorphic to `P_6`:: sage: g.subgraph_search(graphs.PathGraph(6), induced=True) is None True The empty graph is a subgraph of e... | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
H = subgraph_search(self, G, induced = True) | from sage.graphs.graph_generators import GraphGenerators if G.order() == 0: return GraphGenerators().EmptyGraph() H = subgraph_search(self, G, induced=induced) | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
raise ValueError('No induced copy of the graph exists') return self.subgraph(H) def subgraph_search(self, G): r""" Returns an of `G` included in self. INPUT: - ``G`` -- the graph whose copy we are looking for in ``self`` ALGORITHM: Brute-force EXAMPLES: A Petersen Graph contains a `P_5` :: sage: g = graphs.Pet... | return None | def induced_subgraph_search(self, G): r""" Returns an induced copy of `G` in self. | 8df00654035f400e2bfe288bcd227f8eb0525ff2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8df00654035f400e2bfe288bcd227f8eb0525ff2/generic_graph.py |
xy_data_arrays = map(lambda g: [[g(x, y) for x in xsrange(*ranges[0], include_endpoint=True)] for y in xsrange(*ranges[1], include_endpoint=True)], g) xy_data_array = map(lambda *rows: map(lambda *vals: mangle_neg(vals), *rows), *xy_data_arrays) | xy_data_arrays = numpy.asarray([[[func(x, y) for x in xsrange(*ranges[0], include_endpoint=True)] for y in xsrange(*ranges[1], include_endpoint=True)] for func in g],dtype=float) xy_data_array=numpy.abs(xy_data_arrays.prod(axis=0)) neg_indices = (xy_data_arrays<0).all(axis=0) xy_data_array[neg_indices]=-xy_data_array... | def region_plot(f, xrange, yrange, plot_points, incol, outcol, bordercol, borderstyle, borderwidth): r""" ``region_plot`` takes a boolean function of two variables, `f(x,y)` and plots the region where f is True over the specified ``xrange`` and ``yrange`` as demonstrated below. ``region_plot(f, (xmin, xmax), (ymin, ym... | 74c5cab11c38d207f9706bcaeba8f6b2cdf5d3b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/74c5cab11c38d207f9706bcaeba8f6b2cdf5d3b7/contour_plot.py |
def mangle_neg(vals): """ Returns the product of all values in vals, with the result nonnegative if any of the values is nonnegative. EXAMPLES:: sage: from sage.plot.contour_plot import mangle_neg sage: mangle_neg([-1.2, -0.74, -2.56, -1.01]) -2.29601280000000 sage: mangle_neg([-1.2, 0.0, -2.56]) 0.000000000000000 s... | def equify(f): """ Returns the equation rewritten as a symbolic function to give negative values when True, positive when False. EXAMPLES:: sage: from sage.plot.contour_plot import equify sage: var('x, y') (x, y) sage: equify(x^2 < 2) x^2 - 2 sage: equify(x^2 > 2) -x^2 + 2 sage: equify(x*y > 1) -x*y + 1 sage: equify(... | 74c5cab11c38d207f9706bcaeba8f6b2cdf5d3b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/74c5cab11c38d207f9706bcaeba8f6b2cdf5d3b7/contour_plot.py | |
return CRT_list(vec,mod) | return tuple(CRT_vectors(vec,mod)) | def basiclemmavec(self,M): """ Finds a vector where the value of the quadratic form is coprime to M. EXAMPLES: sage: Q = QuadraticForm(ZZ, 2, [2, 1, 5]) sage: Q.basiclemmavec(10) (6, 5) sage: Q(_) 227 """ V=FreeModule(self.base_ring(),self.dim()) mat = self.matrix() vec = [] mod = [] M0 = abs(M) if M0 == 1: return V(... | 8160c8c5a53f8bf4689397ad65346da436a91ec8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/8160c8c5a53f8bf4689397ad65346da436a91ec8/quadratic_form__ternary_Tornaria.py |
self._option["pdflatex"] = False | self._option["engine"] = "latex" self._option["engine_name"] = "LaTeX" | def __init__(self, bb=False, delimiters=["(", ")"]): """ Define an object that holds LaTeX global preferences. """ self._option = {} self._option["blackboard_bold"] = bb self._option["matrix_delimiters"] = list(delimiters) self._option["vector_delimiters"] = list(delimiters) self._option["macros"] = "" self._option["pr... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): | def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_in_background=False): | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
"filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't convert the dvi file to png (because of postscript specials or other issues), then dvips is called, and the PS file is converted to a png file. | "filename.dvi" (or "filename.pdf"` if engine is either ``pdflatex`` or ``xelatex'') and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't convert the dvi file to png (because of postscript specials or other issues), then dvips is called, and the PS file is converted to a png file. | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
- ``pdflatex`` - bool (optional, default False): whether to use pdflatex. | - ``engine`` - string: latex engine to use. | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
``pdflatex`` is False, then a dvi file is created, but if there | engine is latex or None, then a dvi file is created, but if there | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
returned.) If ``pdflatex`` is True and there are no errors, then | returned.) If engine is pdflatex or xelatex and there are no errors, then | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
pdflatex, you must have 'convert' installed. | pdflatex or xelatex, you must have 'convert' installed. | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] if not pdflatex and not have_latex(): | if engine is None: engine = _Latex_prefs._option["engine"] if not engine and not have_latex(): | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
if pdflatex and not have_pdflatex(): print "Error: PDFLaTeX does not seem to be installed. Download it from" | if engine and not have_pdflatex() and not have_xelatex(): print "Error: %s does not seem to be installed. Download it from" % _Latex_prefs._option["engine_name"] | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
if not pdflatex and not (have_dvipng() or have_convert()): | if (not engine or engine == "latex") and not (have_dvipng() or have_convert()): | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
print "appear to be installed. Displaying LaTeX or PDFLaTeX output" | print "appear to be installed. Displaying LaTeX, PDFLaTeX output" | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
elif pdflatex and not have_convert(): | elif engine == "pdflatex" and not have_convert(): | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't conve... | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.