Le 22/02/2012 19:59, [email protected] a écrit : > On 22 February 2012 19:24, Matthew Rocklin <[email protected]> wrote: >> This is true in most unit systems. Consider this image describing the >> possibilities to describe a Joule >> >> http://upload.wikimedia.org/wikipedia/en/math/6/5/7/65761e9c7ec650ec3... >> > I did not meant that. I meant that in electrodynamics even the base > units can not be defined in a natural unique manner. I will try to > find an old problem set with nice examples that I had, but it won't be > anytime soon. >> Probably your internal representation would consist only of the most >> natural/basic units (these have a name that I've forgotten) like meters, >> kg, seconds, coulombs, etc.... When printing though there is the choice of >> how you display these. Perhaps there is some way to find the simplest >> representation of the units in this case (least complex expression?) My >> guess is that this is likely to be annoying/messy. >
My point is not that sympy should find the most adapted unit system to what we are doing, because it would be impossible. So the user has to choose in which system he wants to work (MKSA, natural, Gauss...), and then all the results are given in the base units of this system (in your example, J will be printed as after the first equality). If the user wants to see non base units, then he has to ask for it explicilty, for example if he said "I want to see N", then sympy could try to complete with base units, which is always possible (J will be displayed as after the second equality). Another approaches is to say to sympy (as an option) to not replace not-base units with base units to do the computation, because generally computations with an energy will involve other energies, and we can have simplifications. On 22 fév, 19:03, "[email protected]" > I have a question about the automatic addition of units to expressions > written in natural units (i.e. dimensionless). If I recollect > correctly there are too many degrees of freedom in the definition of > the units for fields in electrodynamics (and probably in other > theories too) therefore it is impossible to find a unique set of units > for the expression. Can you comment on this? Maybe I am wrong or maybe > I have just misunderstood what you are proposing. > > Stefan Exactly, there are too much freedom in order that sympy make a guess alone (because from the beginning several units "collide", like energy and masses, so how can we say if this unit will be mass or energy in non-natural units?). For this reason, the user has to help sympy, by giving some assumptions ("I know the right hand side should be a mass in MKS", etc.). It's complicated but it's the price to pay if he doesn't want to care about constant units until the end. So the "normal" way (and the first I will code) will be to explictly put the constant units, but later I will try to add some features to recover them (because it's more "natural" to not write them, and we can not think without them because it's not what we learn in school). (In this I also answer to second Sergiu's message.) On 22 fév, 16:27, Sergiu Ivanov <[email protected]> wrote: > On Mon, Feb 20, 2012 at 11:21 PM, Harold E. <[email protected]> wrote: >> On 20 fév, 15:19, Aaron Meurer <[email protected]> wrote: > >>> If you're not going to use units until the very end, they're not very >>> useful. Granted, there is a certain level of physical correctness >>> that is lost without them, but I think the whole point of having a >>> strong units system is that it can do dimensional analysis for you. >>> This means that you use them in every point in the calculation, so >>> that at the end, you know exactly the units of the end result. > >> I'm not sure to understand exactly what you mean, but I answer anyway, >> so say me if I'm wrong. >> My main point was that during computation, you can write either 0.7*c >> or just 0.7 when you have a velocity, and, in the first case, having >> method to see if we have to add c factors. It means as you say that >> the system can do dimensional analysis. But also maybe it's not very >> useful, and so we can encourage user to be consistent when using units >> if they want detailed results. >> I did not yet have thought to this point in deep, but I think it's >> possible to get something usable. > > I'm inclined to strongly agree with Aaron. Dimensional analysis is > often a relatively cheap way to check the physical meaning of the > computation, as far as I can remember. I think that this feature > would not only be very useful, but it also should be made imperative, > i.e., the user should be forced to use units in all cases where this > is appropriate. > > On the other hand, being strict with specifying units will simplify > your life as the developer of this module: you will always know that > constants are dimensionless, whatever the context. > > Sergiu -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
