Tag Info

New answers tagged

1

Rule {Complex[re_, im_] :> Complex[re, -im]} seems to convert complex expressions which contain symbols which are meant to be real. Rule {I -> -I} does not, even on simple example: 2 I /.{I -> -I} 2 I the reason being that symbol I is automatically translated by Mathematica to Complex[0, 1] and rule above is interpreted ...


2

A bit of an aside, but a little variable substitution helps that integral quite a lot.. f[x_?NumberQ] := y /. FindRoot[LogIntegral[y] == x, {y, x*Log[x]}, WorkingPrecision -> 20, PrecisionGoal -> 12] Log[10] NIntegrate[(10^n/f[10^n])^2 , {n, 7, 200}, MinRecursion -> 5, MaxRecursion -> 20] 0.0519674 (~10x faster ...


0

Calculation of R involves general recursion that is not optimized in Mathematica. Try to use memoisation to avoid stack bloat when calculate R functions. R is defined recursively and recursive calls are not even in the tail position. Another advice - look at using Compile for your numeric functions.


5

This seems usable at least for moderately large x. one could use cutoffs and different start values if this is not useful in smaller ranges. f[x_?NumberQ] := y /. FindRoot[LogIntegral[y] == x, {y, x*Log[x]}, WorkingPrecision -> 20, PrecisionGoal -> 12] Two examples: f[10^200] (* Out[55]= 4.6565831394119416907*10^202 *) NIntegrate[n/(f[n])^2, ...


2

Expanding my comment into an answer, ProductLog can take two arguments, k and z, namely: ProductLog[k, z] There's some information to be found under the Details & Options of the documentation, but instead I turned to MathWorld, which has this to say on the matter: The plot above shows the function along the real axis. The principal value of the ...


1

Try this: lst = Select[ Table[{z, (FindRoot[w + Log[w] == Log[z], {w, -1000, -1}, Method -> "Secant", AccuracyGoal -> 3, PrecisionGoal -> 3] // Chop)[[1, 2]]}, {z, -0.5, -0.009, 0.002}], Im[#[[2]]] == 0 &]; which gives the list with the structure {z,W}. This plots the list ListPlot[Select[lst, Im[#[[2]]] == 0 ...


2

Please read the documentation about Piecewise f[x_, i_, t_] := Piecewise[{ {i, 1/(1 + i) < Abs[x - t] <= 1/i}, {0, x == t} }] Plot Manipulate[Plot[f[x, i, t], {x, -2, 2}], {{i, 1}, -2, 2}, {{t, 1}, -2, 2}] Plot3D[ f[x, i, 0], {x, -2, 2}, {i, -1/2, 1} , MaxRecursion -> 5 , PlotPoints -> 50 , AxesLabel -> {"x", "i", "f"} ...



Top 50 recent answers are included