whuber
Reputation
17,336
Top tag
Next privilege 20,000 Rep.
Access 'trusted user' tools
 May 15 comment Integration of a rational function Alternatively, use the Residue Theorem. Implicitly assuming $b\gt 0$ (WLG) and $c\gt 0$, we may (very quickly) obtain the solution as 2 \[Pi] I Sum[Residue[(a + x)/((b^2 + (a + x)^2) (1 + c (a - x)^2)), {x, z}], {z, {b I - a, I/Sqrt[c] + a}}] // Simplify, yielding $\frac{2 a \sqrt{c} \pi }{1+2 b \sqrt{c}+4 a^2 c+b^2 c}$. May 15 revised How to deal with zero in NDSolve in mathematica? added 94 characters in body May 15 comment How to deal with zero in NDSolve in mathematica? That completely changes the question! May 15 comment How to deal with zero in NDSolve in mathematica? +1 This argument can be made rigorous by considering the approximate differential equation as a perturbation of the original. Applying DSolve with initial conditions is not very persuasive. It's more insightful to omit initial conditions: the solution will include a Bessel function of the second kind. This captures the singular behavior at the origin and approximates the singular behavior of the original equation there, too. Standard theory shows that's all the solutions you can have--just two dimensions of them--and then the rest of the analysis goes through as shown here. May 14 comment How to deal with zero in NDSolve in mathematica? The equations are inconsistent with the initial conditions. At $t=0$ you are requiring that $0 = t y'(t) = -x(t) - t \exp(x(t)) = -1$ which is impossible. May 14 reviewed Reviewed Variable naming changes everything May 14 reviewed Leave Open How to store a SparseArray? May 14 awarded Enlightened May 14 awarded Nice Answer May 11 awarded Good Answer May 10 comment How do I draw a hemisphere? +1 -- but it's a little bit harder to use this technique to draw an arbitrary hemisphere. :-) May 10 comment How do I draw a hemisphere? One method (using RegionFunction) is shown here. May 10 comment Can one identify the design patterns of Mathematica? @Oleksandr Those are excellent points. Transforming a held expression is an idiomatic form of self-modification. I think it would be fair to subject such code to the same criticisms applied to all self-modifying code. Memoization, though, still seems to fall a little short of self-modification, because it is really just caching values. The relevant code itself is unchanged, although arguably the memoized object itself undergoes a (benign, controlled) form of "modification" in the sense of augmenting its collection of downvalues at runtime. May 10 comment Can one identify the design patterns of Mathematica? Not knowing what operation will take place is similar to not knowing (at compile time) what values the parameters will have, either. "Self-modifying" does not mean "unknown at compile time." Your example would be implemented in Assembly or C or their ilk using a dispatch table. Although the exact procedure will not be known until runtime, there is control over which procedures can be executed and in particular any procedure that might get executed has already been created before the execution started. During runtime, no code is actually modified. May 10 comment Can one identify the design patterns of Mathematica? It's powerful, yes, but I don't see how it is "self-modifying." Self-modifying code in MMA can be written but rarely is: it would consist of editing string expressions that would then be interpreted as MMA code and executed. What you discuss here appears merely to be the ability to pass almost any object as parameters, including objects that are thought of as executable. That has not historically been considered a "very bad thing" (although the dangers of such a thorough lack of typing are well known). May 10 reviewed No Action Needed Exporting twice crashes Mathematica on Ubuntu 12.04 with Unity May 10 reviewed Reviewed How can I get even steps on x and y axes in a plot? May 8 comment Evaluation of a triple sum does not finish in reasonable time Chris, my answer is incorrect: please accept the second answer by @b.gatessucks. May 8 comment Evaluation of a triple sum does not finish in reasonable time Very nice idea! @Michael E2 has clearly identified my mistake, which now squares our two results. (I promised only to find a lower bound for the sum, so a numerical value of the integral around $3.5$ is just fine). I apologize for making you work so hard :-) and will make up for it by transferring all the points from my answer to yours, which deserves it. (There's a day's wait before I can do that, though...) May 8 awarded Nice Answer