43 Commits

Author SHA1 Message Date
7e4bfc9ba0 Feat: doctest skip
All checks were successful
continuous-integration/drone/push Build is passing
2020-08-20 16:57:17 +02:00
cdfd3e47b5 Mise à jour de 'README.md' 2020-08-20 16:57:17 +02:00
364f16b872 Mise à jour de '.drone.yml' 2020-08-20 16:57:17 +02:00
cc94f1f50c Feat: nothing 2020-08-20 16:57:17 +02:00
ad6923f8cd Feat: add a drone for testing 2020-08-20 16:57:17 +02:00
fadd93b9a6 Feat: change frac to dfrac for fractions 2019-11-04 09:43:52 +01:00
cb8010c7ac Feat: force subtree to be str and tex instead of txt in tree2tex 2019-11-04 09:39:52 +01:00
f12ec38746 Feat: Polynomial are displayed in nicer order! 2019-10-30 21:12:58 +01:00
f8b24472d1 Fix: clean __init__ 2019-10-30 20:59:09 +01:00
240857a7ad Fix: chante value to content in raw 2019-10-30 20:58:46 +01:00
70ec6933ac Feat: missing_times works with RdLeaf 2019-10-30 18:46:57 +01:00
91779bd945 Feat: Add doctest to rdstr2 2019-10-30 10:49:07 +01:00
69e1e43966 Feat: raw methods for tokens 2019-10-16 22:45:41 +02:00
16a6c4953d Feat: remove precision setting for Decimal 2019-10-15 19:41:09 +02:00
84c71f6b5d Feat: overload pow for tokens 2019-10-15 19:32:19 +02:00
2a74722b19 Feat: add doctest add int and Decimal 2019-10-15 19:15:32 +02:00
43fd46379c Feat: dirty way to get decimal approx of a function 2019-10-14 22:26:51 +02:00
2d296cf1d2 Feat: allowing to import Decimal 2019-10-14 22:22:08 +02:00
12109156d1 Feat: allow import Integer in calculus 2019-10-13 22:38:49 +02:00
2fad004d6d Feat: dirty sub (repeatition in explain) 2019-10-13 22:38:49 +02:00
207dead5d0 Feat: doctest for operation between Token and str 2019-10-13 22:38:49 +02:00
e24bff23db Feat: tokens can operate with builtin int 2019-10-13 22:38:49 +02:00
69c2b3718d Fix: precessing -> processing 2019-10-13 22:38:49 +02:00
9c25142a4b Feat: start using nox 2019-10-13 22:38:49 +02:00
931e55c35e Fix: Black does its job 2019-10-13 22:38:49 +02:00
aba43c9f19 Feat: no more round in quadratic roots 2019-07-17 09:55:32 +02:00
b93f34bc38 Feat: MOnumber creating with a integer string 2019-07-17 09:53:03 +02:00
204fdf755b Feat: to_be_token decorator and force token to be Integer when it's
possible
2019-07-17 09:49:50 +02:00
d75fd4c4cf Feat: tokenify for everything! 2019-07-17 09:25:12 +02:00
a32b684b6b Feat: Test and validate roots (but not elegant) 2019-07-16 16:49:33 +02:00
a5f062a151 Feat: doctest for composing Expressions 2019-07-16 09:31:30 +02:00
f8e1c7f962 Feat: Expression call works with tokens 2019-07-16 09:30:30 +02:00
1685c73051 Feat: Allow pure string rendering 2019-07-16 09:09:39 +02:00
04ac74d17a Fix: move __call__ to expressions 2019-07-15 18:37:16 +02:00
23ab39f7d4 Feat: add tree2tex in all import 2019-07-15 18:36:59 +02:00
41385ec561 Feat: Polynoms can be differentiate!!!! 2019-07-15 17:48:59 +02:00
8389a319f0 Fix: Issue with typing null monomial 2019-07-15 17:27:38 +02:00
6e24756746 Fix: replace notimplemented by NotImplementedError 2019-07-15 17:16:00 +02:00
d45ab560c9 Feat: coefficients, delta and some roots for polynomial, Linear and Quadratic 2019-07-15 11:59:28 +02:00
fa8beb6bb2 Feat: Polynomial can be evaluated 2019-07-15 11:14:48 +02:00
b81281d78a Feat: Move some import into functions 2019-07-15 11:09:59 +02:00
071b8caf1d Feat: start working on eval for polynoms 2019-07-15 10:42:49 +02:00
1ed0b9715a Fix: typing filter for multiply 2019-07-15 10:42:13 +02:00
6 changed files with 4 additions and 49 deletions

