Tag Info

Hot answers tagged

34

Here's some code that I used recently, based on code by Paul Abbott [1, 2]. Clear[TranscendentalRecognize] TranscendentalRecognize[num_Real, basis_List, ord_?Positive, debug:(True|False):False] := Module[{vect, mat, lr, ans}, vect = Round[10^Floor[ord - 1] Join[{num}, N[basis, ord]]]; mat = Append[IdentityMatrix[Length[vect]], vect]; lr = ...


29

I can offer a round-about method. First compute the numerical approximation. I obtain, to high precision, In[24]:= N[Sum[1/(2*n!), {n, 0, 100}], 100] Out[24]= 1.\ 3591409142295226176801437356763312488786235468499797874834838138620383\ 15176773797285691089262583214 Now paste that into a Wolfram|Alpha query, accessed by clicking on the '+' sign at upper ...


10

I asked a similar question on MathGroup some years ago. If you read that thread, you'll get some pointers about how these algorithms work (they're based on lattice reduction, see also here). There's a package by Eric Weisstein for doing something like this: see ToExact and TranscendentalRecognize in Simplify.m. This issue of the Mathematica Journal is ...


9

First I create a set of data to simulate yours. data = RandomVariate[ExponentialDistribution[1], 10^4]; Now you can take advantage of the EmpiricalDistribution function to define a model-free distribution based on your data. edist = EmpiricalDistribution[data]; The core of what you are asking for is to obtain a TransformedDistribution, i.e starting ...


8

Let's say you have a set of data: data = {{-2., -9.424}, {-1.5, -2.586}, {-1., -3.047}, {-0.5, -1.203}, \ {0., 0.551}, {0.5, 4.566}, {1., 12.077}, {1.5, 21.2118}, {2., 44.752}}; and you suspect it can be modeled with a 3rd order polynomial. You can set up the design matrix using the following: a = DesignMatrix[data, {x, x^2, x^3}, x] This link ...


7

Here's a variant of Danny's answer, that's perhaps a bit more automated: WolframAlpha[ToString[ NSum[1/(2*n!), {n, 0, Infinity}, WorkingPrecision -> 50]], {{"PossibleClosedForm", 1}, "ComputableData"}]


7

Rationalize may be an option, although I doubt it is as powerful as what WA is doing. Here's the documentation.


7

First we can see that ${\frac{(6k+1)^{k}}{(2k+5)^{k}}}$ behaves asymptotically as $3^k$, while $(z-2i)^k$ is divergent if $\|z-2i\|>1 $, however when $\|z-2i\|<1 $ it is convergent. For $\|z-2i\|=1$ this criterion is not conclusive. On the other hand we can carefully extend this argument to the full sequence, so we need only $\|z-2i\| < ...


6

