Joe
Reputation
786
Top tag
Next privilege 1,000 Rep.
 Oct 31 accepted Why doesn't Mathematica simplify a square root of an expression that equals a square of a positive real? Oct 31 comment Why doesn't Mathematica simplify a square root of an expression that equals a square of a positive real? Great idea! It can be a bit simplified by using just one replacement rule: x_^2 + 2 y_^2 + 2 y_ Sqrt[x_^2 + y_^2] -> (Sqrt[x^2 + y^2] + y)^2. Oct 31 comment Why doesn't Mathematica simplify a square root of an expression that equals a square of a positive real? Nice! Then I just add /.{r -> Sqrt[x^2 + y^2], t -> ArcTan[x, y]} and simplify again and I have the simplified expression in my original variables. On the other hand, I have this expression appearing multiple times with different variables instead of x and y, and I'm not sure if your approach can be generalized to such a case. Oct 25 accepted Is Abs[z]^2 a bad way to calculate the square modulus of z? Oct 25 comment Is Abs[z]^2 a bad way to calculate the square modulus of z? Awesome analysis! By slightly adjusting your code, I plotted the difference in the error between the functions Abs[z]^2 and Re[z]^2+Im[z]^2 when they are applied to the same argument, and indeed for most of the points you used Abs[z]^2 has a smaller error! This is really weird and counterintuitive to me, but at least now I know. Oct 25 comment Why doesn't Mathematica simplify a square root of an expression that equals a square of a positive real? Since I am trying to simplify a very long expression that contains multiple versions of the expression I'm asking about, and I don't want to go through my long expression manually. Oct 25 comment Is Abs[z]^2 a bad way to calculate the square modulus of z? Please do feel free to edit my posts, this was never an issue for me! (I corrected the mistakes, thank you :). Oct 25 revised Is Abs[z]^2 a bad way to calculate the square modulus of z? corrected spelling Oct 25 asked Is Abs[z]^2 a bad way to calculate the square modulus of z? Oct 25 comment Why doesn't Mathematica simplify a square root of an expression that equals a square of a positive real? This is true, but why is the first simplification so hard that Mathematica doesn't find it? And is there a way to make it find it? Oct 24 asked Why doesn't Mathematica simplify a square root of an expression that equals a square of a positive real? Sep 11 awarded Caucus Aug 30 comment Probability and distribution from actual data Aug 14 answered Evaluation of self-defined functions Jun 25 comment Calculating a limit with a result that is discontinuous in the parameters @belisarius - Indeed in the example I gave in the question the different assumptions are equivalent to different directions. However, how about this example: 1/(1 + Exp[ϵ/T]) + 1/(1 + Exp[(ϵ - 1)/T]). Now there are different results for ϵ<0, 0<ϵ<1 and 1<ϵ, and I don't see how your comment applies here. Jun 25 comment Calculating a limit with a result that is discontinuous in the parameters @J.M. - You are correct, I will be satisfied, for example, with a Piecewise function as a result. BTW, why did you remove the limits tag from the question? Jun 25 revised Calculating a limit with a result that is discontinuous in the parameters add the assumption that ϵ is real Jun 25 comment Calculating a limit with a result that is discontinuous in the parameters @J.M. - Good point, however trying to use the assumption ϵ ∈ Reals still leaves the limit unevaluated (I edited the question to add this). Jun 25 asked Calculating a limit with a result that is discontinuous in the parameters Jun 6 comment Plotting the components of a function that returns a list in different colors without redundant evaluations of the function You're right @Mr.Wizard, in your example memoizing saves evaluations, but it does not save two thirds of the evaluations (I got 715 instead of 953). Of course we can't expect exactly two thirds, since there may be some overhead, by I think that even asymptotically we won't get two thirds.