Re: More /.{I->-1} craziness
- To: mathgroup at smc.vnet.net
- Subject: [mg106291] Re: More /.{I->-1} craziness
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 7 Jan 2010 02:32:43 -0500 (EST)
On 1/6/10 at 5:59 AM, fateman at cs.berkeley.edu (Richard Fateman) wrote: >For example, Exp[I x] -Exp[- I x] /. Exp[I x] -> s should >probably result in s-1/s. In Mathematica, one gets s-E^(-Ix). >can either (1) Make this come out s-1/s >or >(2) Argue that Mathematica already does the right thing, blame the >user, blame the documentation, blame the nature of mathematics, >claim that it is impossible to "read the user's mind" etc. The argument isn't that Mathematica does the "right" thing. "Right" is quite subjective here. The result Mathematic does return for this example is clearly mathematically correct even if it is not the desired result. The real choice is either (1) understand how Mathematica is designed and make use of that to get the result you want or (2) find another software package that works more like what you want. Arguing Mathematic does either the "wrong thing" or the "right thing" here is pointless. >To me, the question is simply, by what programming technique >can we make Mathematica do the truly expected thing. In this >case, and I >believe in every other case, a transformation of the rules will >help. In particular, using the rule >x-> -I Log[s] instead of Exp[x I] -> s. >Is it possible that Mathematica could make this change? How could >it possibly make such a transformation? (hint. Solve for variable s) =46or me, I never want Mathematica designed in a way where it tries to guess or otherwise divine my intention and do something other than what I specifically told it to do via my input. I totally detest any software that does that. Which is one of the main reasons a greatly dislike Microsoft Word. >For another example, x/5 /. 1/5->Fifth results in Fifth x but >3/5 /. 1/5 -> Fifth is unchanged. >Is it possible that Mathematica could do this consistently? What is inconsistent here? Mathematica internally evaluates 1/5 as Rational[1,5], x/5 as Times[x, Rational[1,5]] and 3/5 as Rational[3,5]. In every case Rational[1,5] is being replaced with Fifth. Mathematica behaves in a consistent manner even though this is clearly not immediately apparent to a new user. Again, the choice is either understand this behavior and live with it or find different software. There isn't any other productive choice. Any software package that comes close to approximating the capability Mathematica offers has to make some set of design decisions. It simply is not possible to make those decisions in a manner that will please all potential users or not cause some level of confusion to a new user. This level of capability will always require significant learning on the part of any user to master. So, the real choice is learn and understand the way Mathematica works and live with it or find another software package more to your likely. There is no other productive choice.