Hot answers tagged

7

Here is another type of integration rule. It has a customized error estimator, incorporating which was my main interest. In fact, the rule below computes an integral of arbitrary dimension, using its own internal formula for the integral as well. Introduction A rule of the type NIintegrate`GeneralRule[{abscissas, weights, errweights}] computes the ...


4

It's the result of error accumulation of float number: Nest[# + 0.01 &, -1, 100] % == 0 (* 7.5287*10^-16 *) (* False *) There're many ways to fix this, for example, using arbitrary-precision number. In your case a Precision of 1. is enough: 0.01`1 // Precision Nest[# + 0.01`1 &, -1, 100] % == 0 (* 1. *) (* 0.*10^-1 *) (* True *) Or simply use ...


3

Try changing the method of summation: Clear["Global`*"] β = 1; d = 12; V = 1/4; Σf = 1 + I; ω[m_] := ((2*m + 1)*π) ν[n_] := (2*n*π)/β F1[n_] := NSum[(V^2*8)/ d^2*(I*ω[m] - I*Sign[ω[m]]* Sqrt[(ω[m])^2 + (d/2)^2])*1/(I*ω[m] + I*ν[n] - Σf), {m, -Infinity, Infinity}, Method -> "WynnEpsilon", WorkingPrecision -> 30] 0....


3

It happens if there is a diverging term appears in the middle. For your case If we consider FourierTransform[f, x, y, FourierParameters -> {0, -2 Pi}] = [Pi]^(1/4)/ Sqrt@2 (c1 + c2 + c3 + c4) c1 = Cosh[1/2 \[Pi]^2 (-2 y + Sqrt[2/Log[2]])^2] c2 = Cosh[1/2 \[Pi]^2 (2 y + Sqrt[2/Log[2]])^2] c3 = -Sinh[1/2 \[Pi]^2 (-2 y + Sqrt[2/Log[2]])^2] c4 = -Sinh[1/...


3

What happens here is that Association has attribute HoldAllComplete and hence does not evaluate x[1] to a numerical value: Clear[x]; assoc = <|"x" -> x[1]|>; x[1] = 0; assoc <|"x" -> x[1]|> Numerical functions work by assigning values to the variables and then evaluating the objective function, they don't perform replacement like in ...


3

In version 10.4.1 the support for complex valued PDEs to be solved via FEM has been improved. So this works in 10.4.1: res = NDEigensystem[-1/2 \[Psi]''[x] + 0.15 I \[Psi]'[x] + 1/2 x^2 \[Psi][x], \[Psi], {x, -15, 15}, 5]; res[[1]] {0.49806057220719635` + 4.192136700091489`*^-15 I, 1.494775497407078` + 7.331246737662917`*^-15 I, 2.688987707562188` +...


2

The problem is that the first argument in Plot must have a constant form. In your example sometimes 2 solutions are found and sometimes 1 solution only. Hence the form varies between {_,_} and {_}. With the following modification, the form {_,_} occurs Lebesgue almost surely, which suffices: f[x_, a_] := Sin[x] - a g[a_] := NSolve[f[x, a] == 0 && x &...


2

It's all explained in the Documentation Center. Equal Subscript[e, 1] == Subscript[e, 2] == Subscript[e, 3] gives True if all the Subscript[e, i] are equal. LessEqual Subscript[x, 1] <= Subscript[x, 2] <= Subscript[x, 3] yields True if the Subscript[x, i] form a nondecreasing sequence. That is, the three arguments in Equal must be equal ...


2

The output means that the result accuracy of the result is around 435. The actual result can be inspect with either InputForm or FullForm. The number you see after the 0``... is the Accuracy of the result. As defined by Mathematica, this means that the computed result is zero with an uncertainty of roughly 10^435. In the example above, the computed ...


2

In general one should not expect to obtain a general symbolic solution (a function x[a,b]) to the given equation since there are two independent variables, see e.g. Solve symbolically a transcendental trigonometric equation and plot its solutions for certain aspects regarding transcendental equations. To get an idea how the solution depends on parameters a ...


2

Perhaps this! It works if you only need the plot and not the values, or the function. That would require more work. ContourPlot3D[ Evaluate[-x + (Log[f2[x]] - Log[f1[x]] + Log[b] - Log[a])/((1 - a) + (1 - 1/f1[x]) - (1 - b) + (1 - 1/f2[x]))] , {a, 0, 1}, {b, 0, 1}, {x, 0, 1} , AxesLabel -> {"a", "b", "x"} , Contours -> {0} , Mesh -> None ...


2

I offer the following slightly modified version as a better illustration of the problem: Clear["Global`*"] guess = N[3/2, 300]; iter = 1000; n = Table[j, {j, 0, iter}]; y = Sin[4^n guess]^2; Grid[Transpose[{n, y}], Frame -> All] ListPlot[y] What see from the Grid is that at each iteration the number of residual digits of precision decreases - we have 2 ...


2

Seems to be a case of ill conditioning of the input system. If I redo using exact input and set NSolve to work on high precision then I get a plausible outcome. c1 = 50; c2 = 3/2; c3 = 2/5; c4 = 1/2; c5 = 8; c6 = 16/5; k1 = 37*10^(-17); k2 = 83*10^(-8); k3 = 87*10^(-12); k4 = 32*10^(-6); k5 = 86*10^(-32); eqs = {f1*f2 - k1*x1^2, f1*x3 - k2*x2*x1, f1*(c6 ...


1

The difficulty of doing numerical calculation with the 4th power as opposed to the square is immense. This easily demonstrated by doing a couple of exact computations. With[{x = (12/10)*10^15}, Exp[-((x - (121/100)*10^15)^2/(2*10^25))]] 1/E^5 With[{x = (12/10)*10^15}, Exp[-((x - (121/100)*10^15)^4/(2*10^25))]] 1/E^500000000000000000000000000 ...


1

Try the following shory code: DeleteDuplicatesBy[lst,Floor[#,10^-4]&] Will this help?


1

This reminds me of NSolve finds real-valued results in version 9, but not in version 10, in which you can use any of the Method settings from Methods for NSolve "EndomorphismMatrix" "CompanionMatrix" "Legacy" "Aberth" "JenkinsTraub" or even a nonexistent method "Foo": NSolve[eqs, {x1, x2, x3, x4}, Reals, Method -> "Foo"] (* {{x1 -> 23.2915, x2 -&...



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