2018-01-21 08:26:34 +00:00
|
|
|
#! /usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim:fenc=utf-8
|
|
|
|
#
|
|
|
|
# Copyright © 2017 lafrite <lafrite@Poivre>
|
|
|
|
#
|
|
|
|
# Distributed under terms of the MIT license.
|
|
|
|
|
|
|
|
"""
|
2018-03-10 05:44:01 +00:00
|
|
|
Make calculus as a student
|
2019-05-08 12:44:35 +00:00
|
|
|
==========================
|
|
|
|
|
|
|
|
Expression is the classe wich handle all calculus. It can randomly generate or import calculus, simplify them and explain them as a student would do.
|
|
|
|
|
|
|
|
>>> from mapytex.calculus import Expression
|
2019-06-28 09:43:17 +00:00
|
|
|
>>> Expression.set_render("txt")
|
2019-05-08 12:44:35 +00:00
|
|
|
>>> e = Expression.from_str("2x + 6 - 3x")
|
|
|
|
>>> print(e)
|
|
|
|
2x + 6 - 3x
|
|
|
|
>>> f = e.simplify()
|
|
|
|
>>> print(f)
|
|
|
|
- x + 6
|
|
|
|
>>> for s in f.explain():
|
|
|
|
... print(s)
|
|
|
|
2x + 6 - 3x
|
|
|
|
2x - 3x + 6
|
|
|
|
(2 - 3) * x + 6
|
|
|
|
- x + 6
|
|
|
|
|
|
|
|
|
2018-01-21 08:26:34 +00:00
|
|
|
"""
|
|
|
|
|
2019-10-13 20:38:02 +00:00
|
|
|
from .API import Expression, Integer
|
2019-05-08 12:44:35 +00:00
|
|
|
|
2019-06-28 09:43:17 +00:00
|
|
|
__all__ = ["Expression"]
|
2016-01-07 16:34:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
# -----------------------------
|
|
|
|
# Reglages pour 'vim'
|
|
|
|
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
2016-02-13 03:29:26 +00:00
|
|
|
# cursor: 16 del
|