51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
|
#! /usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
# vim:fenc=utf-8
|
||
|
#
|
||
|
# Copyright © 2017 lafrite <lafrite@Poivre>
|
||
|
#
|
||
|
# Distributed under terms of the MIT license.
|
||
|
|
||
|
"""
|
||
|
Tokens representing interger and decimal
|
||
|
|
||
|
"""
|
||
|
from .token import Token
|
||
|
|
||
|
__all__ = ["Polynomial", "Quadratic", "Linear"]
|
||
|
|
||
|
class Polynomial(Token):
|
||
|
|
||
|
""" Token representing a polynomial """
|
||
|
|
||
|
def __init__(self, mo, name=""):
|
||
|
if not isinstance(mo, MOpolynomial):
|
||
|
raise TypeError
|
||
|
if not isinstance(mo.value, int):
|
||
|
raise TypeError
|
||
|
|
||
|
Token.__init__(self, mo, name)
|
||
|
self._mathtype = 'polynome'
|
||
|
|
||
|
@classmethod
|
||
|
def random(cls):
|
||
|
raise NotImplemented
|
||
|
|
||
|
def __setitem__(self, key, item):
|
||
|
""" Use Polynomial like if they were a dictionnary to set coefficients """
|
||
|
pass
|
||
|
|
||
|
def __getitem__(self, key):
|
||
|
""" Use Polynomial like if they were a dictionnary to get coefficients """
|
||
|
pass
|
||
|
|
||
|
def __call__(self, value):
|
||
|
""" Call a Polynomial to evaluate itself on value """
|
||
|
pass
|
||
|
|
||
|
|
||
|
# -----------------------------
|
||
|
# Reglages pour 'vim'
|
||
|
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
||
|
# cursor: 16 del
|