View File

@@ -7,12 +7,3 @@ steps:
commands: commands:
- pip install -r requirements.txt - pip install -r requirements.txt
- pytest --doctest-modules ./mapytex/ - pytest --doctest-modules ./mapytex/
- name: Publish
image: plugins/pypi
settings:
username:
from_secret: pypi_username
password:
from_secret: pypi_password
when:
event: tag

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# encoding: utf-8 # encoding: utf-8
from .calculus import Expression, Integer, Decimal, list_generator from .calculus import Expression, Integer, Decimal
# Expression.set_render('tex') # Expression.set_render('tex')

View File

@@ -31,7 +31,6 @@ Expression is the classe wich handle all calculus. It can randomly generate or i
""" """
from .API import Expression, Integer, Decimal from .API import Expression, Integer, Decimal
from .core import list_generator
from decimal import getcontext from decimal import getcontext
#getcontext().prec = 2 #getcontext().prec = 2

View File

@@ -66,7 +66,6 @@ from .tree import Tree, AssocialTree
from .compute import compute from .compute import compute
from .typing import typing, TypingError from .typing import typing, TypingError
from .renders import tree2txt, tree2tex from .renders import tree2txt, tree2tex
from .random import list_generator
# ----------------------------- # -----------------------------

View File

@@ -47,8 +47,8 @@ Tree with RdLeaf replaced by generated values
>>> leafs >>> leafs
['a', 'a*k'] ['a', 'a*k']
>>> rd_varia = extract_rv(leafs) >>> rd_varia = extract_rv(leafs)
>>> sorted(list(rd_varia)) >>> rd_varia # doctest: +SKIP
['a', 'k'] {'a', 'k'}
>>> generated = random_generator(rd_varia, conditions=['a%2+1']) >>> generated = random_generator(rd_varia, conditions=['a%2+1'])
>>> generated # doctest: +SKIP >>> generated # doctest: +SKIP
{'a': 7, 'k': 4} {'a': 7, 'k': 4}
@@ -61,18 +61,8 @@ Tree with RdLeaf replaced by generated values
> 7 > 7
> 28 > 28
List generator
--------------
This function ignores tree structure and works with lists
>>> values = list_generator(["a", "a*b", "b", "c"], conditions=["b%c==1"])
>>> values # doctest: +SKIP
{'a': -8, 'a*b': -40, 'b': 5, 'c': 4}
""" """
__all__ = ["generator"]
from random import choice from random import choice
from functools import reduce from functools import reduce
from .leaf import RdLeaf from .leaf import RdLeaf
@@ -254,27 +244,3 @@ def build_variable_scope(rd_variables, rejected, min_max, variables_scope):
except KeyError: except KeyError:
complete_scope[v]["min_max"] = min_max complete_scope[v]["min_max"] = min_max
return complete_scope return complete_scope
def list_generator(var_list, conditions=[], rejected=[0], min_max=(-10, 10), variables_scope={}):
""" Generate random computed values from the list
:param rd_variables: list of random variables to generate (can be computed value - "a*b")
:param conditions: condition over variables
:param rejected: Rejected values for the generator (default [0])
:param min_max: (min, max) limits in between variables will be generated
:param variables_scope: rejected and min_max define for individual variables
:return: dictionnary of generated variables
:example:
>>> values = list_generator(["a", "a*b", "b", "c"])
>>> values # doctest: +SKIP
>>> values["a"] * values["b"] == values["a*b"]
True
>>> values["a*b"] # doctest: +SKIP
>>> values["a"] * values["b"] # doctest: +SKIP
"""
rv = extract_rv(var_list)
rv_gen = random_generator(rv, conditions, rejected, min_max, variables_scope)
generated = compute_leafs(var_list, rv_gen)
return generated

View File

@@ -7,7 +7,7 @@ except ImportError:
setup( setup(
name="mapytex", name="mapytex",
version="2.3", version="2.1",
description="Computing like a student", description="Computing like a student",
author="Benjamin Bertrand", author="Benjamin Bertrand",
author_email="programming@opytex.org", author_email="programming@opytex.org",