I changed tri to List of your code. d = 9; x = {}; For[t = 1, t <= d, t++, If[t < d, AppendTo[x, {t, 1, 1} <-> {t + 1, 1, 1}]]; For[r = 2, r <= d, r++, If[t < d, AppendTo[x, {t, r, 1} <-> {t + 1, r, 1}]]; For[i = 2, i <= r, i++, If[t < d, AppendTo[x, {t, r, i} <-> {t + 1, r, i}]]; AppendTo[x, {t, r, i - 1} ...


5

That is not, properly speaking, a partial fraction decomposition. Those are finite and involve polynomial denominators. What you showed is a form of series representation. That can be done in Mathematica using SeriesCoefficient. In[102]:= SeriesCoefficient[1/(Exp[x] - 1), {x, 0, n}] (* Out[102]= Piecewise[{{BernoulliB[1 + n]/(1 + n)!, n >= -1}}, 0] *)


5

This answer doesn't use Mathematica, but another great resource for this sort of thing is the Online Encyclopedia of Integer Sequences. I've used it successfully many times when Mathematica has given me a decimal approximation but I've been after an analytical expression. Among other things, the encyclopedia includes the decimal expansions of a huge number ...


5

Apart only factorizes the denominator in simple cases. Otherwise it needs some help: Apart[1/Factor[(x^2 + 1), Extension -> I]] (* -(I/(2 (-I + x))) + I/(2 (I + x)) *) Apart[1/Factor[x^2 + 2, Extension -> {I, Sqrt[2]}]] (* 1/(2 Sqrt[2] (Sqrt[2] - I x)) + 1/(2 Sqrt[2] (Sqrt[2] + I x)) *)


5

Following up on Simon's note in his answer: This code can be cleaned up a little and made more efficient by using the PSLQ-based algorithm FindIntegerNullVector[] introduced in Mathematica version 8. here is a re-implementation of Abbott's TranscendentalRecognize[]: TranscendentalRecognize[num_?NumericQ, basis_?VectorQ] := Module[{lr, ans}, lr = ...


4

I think Mathematica is correct here: $$\int_{-2}^2 \delta(x^2+y^2+z^2-1)~ dx dy dz = \int_0^\infty dr \int_0^\pi d\theta \int_0^{2\pi}d\phi ~r^2\sin\theta~ \delta(r^2-1)$$ $$= \frac{1}{2}\int_0^\infty d(r^2) \int_0^\pi d\theta \int_0^{2\pi}d\phi ~r\sin\theta~ \delta(r^2-1) = \frac{1}{2}\int_0^\pi d\theta \int_0^{2\pi}d\phi ~ \sin\theta= 2\pi$$


4

This question reminds me somewhat of a post on the Wolfram Blog about finding rational approximations to Pi. It may be of interest to you. The only way I know to approach this sort of thing is by genetic programming. Expressions in Mathematica can be manipulated like trees. You could generate a population of random expressions, see how closely they come to ...


3

I'll use the function from Factoring polynomials to factors involving complex coefficients by Daniel Lichtblau which can also factor -1 + a x^2 factorCompletely[poly_, x_] := Module[{solns, lcoeff}, solns = Solve[poly == 0, x, Cubics -> False, Quartics -> False]; lcoeff = Coefficient[poly, x^Exponent[poly, x]]; lcoeff*(Times @@ (x - (x /. ...


3

k[] is function defined by you and tri is making UndirectedEdge-s k[j_List] := Block[{t = j[[1]], r = j[[2]], i = j[[3]]},(2 t - 1) 2^(-i + r) 3^(-1 + i)] tri[{t_, r_, i_}] := {{t, r, i} <-> {t, r + 1, i}, {t, r + 1, i} <-> {t, r + 1, i + 1},{t, r + 1, i + 1} <-> {t, r, i}} I remaked your code like this for making Graph. d = 4; data ...


3

This is extremely hacky, because I don't know how to do proper html processing in Mathematica. The following looks looks up the value on the Inverse Symbolic Calculator and returns the best match. InverseSymbolic[x_] := Module[{url, result, start, end, preprocess, guess, formatted}, url = "http://isc.carma.newcastle.edu.au/standardCalc"; result = ...


3

@asad the comments are all appropriate and (if I understand your aim), I present a way to implement to perhaps kickstart your own approach. However, I suggest in future you post an attempt, however imperfect. Further, it is helpful to post a small example so people can be clear about what you mean. Finally, if I misunderstand your aim then comment, otherwise ...


3

my stab at it, unfortunately only a marginal improvement in time: ii=13; Clear[a, b]; b = FoldList[Times, 1, Table[ Exp[MangoldtLambda[n]], {n, 2, ii}]]; a = Prepend[Table[ Limit[ Zeta[s] Total[Exp[Divisors[n]]^(s - 1) MoebiusMu[Divisors[n]]], s -> 1], {n, 2, ii}], 1] ; Monitor[aa = Prepend[Table[ ...


2

You can apply your transformation to your sample data and use EmpiricalDistribution on the transformed data without having to use TransformedDistribution: data = RandomVariate[ExponentialDistribution[1], 10^4]; ed = EmpiricalDistribution[data]; edtr = EmpiricalDistribution[Sqrt@data]; Plot[{CDF[ed, x], CDF[edtr, x]}, {x, 0, 4}, PlotLegends -> ...


2

I realized now that I included unnecessary many terms of the Dirichlet inverse of the Euler totient. Therefore a better program is: ii = 13 aa = Range[ii]*0; Monitor[Do[ Clear[A, a, b, n, k]; b = Table[Product[Exp[MangoldtLambda[n]], {n, 1, k}], {k, 1, nn}]; a = Table[ If[n == 1, 1, Limit[Zeta[s] Total[ Exp[Divisors[n]]^(s - ...


1

Bill s already gave an answer as a comment. An explicit proof of the conjecture can be obtained by noting that $$(A^3)_{il}=A_{ij}A_{jk}A_{kl}=\sum_{j=1}^N\sum_{k=1}^N\text{Boole}[i\leq j]\text{Boole}[j\leq k]\text{Boole}[k\leq l]\\ =\sum_{j=1}^N\text{Boole}[i\leq j]\sum_{k=1}^N\text{Boole}[j\leq k]\text{Boole}[k\leq l]\\ =\sum_{j=1}^N\text{Boole}[i\leq ...


1

The following function splits m=Binomial[n,k] into one or two parts whose product is m. The parts satisfy the conditions you specified, to the best of my understanding. UVfactors[n_, k_] := With[{f = FactorInteger[Binomial[n, k]]}, Print[Binomial[n, k]]; Print[f]; Apply[Times, Map[#[[All,1]]^#[[All,2]]&, SplitBy[f, ...


1

Use the built in function Sum: Sum[1/(2 p!), {p, 0, Infinity}] Mathematica outputs E/2.



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