46 Commits

Author SHA1 Message Date
41d0de79cc Tagging: change version to 2.2
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is failing
2020-08-20 17:38:06 +02:00
3b5c01e5cc Feat: random list generator
All checks were successful
continuous-integration/drone/push Build is passing
2020-08-20 17:36:38 +02:00
73b19e9644 Feat: add autopublishing
All checks were successful
continuous-integration/drone/push Build is passing
2020-08-20 17:02:09 +02:00
27e7dcba20 Feat: doctest skip
All checks were successful
continuous-integration/drone/push Build is passing
2020-08-20 16:59:40 +02:00
5f398b4c8d Feat: change frac to dfrac for fractions 2020-08-20 16:59:40 +02:00
ec823c85eb Feat: force subtree to be str and tex instead of txt in tree2tex 2020-08-20 16:59:40 +02:00
d72a2be175 Feat: Polynomial are displayed in nicer order! 2020-08-20 16:59:40 +02:00
e596c1af60 Fix: clean __init__ 2020-08-20 16:59:40 +02:00
b84cf047bd Fix: chante value to content in raw 2020-08-20 16:59:40 +02:00
d446139af3 Feat: missing_times works with RdLeaf 2020-08-20 16:59:40 +02:00
975728f8dc Feat: Add doctest to rdstr2 2020-08-20 16:59:40 +02:00
2317296534 Feat: raw methods for tokens 2020-08-20 16:59:40 +02:00
c211ed1591 Feat: remove precision setting for Decimal 2020-08-20 16:59:40 +02:00
0c84c63ad3 Feat: overload pow for tokens 2020-08-20 16:59:40 +02:00
25bfb7699b Feat: add doctest add int and Decimal 2020-08-20 16:59:40 +02:00
0abd80655a Feat: dirty way to get decimal approx of a function 2020-08-20 16:59:40 +02:00
a3f7efca12 Feat: allowing to import Decimal 2020-08-20 16:59:40 +02:00
1a74c54548 Feat: allow import Integer in calculus 2020-08-20 16:59:40 +02:00
1dccaabd86 Feat: dirty sub (repeatition in explain) 2020-08-20 16:59:40 +02:00
510f6a1fa2 Feat: doctest for operation between Token and str 2020-08-20 16:59:40 +02:00
6b353d2dd0 Feat: tokens can operate with builtin int 2020-08-20 16:59:40 +02:00
fbfaeb5a58 Fix: precessing -> processing 2020-08-20 16:59:40 +02:00
1a4e8ffb19 Feat: start using nox 2020-08-20 16:59:40 +02:00
d6bb61dc48 Fix: Black does its job 2020-08-20 16:59:40 +02:00
02214b0f82 Feat: no more round in quadratic roots 2020-08-20 16:59:40 +02:00
e52fec4057 Feat: MOnumber creating with a integer string 2020-08-20 16:59:40 +02:00
219d923ff5 Feat: to_be_token decorator and force token to be Integer when it's
possible
2020-08-20 16:59:40 +02:00
419e5955eb Feat: tokenify for everything! 2020-08-20 16:59:40 +02:00
f471a1efb3 Feat: Test and validate roots (but not elegant) 2020-08-20 16:59:40 +02:00
7600962fe4 Feat: doctest for composing Expressions 2020-08-20 16:59:40 +02:00
3e258b2d41 Feat: Expression call works with tokens 2020-08-20 16:59:40 +02:00
9f492378c8 Feat: Allow pure string rendering 2020-08-20 16:59:40 +02:00
0c3c20262e Fix: move __call__ to expressions 2020-08-20 16:59:40 +02:00
b3ec098b0b Feat: add tree2tex in all import 2020-08-20 16:59:40 +02:00
9d9224fcba Feat: Polynoms can be differentiate!!!! 2020-08-20 16:59:40 +02:00
b53de690d5 Fix: Issue with typing null monomial 2020-08-20 16:59:40 +02:00
beb319f21d Fix: replace notimplemented by NotImplementedError 2020-08-20 16:59:40 +02:00
50f77c4d60 Feat: coefficients, delta and some roots for polynomial, Linear and Quadratic 2020-08-20 16:59:40 +02:00
a83b5ada8d Feat: Polynomial can be evaluated 2020-08-20 16:59:40 +02:00
0aba5eaef6 Feat: Move some import into functions 2020-08-20 16:59:40 +02:00
0faaf481ca Feat: start working on eval for polynoms 2020-08-20 16:59:40 +02:00
b51ac7880d Fix: typing filter for multiply 2020-08-20 16:59:40 +02:00
fdf3b088f2 Mise à jour de 'README.md'
Some checks failed
continuous-integration/drone/push Build is failing
2020-07-18 06:29:21 +00:00
c7bd77e341 Mise à jour de '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2020-07-18 06:21:50 +00:00
37601be549 Feat: nothing
Some checks failed
continuous-integration/drone/push Build is failing
2020-07-17 20:37:51 +02:00
19cdddf27e Feat: add a drone for testing 2020-07-17 20:37:00 +02:00
6 changed files with 14 additions and 24 deletions

View File

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

View File

@@ -136,11 +136,9 @@ class Expression(object):
:returns: TODO
:example:
>>> e = Expression.random("{a}/{a*k}")
>>> e # doctest: +SKIP
>>> Expression.random("{a}/{a*k}") # doctest: +SKIP
<Exp: -3 / -15>
>>> e = Expression.random("{a}/{a*k} - 3*{b}", variables_scope={'a':{'min_max':(10, 30)}})
>>> e # doctest: +SKIP
>>> Expression.random("{a}/{a*k} - 3*{b}", variables_scope={'a':{'min_max':(10, 30)}}) # doctest: +SKIP
<Exp: 18 / 108 - 3 * 9>
>>> e = Expression.random("{a}*x + {b}*x + 3", ["a>b"], rejected=[0, 1])
>>> ee = e.simplify()

View File

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

View File

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

View File

@@ -71,7 +71,7 @@ This function ignores tree structure and works with lists
{'a': -8, 'a*b': -40, 'b': 5, 'c': 4}
"""
__all__ = ["list_generator"]
__all__ = ["generator"]
from random import choice
from functools import reduce
@@ -256,7 +256,7 @@ def build_variable_scope(rd_variables, rejected, min_max, variables_scope):
return complete_scope
def list_generator(var_list, conditions=[], rejected=[0], min_max=(-10, 10), variables_scope={}, dictionnary=False):
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")
@@ -264,25 +264,17 @@ def list_generator(var_list, conditions=[], rejected=[0], min_max=(-10, 10), var
: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
:param dictionnary: the return value will be a dictionnary with var_list as keys (default False)
:return: dictionnary of generated variables
:example:
>>> a, ab, b, c = list_generator(["a", "a*b", "b", "c"])
>>> a, ab, b, c # doctest: +SKIP
(5, -20, -4, -3)
>>> a * b == ab
>>> values = list_generator(["a", "a*b", "b", "c"])
>>> values # doctest: +SKIP
>>> values["a"] * values["b"] == values["a*b"]
True
>>> ab # doctest: +SKIP
-20
>>> a, b # doctest: +SKIP
5, -4
>>> list_generator(["a", "a*b", "b", "c"], dictionnary=True) # doctest: +SKIP
{'a': -3, 'a*b': 18, 'b': -6, 'c': -4}
>>> 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)
if dictionnary:
return generated
return [generated[v] for v in var_list]
return generated

View File

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