source: pyromaths/trunk/fuentes/src/pyromaths/outils/Conversions.py @ 423

Last change on this file since 423 was 423, checked in by mabarracus, 4 years ago

add sources from pyromaths 15.10

File size: 1.6 KB
Line 
1#!/usr/bin/python
2# -*- coding: utf-8 -*-
3#
4# Pyromaths
5# Un programme en Python qui permet de créer des fiches d'exercices types de
6# mathématiques niveau collège ainsi que leur corrigé en LaTeX.
7# Copyright (C) 2006 -- Jérôme Ortais (jerome.ortais@pyromaths.org)
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 2 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
21# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
23import math
24
25def radians(alpha):
26    """**radians**\ (*alpha*)
27
28    Convertit un angle donné en degrés en radians
29
30    :param alpha: angle en degrés
31    :type alpha: float
32
33    >>> from pyromaths.outils import Conversions
34    >>> Conversions.radians(30)
35    0.5235987755982988
36
37    :rtype: float
38    """
39    return alpha * math.pi / 180
40
41def degres(alpha):
42    """**radians**\ (*alpha*)
43
44    Convertit un angle donné en radians en degrés
45
46    :param alpha: angle en radians
47    :type alpha: float
48
49    >>> from pyromaths.outils import Conversions
50    >>> from math import pi
51    >>> Conversions.degres(pi/2)
52    90.0
53
54    :rtype: float
55    """
56    return alpha * 180 / math.pi
Note: See TracBrowser for help on using the repository browser.