# Tag Info

25

The primary difference between Refine and the two *Simplify functions is that Refine only evaluates the expression according to the assumptions given. It might so happen to be the simplest form when evaluated, but it does not check to see if it is indeed the simplest possible form. You should use Refine when your goal is not to simplify the expression but to ...

22

(I had been meaning to write a blog entry about this myself, but since this question has come up, I suppose I'll just write about it here instead...) In demonstrating how the quincuncial projection works, consider first the following complex mapping: With[{ω = N[EllipticK[1/2], 20]}, ParametricPlot[{Re[InverseJacobiCN[Tan[φ/2] Exp[I θ], 1/2]], ...

18

Edit: I added more explanations below, because this visualization method is quite different from conventional vector plots For just this purpose I had at some point invented the following visualization technique. I'll reproduce your definition first. It defines a complex vector field on the surface of a unit sphere. Clear[\[Epsilon]];(*Polarization ...

16

It is Kampé de Fériet function, introduced in Joseph Kampé de Fériet, "La fonction hypergéométrique.", Mémorial des sciences mathématiques, Paris, Gauthier-Villars. Its definition is given on Notations page: and, in an alternative form, in Wikipedia: $${}^{p+q}f_{r+s}\left( \begin{matrix} a_1,\cdots,a_p\colon b_1,b_1{}';\cdots;b_q,b_q{}'; \\ ... 15 Here is a shameless plug for my HTML parser posted here. The code is a bit long to reproduce here, the only change to it I'd do is to replace the function processPosList with this code: processPosList::unmatched = "Unmatched lists 1 enountered!"; processPosList[{openlist_List, closelist_List}] := Module[{opengroup, closegroup, poslist}, {opengroup, ... 14 You need to add ColorFunctionScaling -> False as an option to SphericalPlot3D. That should do the trick color[Θ_, Φ_] := RGBColor[(Sign[Re[SphericalHarmonicY[2, 1, Θ, Φ]]] + 1)/ 2, 0, (-Sign[Re[SphericalHarmonicY[2, 1, Θ, Φ]]] + 1)/ 2]; SphericalPlot3D[ Re[SphericalHarmonicY[2, 1, Θ, Φ]], {Θ, 0, π}, {Φ, 0, 2 π}, ColorFunction -> ... 13 This question is not trivial as it would seem and a detailed discussion could help to understand the issue, especially when we deal with roots of special functions, however to do the task as simply as possible this would be the best way : f[x_] := LegendreP[6, x] Reduce[f[x] == 0, x, Reals] == Reduce[f[x] == 0, x] True Reduce[f[x] == 0, x, Reals] ... 12 I've had to work with that kind of function (relying on cancellation of large terms) before, and the most practical workaround I could figure out to be able to evaluate the function numerically is to use its power expansion near the point of trouble (here, +\infty). So, get a good look at the series expansion and find out how it works (or derive it on ... 12 The site is not terribly conducive to scraping as the HTML is "noisy" and looks like WRI might change the format at the drop of a hat. Throwing caution to the wind... scrapeWolframFunction[id_] := Import["http://functions.wolfram.com/" ~~ id, "XMLObject"] // Cases[ # , XMLElement["p", {___, "class" -> "CitationInfo", ___}, body_] :> body ... 12 Borrowing almost verbatim from a recent response about finding extrema, here is a method that is useful when your function is differentiable and hence can be "tracked" by NDSolve. f[x_] := BesselJ[1, x]^2 + BesselK[1, x]^2 - Sin[Sin[x]] In[191]:= zeros = Reap[soln = y[x] /. First[ NDSolve[{y'[x] == Evaluate[D[f[x], x]], y[10] == (f[10])}, ... 12 One can use Solve as well, e.g. s = Solve[ BesselJ[1, x]^2 + BesselK[1, x]^2 - Sin[ Sin[x]] == 0 && 0 < x < 10, x] Solve::incs: Warning: Solve was unable to prove that the solution set found is complete. >> {{x -> Root[{BesselJ[1, #1]^2 + BesselK[1, #1]^2 - Sin[Sin[#1]] &, 0.886604635313462076794393681674}]}, {x -> ... 12 To implement what you intended to do, I suggest to take a look at this approach : hermite[0, x_] := 1 hermite[1, x_] := 2 x hermite[n_Integer /; n >= 2, x_] := hermite[n, x] = Expand[2 x*hermite[n - 1, x] - 2 (n - 1) hermite[n - 2, x]] Now you shouldn't have problems anymore. Recalling that there are in Mathematica the Hermite polynomials ... 12 Refine vs Simplify Mathematica is a term rewriting system, whenever we enter an expression, then it is evaluated by term rewriting using (built-in or user-defined) rewrite rules (see e.g. Evaluation) , so by default it "simplifies" some expressions, e.g. : a + b - a b So this makes an impression, that Refine performs some simplifications, although ... 12 There are many ways of coloring functions, to visualize spatial dependence of spherical harmonics one can take advantage of a useful function Rescale, so here is a bit different coloring using also imaginary part of the function : col[θ_, φ_] := RGBColor @ Rescale[{ Re @ #, 0, -Im @ #}]& @ SphericalHarmonicY[2, 1, θ, φ] SphericalPlot3D[ Re[ ... 12 Here's the exact answer: i1 = Integrate[x^n Exp[-(x - a)^2], {x, 0, Infinity}, Assumptions -> n > 0] /. n -> 1/2 (* 1/2 E^-a^2 (Gamma[3/4] Hypergeometric1F1[3/4, 1/2, a^2] + 1/2 a Gamma[1/4] Hypergeometric1F1[5/4, 3/2, a^2]) *) i1 /. a -> 0.3 (* 0.907605 *) 11 First, this is a single equation in two unknowns so we'd expect infinitely many solutions. So, let's try to solve for one variable in terms of the other: Solve[\[Beta]^-a Gamma[a] Sin[a \[Pi]] + E^\[Beta] \[Beta]^(2 a - 1) Gamma[1 - a] Sin[a \[Pi]] == 0, \[Beta]] That message and the appearance of the ProductLog indicates that we simply might not ... 11 I might as well elaborate on my comment. Here is a modification of Stan Wagon's FindAllCrossings[] function (from his book Mathematica in Action, second edition) that uses Plot[] to generate the initial approximations to be subsequently polished by FindRoot[]: Options[FindAllCrossings] = Sort[Join[Options[FindRoot], {MaxRecursion -> Automatic, ... 11 An experimental internal function IntegrateInverseIntegrate helps here, although it's intended more for integrands involving logs. This is what it returns in the development version: IntegrateInverseIntegrate[Exp[-x Cosh[t]], {t, 0, Infinity}, Assumptions -> Re[x] > 0] (* BesselK[0, x] *) 11 For numerical evaluation, there is the rapidly-converging continued fraction (due to Jones and Thron):$$\exp(x^2)\mathrm{erfc}(x)=\frac{2x}{\sqrt \pi}\cfrac{1}{2x^2+1-\cfrac{1\cdot2}{2x^2+5-\cfrac{3\cdot4}{2x^2+9-\cdots}}},\qquad x > 0$$One can use the built-in function ContinuedFractionK[] with a suitable cut-off: With[{x = N[30000], n = 10}, -2 x ... 11 If you have an analytic formula for f[x_] := Erfc[x]*Exp[x^2] not using Erfc[x] you could do what you expect. However it is somewhat problematic to do in this form because Erfc[x] < MinNumber for x == 27300. MinNumber 1.887662394852454*10^-323228468 N[Erfc[27280.], 20] 5.680044213569341*10^-323201264 Edit A very good approximation of ... 10 If you want a different 3D visualization, maybe try field lines. Usually, one should be suspicious of field line plots for time-dependent electromagnetic waves (because causality casts doubts on the meaning of plotting a spatially extended field line for a globally fixed time), but there have been recent high-profile papers that show such plots. Purely as ... 10 Short story$$ \vartheta(x) = \arg \left[(\operatorname{Bi}x+i \operatorname{Ai}x)e^{-\frac{2}{3} i (-x)^{3/2}}\right]+\frac{2}{3} \operatorname{Re}\left[(-x)^{3/2}\right] $$Update: I see that you want use only real functions, so you can expand this as$$ \vartheta(x) = \begin{cases} \arctan\frac{\cos \left(\frac{2}{3} (-x)^{3/2}\right) ...

9

Here's a quick scraper that I built (after asking the question). So far it has minimal error checking. Also note that InputForm, StandardForm and MathMLForm should all yield the same expressions. FunctionsWolframIDQ[id_String]:=StringMatchQ[id, RegularExpression["\\d\\d\\.\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d\\.\\d\\d"]] FWIDQ=FunctionsWolframIDQ; ...

9

Simplification in Mathematica is often a black art, and requires great use of your own intuition and knowledge to be effective. That said, I bring your attention to the series from of $\DeclareMathOperator{\erfi}{erfi}\erfi(z)$, $$\erfi(z) = \frac{2}{\sqrt{\pi}}\sum^\infty_{k=1} \frac{z^{(2k+1)}}{k! (2k+1)}.$$ Consider what happens when we use that to ...

9

The Hermite polynomials are orthogonal with respect to the inner product $$\langle f,g \rangle = \int_{-\infty}^{\infty} f(x)g(x)e^{-x^2} \, dx.$$ Thus, the nth coefficient can be computed using the inner product of your polynomial with the nth normalized Hermite polynomial. Example: p[x_] = 1 + x + x^2 + x^3; coeffs = Table[ Integrate[HermiteH[n, ...

9

FullSimplify[(-1)^n*BesselJ[n, z] - BesselJ[-n, z], n ∈ Integers, ComplexityFunction -> (StringLength @ ToString @ # &)] Also: ComplexityFunction -> (Count[#, _BesselJ | _Power, {-2}] &) ComplexityFunction -> (Count[#, _?NumberQ, Infinity] &)

9

Solving symbolically transcendental equations one should appropriately use Solve or Reduce with adequate logical combinations of equations, inequalities, domain specifications, etc. to get desired results. There are limitations for certain types of equations involving transcendental functions, see e.g. Transcendental Roots. Here is an example which doesn't ...

8

The answer is simply that integrating with the assumption that a variable comes from the class of integers is really difficult. What Integrate does with Assumptions -> Element[m, Integers] is try to generically integrate without the assumption and then apply the assumption to the result to try and simplify it. I've asked around about this before and there ...

8

For finding all roots in a given interval I use the following function: Clear[findRoots] Options[findRoots] = Options[Reduce]; findRoots[gl_Equal, {x_, von_, bis_}, prec : (_Integer?Positive | MachinePrecision | Infinity) : MachinePrecision, wrap_: Identity, opts : OptionsPattern[]] := Module[{work, glp, vonp, bisp}, {glp, vonp, bisp} = {gl, ...

8

Answer Here is an alternative approach, leveraging Mathematica's intelligent plotting algorithms. The basic idea is to use the list of points evaluated when plotting the function. Suppose I want the roots between 0 and 1400. Plot the function and assign the plot to a variable (I won't display the plot here): eq[n_, β_, λ_] = Hypergeometric1F1[1/4 (2 - ...

Only top voted, non community-wiki answers of a minimum length are eligible