New answers tagged

2

Just for reference, the sum depicted in the OP has a representation in terms of the $q$-hypergeometric function. In particular, $$\sum_{n=0}^{\infty}\frac{(-1)^nq^{6n^2}}{(q^3;q^3)_n(-q;q)_{3n}}={}_1\phi_4\left({{0}\atop{-q,-q^2,-q^3,0}}\mid q^3,-q^6\right)$$ Compare: Series[QHypergeometricPFQ[{0}, {-q, -q^2, -q^3, 0}, q^3, -q^6], {q, 0, 15}] 1 - q^6 + ...


1

Ok, I got one now. Took some of the ideas of other posts, but then calculated not based on the number between the twins of the twin prime pair, but based on the number $2$ less than the first. I first create a set $\equiv 3 \pmod 6$ as only these work, and I no longer need to check $2$ or $3$. Then I create a massive set of numbers 2 or 4 mod the set of ...


1

I was able to speed up @Hubble07's code by defining RelativePrimes[n_Integer, p_List] := Complement[Range[1, n - 1, 2], Apply[Sequence, Map[Range[#, n - 1, #] &, p]]] to find the values in set. The new function becomes twinPrime3[n_, m_] := Module[{set}, set = RelativePrimes[n, Prime[Range[2, m]]]; Max[Differences[Pick[Rest[set], ...


5

This function calculates the maximum fails for the given list upto n. It also shows the numbers which give these gaps. twinPrime[n_] := Module[{list = {2, 3, 5, 7, 11}, set, twinSet, max, res}, set = DeleteCases[Table[If[Count[Divisible[i, list], False] == Length[list], Sow[i]], {i, 1, n}], Null]; twinSet = Mean /@ Select[Partition[set, 2, 1], ...


2

If you look at the documentation for Series Then you can see that Series[f,{x,Subscript[x, 0],n}] generates a power series expansion for f about the point x=Subscript[x, 0] to order (x-Subscript[x, 0])^n So if you want more terms, then simply change n to something else. Like 5, for example. In[6]:= Series[(1 - Cos[x])/x, {x, 0, 5}] ...


11

Here's a way to leverage the Clenshaw-Curtis rule of NIntegrate and Anton Antonov's answer, Determining which rule NIntegrate selects automatically, to construct a piecewise Chebyshev series for a function. It also turns out that InterpolatingFunction implements a Chebyshev series approximation as one of its interpolating units (undocumented). With ...


2

Just an extension to Alexei Boulbitch's answer: if you want to highlight x, you can change the function to: Clear[rule]; expr = Expand[(x + y) (x + z) (x + w)]; rule[x_] := {Power[x, y_] :> Power[x, y], x :> Style[x, Background -> Yellow]}


2

Try this: expr = Expand[(x + y) (x + z) (x + w)]; rule[x_] := x -> Style[x, Background -> Yellow]; Then you may apply the rule to the expression as follows expr /. rule[x^3] with the effect or expr /. rule[x^2] giving but the most simple substitution expr /. rule[x] does not work, since it highlights all terms containing x. But ...


2

One way could be using a Style. Expand[(x + y) (x + z) (x + w)] /. {x^2 -> Style[x^2, Red, Background -> LightBlue]}



Top 50 recent answers are included