sympy / scipy-2017-codegen-tutorial

SymPy code generation tutorial at SciPy 2017
http://www.sympy.org/scipy-2017-codegen-tutorial/
Other
61 stars 26 forks source link

Max & Min #27

Closed YuBeccaFan closed 6 years ago

YuBeccaFan commented 6 years ago

Why many languages likes js and R cannot be converted from Max & Min? image

bjodah commented 6 years ago

@AAmberFan that's probably an oversight in the printers, i.e. the methods _print_Min and _print_Max need to be implemented for JavascriptCodePrinter in https://github.com/sympy/sympy/blob/master/sympy/printing/jscode.py (and the corresponding function in R).

I don't know if javascripts/R's Min/Max equivalents are "vectorized"? If not the need a solution similar to _print_Min in https://github.com/sympy/sympy/blob/master/sympy/printing/ccode.py, otherwise it's quite easy (see e.g. https://github.com/sympy/sympy/blob/master/sympy/printing/pycode.py).

Pull-requests against sympy/sympy is most welcome

moorepants commented 6 years ago

@AAmberFan please open an issue about this on the SymPy issue tracker: github.com/sympy/sympy/issues