On Tue, Apr 7, 2009 at 7:30 PM, William Purcell <flye...@gmail.com> wrote: > On Tue, Apr 7, 2009 at 7:32 PM, Fredrik Johansson > <fredrik.johans...@gmail.com> wrote: >> >> The simplest workaround would be to recognize simpler forms for units >> at the pretty-printing stage. > > For my particular application I need a simpler 'pretty form'. I am trying > to do something similar to the way Mathcad handles units. I do all my > calculations at work with a python pre-parser to LaTeX that finds all the > python code in a LaTeX document, executes it, and then tries to > intellegently replace the code with an equation, figure, or whatever the > block of code might represent. It's pretty slick (and it keeps me from > using Mathcad or Excel) except I need someway to attach units to my > calculations for better documentation (i.e. I need to know if a moment on a > beam I am sizing is in ft-lbs or N-m). Do you have a suggestion on the > best way to approach this? A specific example, how could I get V from > sympy.units.A*sympy.units.ohm if that is really what I wanted? > > In short, what would be the best way to recognize m**2*kg/(A*s**3) as V, and > do you have any thoughts on a printer method to do this?
I would try our matching functions, e.g. try to match: m**a * kg**b * A**c * s**d and then from a, b, c, d, determine what to substitute it for. If something doesn't work, please report it and we'll fix it. Ondrej --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---