# Tag Info

25

StringToDouble was renamed StringToMReal as part of code cleanup and the addition of several friends: ?InternalStringTo* (*InternalStringToBoolean InternalStringToMInteger InternalStringToMReal InternalStringToMRational*) It should be as fast, but now in failure cases it returns a proper Failure object instead of some bizarro-$Failed[_String]... 21 Quit the kernel before each test. This is on MMA 10.3 on Mac OS X. Simplify the problem We can simplify so that tmp is much much smaller and easier to analyse: rot1 = RotationTransform[{{1, 0, 1}, {0, 0, -1}}, {0, 0, 0}]; tmp = rot1@Tuples[Range[3, 6], 3]; grouptmp1 = GroupBy[tmp, N[Last[#], 8] &]; grouptmp2 = GroupBy[tmp, N[Last[#], 8] &]; ... 19 It looks like a problem of numeric cache: SetSystemOptions["CacheOptions" -> {"Numeric" -> {"Cache" -> False}}]; tmp = {3/Sqrt + 3 Sqrt, 3/Sqrt + 3 Sqrt}; grouptmp1 = GroupBy[tmp, N[#, 8] &]; grouptmp2 = GroupBy[tmp, N[#, 8] &]; grouptmp1 === grouptmp2 (* True *) With caching I get False. See also Simon Woods's comment. There ... 17 To get exact output, use exact input (and please input your question using plain text Mathematica code that one can easily copy). Clear[t]; x = Rationalize[3.33333]; eq = x*10^(-15) - x*Exp[-t/5000000]*10^(-15) == 10^(-122); sol = t /. First@Solve[eq, t]; sol = sol /. C -> 0 eq /. t -> sol t should be positive. Since$MaxExtraPrecision = 1000; N[...

16

Here is a analysis of all the problems related to Mathematica in your question. Briefly summarized, These are 3 problems : the lack of build-in tools to visualize the potential and vector field in polar coordinates. boundary problems : Whatever is the real geometry you are interested (not clear in your question, especially you want to optain 1.9 pF/m),...

15

I think it is better to use Cartesian coordinates because one does not have to deal with the periodicity in p. To have control on the meshing of the the region, we tell Mathematica explicitly to discretize it. PrecisionGoal -> 6 controls the meshing at the boundary. But this does not always work. Alternatively, one can use MaxCellMeasure -> 0.001 or a ...

15

It is a bug that will be fixed in the nearest release of Mathematica. It affects Abs/Sign of positive Root objects with third argument 1, for which the real root isolation algorithm produces an isolating interval with the left end point 0.

14

Yes, by doing this (similar to this): Unprotect[Power]; Power[0|0., 0|0.] = 1; Protect[Power]; If you want to revert to normal: Unprotect[Power]; ClearAll[Power]; Protect[Power]; The downside is that it doesn't make sense mathematically, and from a false premise you could reach a false conclusion. You better constrain your function in some other way. Try ...

14

lst = {{2, -2}, {1, 5}, {1, -3}, {-3, 3}}; Pick[lst, Total[lst, {2}], 0] {{2,-2}, {-3,3}} First @ Timing[res0 = Pick[Ta, Total[Ta, {2}], 0];] 0.093750 First @ Timing[res0a = Pick[Ta, Total /@ Ta, 0];] 0.187500 First @ Timing[res0b = Pick[Ta, Plus @@ Transpose[Ta], 0];] (*thanks: 2012rcampion *) 0.062500 First @ Timing[res1 = DeleteCases[Ta,...

14

There are infinitely many (continuum) solutions and basically one cannot list them all e.g. because of the Cantor theorem. This is the reason why numerical approach is unsatisfactory. However we can make use of FindRoot to find a finite numerical subset of the solution space. Numerical solutions First we set up a net of values of x and starting point of y ...

13

The problems at hand comes from using inadequate numerical approximation. The equation behind is quite simple and it can be solved exactly, we put 10/3 instead of 3.33333 (if usual mathematical meaning is assumed use 333333/100000 instead of 10/3) : t0 = t /. Solve[10/3 (1 - Exp[-(t/5000000)]) 10^-15 == 10^-122, t, Reals]//First 5000000 (108 Log + 108 ...

11

Your numericRoots are OK. The core of your problem is that you use Expand to put your polynomial into power series form. High order power series are numerically unstable. The form your z function yields by itself is much better: z[8, c] /. numericRoots // Abs // Max (* 9.87841*10^-11 *) Expanding on my answer here: "I can see that what you're saying is ...

11

direct implementation of Chudnovsky formula for reference: a = 1; a[k_] := a[k] = a[k - 1] (-(((-1 + 2 k) (-5 + 6 k) (-1 + 6 k) (13591409 +545140134 k))/ (10939058860032000 k^3 (-531548725 + 545140134 k)))) (pi1 = N[((426880 Sqrt)/(13591409 Sum[ a[k], {k, 0, 500}])),10000]) // AbsoluteTiming // First ...

10

NMaximize[{f[n], 1 <= n <= 10^6, n ∈ Integers}, n] (* Out: {63.041, {n -> 2}} *) You can then get the corresponding symbolic function value using your definition of f[n]: f // FullSimplify

10

I will present an anisotropic meshing solution that will allow you to resolve a sharp normalized peak at the center of your cube. Many links applying this technique are in my answer to the question Future enhancements for the finite element method. Helper functions I will use some of the following helper functions to construct an anisotropic mesh that highly ...

9

ClearAll[f] eq = 0.003101895368576676 f - 500000/(1057 f \[Pi]) - (0.43169299511061626 Cos[ 0.019329990640367303 f] Sin[ 0.019329990640367303 f])/(1.0609 (1.37*^-11 + 0.222185005727138*^-7 Sqrt[f])^2 Cos[ 0.019329990640367303 f]^2 + Sin[0.019329990640367303 f]^2) == 0 sol = NSolve[{eq && 20 < ...

9

The line Table[N[PHI30EQ[u], 30], {u, 0, 0.1, 0.001}] doesn't do what you think it does. You're asking for 30 digits of precision, but you supply u as a machine number. If you mix arbitrary precision and machine precision like that, you'll get machine precision answers. I suspect you instead want is: Table[N[PHI30EQ[u], 30], {u, 0, Rationalize[0.1], ...

9

The general problem In using NDSolve to solve first-order IVPs, there are basically two ways to set up the ODE: y'[x] == f[x, y[x]] (* explicit form *) F[x, y[x], y'[x]] == 0 (* implicit form *) Most numerical solvers require the problem to be specified in explicit form. In Mathematica, there is only one solver that works with the implicit form, IDA, ...

8

I think your problems are made by order of appling Re and N. Re@Bloch is not yet a state before the computation. So you have to apply the computation by Re@Norder. Block[{$MaxExtraPrecision = 500, ϵ = 10^-10}, Re@N@BlochΚ[-2 + ϵ, -1, -10]] Block[{$MaxExtraPrecision = 1000, ϵ = 10^-20}, Re@N@BlochΚ[-2 + ϵ, -1, -10]] Block[{$MaxExtraPrecision = 500, ϵ = 10^-... 8 You can use ChartElementFunction: For Version 9: f[{{xmin_, xmax_}, {ymin_, ymax_}}, a_ , b_] := {Rectangle[{xmin, ymin}, {xmax, ymax}, RoundingRadius -> 0.2], Text[Style[Length@a, Large, Bold, Black], Mean /@ {{xmin, xmax}, {ymin, ymax}}]} DensityHistogram[a, {{{.0001, .001, .01, .1, 1, 10, 100}}, {{.01, .1, 1, 10, ... 8 Here is an adaptation of MATLAB code from Trefethen, Ten Digit Algorithms (2005), based on Borwein & Borwein, The Arithmetic-Geometric Mean and Fast Computation of Elementary Functions (1984) that calculates$\pi$via the AGM method. ClearAll[npi]; npi[digits_] := Block[{two, iter}, iter[{x_, y_, p_}] := With[{s = Sqrt@x}, {(s + 1/s)/2, ... 8 Your problem is similar to a wave spectra problem and a regression problem, and I have both types of problems going on at work right now which is why I've thought about your problem a bit. Here is an approach with bootstrapping. I used FourierDCT because I don't want to figure out the circular statistics of complex numbers... bootStrapUDList[listFuncHead_,... 8 The documentation for N says that N[expr, n] attempts to give a result with n-digit precision. In the Wolfram Language, or any language, precision is not the same as decimal places. While it might seem like N is there to give us results with a certain number of decimal places, it actually has more to do with the amount of precision used in calculations ... 7 Update: I think this is a numeric precision problem rather than a matter of the behavior of Re. I don't know if I should leave my original answer below for reference or remove it. Consider: expr = MathieuC[MathieuCharacteristicA[-(19999999999/10000000000), -2], -2, 5]; N[expr] N[expr, 15] SetPrecision[expr, 15] -9.85323*10^-16 + 3.39211*10^-8 I -0.... 7 BarChart[Counts[{"a", "a", "b", "c"}], ChartLabels -> Automatic] By using Counts instead of Tally, we get an Association that BarChart knows how to handle automatically. 7 This is a good candidate for NestList e = 0.05; f = 0; g = 1; n = 100; ListLinePlot[ Transpose@Most@NestList[{First@# + e Last@#, Last@# - e First@#} &, {f, g}, n], DataRange -> {e, e*n}, PlotLegends -> {"f", "g"}] 7 PossibleZeroQ is rather fast and does precisely what you're looking for: RepeatedTiming[PossibleZeroQ[a - b]] {3.2*10^-6, True} @JM's difficult case is handled correctly: PossibleZeroQ[Sin[2017 2^(1/5)] - (-1)] False The limits of PossibleZeroQ can be fine-tuned with$MaxExtraPrecision.

7

NDSolve currently can't handle coupled PDE and ODE, so let's discretize the system all by ourselves, but before that, I'd like to point out the system actually has two solutions. By eliminating $\frac{∂f}{∂r}$ from $(3)$ and $(4)$ we obtain: c = 10; d = 1; e = 1; With[{f = f[r, t], g = g[t]}, bc = {D[f, r] == c D[g, t], f - (d - e D[f, r]) D[f, r] == g} /....

7

You can specify you want real solutions Solve[x*Floor[x] == 10, x, Reals]

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