# Tag Info

22

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]], ...

17

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 ...

14

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, ...

13

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

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

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 ...

12

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 ...

12

You need to add ColorFunctionScaling -> False as an option to SphericalPlot3D. That should do the trick color[\[Theta]_, \[Phi]_] := RGBColor[(Sign[Re[SphericalHarmonicY[2, 1, \[Theta], \[Phi]]]] + 1)/ 2, 0, (-Sign[Re[SphericalHarmonicY[2, 1, \[Theta], \[Phi]]]] + 1)/ 2]; SphericalPlot3D[ Re[SphericalHarmonicY[2, 1, \[Theta], \[Phi]]], ...

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

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

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 ...

11

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])}, ...

11

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 -> ...

11

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 ...

11

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{}'; \\ ... 10 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] *) 10 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[ ... 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 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 ... 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 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; ... 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 - ... 8 I can see two possible improvements. As expected with a subject like this, considering these improvements require knowing a little something about the properties of the Kummer confluent hypergeometric function. Thankfully, such knowledge is easily available these days, at sites like the DLMF. Here they are: 1) One can use the Kummer transformation$${}_1 ...

8

Following this question you can define: invmollweide[{x_, y_}] := With[{theta = ArcSin[y]}, {Pi (x)/(2 Cos[theta]), ArcSin[(2 theta + Sin[2 theta])/Pi]}]; fc[phi_] := Block[{theta}, If[Abs[phi] == Pi/2, phi, theta /. FindRoot[2 theta + Sin[2 theta] == Pi Sin[phi], {theta, phi}]]]; cart[{lambda_, phi_}] := With[{theta = fc[phi]}, {2/Pi*lambda ...

8

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

7

Kummer confluent hypergeometric function Hypergeometric1F1 has many zeros. Using your definitions: Plot[eq[1, 1, λ], {λ, 0, 1310}, PlotRange -> {-.25, .15}, Filling -> 0] You see that the 1st four roots are less than 200, give it a list of initial values in that range - large enough to get all the roots: Union@Round[ED[1, 1, Range[1, 200, 5]], ...

7

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, ...

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