Tag Info

New answers tagged

1

Sthefest algorithm has problems with trigonometric and exponential functions, you con use the Peter Valko program in mathematica. You can find de program on line on Peter Valko's web of Texas A&M University


0

The complex results seem to stem from a peculiarity of Mathematica's implementation of EllipticTheta[] and/or Derivative[]. To demonstrate this, let's define the derivative with respect to the third argument: ϑ2p[q_] := Derivative[0, 0, 1][EllipticTheta][2, 0, q] Now an innocent question: what is the numerical value of ϑ2p[1/20]? Let's try: N[ϑ2p[1/20]] ...


3

Starting with bbgodfrey's excellent suggestion to solve ab == ac == bc == 0, we can obtain a fairly compact list of all of the solutions. If we Reduce the equations with conditions on the variables we get a complicated result, so it's easier to Reduce first and apply conditions after: Reduce the equations and throw out some obviously inconsistent results: ...


4

Further edited to simplify results It is not difficult to show that the three eigenvalues, w, of M are equal if and only if M is diagonal; i.e., ab = ac = bc = 0. f[e_] := 2 Norm[e]^-3 (1 - 3 Sin[θ]^2 Cos[ϕ - ArcTan[e[[1]], e[[2]]]]^2) Cos[{x, y}.e] abeval = f[{1, 0}] (* 2 Cos[x] (1 - 3 Cos[ϕ]^2 Sin[θ]^2) *) aceval = f[{0, 1}] (* 2 Cos[y] (1 - 3 Sin[θ]^2 ...


15

We can take advantage of the fact that IntegerDigits is very fast when the base is large. But not too large: no bigger than $2^{63}-1$ on a 64-bit system or $2^{31}-1$ on a 32-bit one, because Mathematica's machine integers are signed. Additionally, non-power-of-two bases require more work to get the result than just partitioning a bit-string, and are ...


3

This is an incomplete answer, but we will be able to show that there is no solution for most values of θ and ϕ. We will also be able to draw a plot of the regions of interest that you should check further to find solutions, should they exist. M = {{s - w, ab, ac}, {ab, s - w, bc}, {ac, bc, s - w}}; {d, c, b, a} = CoefficientList[Det[M], w]; disc = ...


5

In version 10.1 the function Subdivide was introduced which does precisely that. Subdivide[10] (* {0, 1/10, 1/5, 3/10, 2/5, 1/2, 3/5, 7/10, 4/5, 9/10, 1} *) Subdivide[10, 5] (* {0, 2, 4, 6, 8, 10} *) Note that the number 5 equals the number of intervals not the amount of entries in the list (which is higher by one).


0

From the Manual https://reference.wolfram.com/language/ref/FindDivisions.html this can be easily solved: FindDivisions[{1,10},9] will produce {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} which are 10 in number though...


12

Starting with a corrected version of your ProbabilityDistribution f[a_, b_, g_, c_, k_] := ProbabilityDistribution[ a b c k x^(c - 1) (1 + x^c)^(k - 1) ((1 + x^c)^k - 1)^(-b - 1) (1 + g ((1 + x^c)^k - 1)^-b)^(-(a/g) - 1), {x, 0, Infinity}, Assumptions -> a > 0 && b > 0 && g > 0 && c > 0 && k > ...


2

As noted in the comments, there are three main errors: k and k[x, y] are not the same thing in Mathematica. Piecewise should be capitalized. NDSolve returns a list of "rules" for the various solutions of the equations, which need to be "applied" (using /.) to be plotted. Alternately, if you know that there's only going to be one solution of the equations, ...


0

For a finite range of interest, NSolve works well f[x_] = BesselJ[1, x]^2 + BesselK[1, x]^2 - Sin[Sin[x]]; Manipulate[ Module[{sol}, Column[{ sol = NSolve[{f[x] == 0, 0 <= x <= xmax}, x], Plot[f[x], {x, 0, xmax}, Epilog -> {Red, AbsolutePointSize[6], Point[{x, f[x]} /. sol]}, ImageSize -> 360]}]], {{xmax, 16}, 1, ...


5

Finding the intersections You can use use Graphics`Mesh`FindIntersections (see Implementation of Balaban's Line intersection algorithm in Mathematica for example) either on the plot or on the points stored in the InterpolatingFunctions in sol: With curvatureConst = -3.5; there are five points of intersection: Here are the two methods: ...


4

For curvatureConst = -2.25 the equations in the Question yield An intersection can be found from First@FindRoot[{(x[t] - x[t2]) /. sol, (y[t] - y[t2]) /. sol}, {{t, 8}, {t2, 10.5}}] (* t -> 7.8869 *) Flatten[{x[t], y[t]} /. sol /. %] (* {-0.0330813, 0.693441} *) Of course, there are multiple intersections, and which is obtained depends on the ...


5

As the old documentation states: $EqualTolerance gives the number of decimal digits by which two numbers can disagree and still be considered equal according to Equal. The default setting is equal to Log[10, 2^7], corresponding to a tolerance of 7 binary digits. On my system $MachinePrecision is ~15.9546 which means there are 53 bits: ...


3

Since you are specifically asking about versions below 10, it may be useful to point out that this problem is equivalent to the electrostatics problem of finding the potential in a region bounded by conductors held at fixed voltages. This can be solved, e.g., with the simple relaxation method I implemented in this answer, where I actually allow for lots of ...


1

If you have v.10 you can explicitly use the finite element method: Needs["NDSolve`FEM`"] mesh = ToElementMesh[Rectangle[{0, 0}, {10, 10}]] sol = First@NDSolveValue[{Laplacian[w[x, y], {x, y}] == 0, DirichletCondition[w[x, y] == 100, y == 0], DirichletCondition[w[x, y] == 400, y == 10], DirichletCondition[w[x, y] == 0, x == 0], ...


10

I present in this answer a compiled implementation of one of the simpler algorithms for numerically evaluating a Bessel function of (modestly-sized) integer order and (small to medium-sized) real argument. This uses Miller's algorithm: bessj = With[{bjl = N[Log[1*^16]]}, Compile[{{n, _Integer}, {x, _Real}}, Module[{h, hb, ...


1

Here is the method I was alluding to in a comment to DumpsterDoofus's answer: dat = {{0, 0}, {18, 1}, {70, 1/4}, {90, -1}, {110, 2}}; (* DumpsterDoofus's solution *) fd[x_] = Integrate[Interpolation[dat, InterpolationOrder -> 0][x], x]; {xa, ya} = Transpose[dat]; f1 = y /. First[DSolve[{y'[x] == First[ya] + Differences[ya].UnitStep[x - Most[xa]], ...


0

You can take your data and feed it into Interpolation to get something that Mathematica views as a continuous function. As an example, let's look at a the metric for a spherically symmetric constant-density star (see Schutz's A First Course in General Relativity, §10.6). This is an unrealistic model, but it has the advantage that there exists an analytic ...


0

Clear[log1p] log1p[x_, n : _Integer?Positive : 2] := (Series[Log[1 + y], {y, 0, n}] // Normal) /. y -> x log1p[1.0*^-15] 9.999999999999995*^-16


3

Problem The problem with Log[1. + 1.*^-15] not yielding 1. is not due to Log, but to MachinePrecision inputs, which I think the OP implied in the question statement: 1 + 1.*^-15 % - 1 (* 1. 1.11022*10^-15 *) So Log[1 + 1.*^-15] does return the right answer, 1.11022*10^-15, for the actual input. Solution Here is a simple way to get log1p-type ...



Top 50 recent answers are included