Hot answers tagged

34

It's true that the multivariable version of Series can't be used for your purpose, but it's still pretty straightforward to get the desired order by introducing a dummy variable t as follows: Normal[Series[f[(x - x0) t + x0, (y - y0) t + y0], {t, 0, 2}]] /. t -> 1 $(x-\text{x0}) (y-\text{y0}) f^{(1,1)}(\text{x0},\text{y0})+\frac{1}{2} (x-\text{...


31

The standard built-in logarithm function is defined for complex variables as follows: Log[z] = Log[Abs[z]] + I Arg[z] The location of the branch cut is simply caused by the convention that polar angles of z are assumed to be in the range $-\pi$ to $\pi$. This same branch cut is also part of the definition of the built-in Arg function. Here is a different ...


19

@whuber gave me another idea : first change the summand to an exponential and then do the sums using the symmetry. Integrate[Exp[-t i j k (i + j + k + 1)], {t, 0, Infinity}, Assumptions -> {i > 0, j > 0, k > 0}] (* 1/(i j k (1 + i + j + k)) *) so we need to do the sums of the exponential and then integrate at the end. Now we can make a change ...


18

In this case you can use SeriesCoefficient SeriesCoefficient[Exp[x], {x, 0, n}]


17

You want first to fix any typographical errors (such as the unbalanced parentheses) and it's also wise to avoid symbol names beginning with capital letters. Then, to obtain a series expansion in powers of $1/z$, expand the expression around infinity, not zero: Series[a + b (1 - Exp[-t/(b c)]/(z - Exp[-t/(b c)])) , {z, Infinity, 5}] $(a+b)-\frac{b e^{-...


16

(Edited; original at the end) Gram-Schmidt orthogonalization provides an answer. Let's use a running example to illustrate. It begins even before the Chebyshev polynomials, with their domain--the interval $[-1,1]$--and the kernel for which they are orthogonal: limits = {-1, 1}; k[x_] := 2/Sqrt[1 - x^2]/Pi; The Chebyshev polynomials are obtained by ...


16

If you're new to Mathematica, then it might make sense to explore these kinds of basic things via the natural language interface. Assuming that you're connected to the internet, so Mathematica can access WolframAlpha's servers, just type = power series sinx Note that the equals sign will be reformatted to look like it's part of the WolframAlpha input ...


15

Here's an attempt: multiTaylor[f_, {vars_?VectorQ, pt_?VectorQ, n_Integer?NonNegative}] := Sum[Nest[(vars - pt).# &, (D[f, {vars, \[FormalK]}] /. Thread[vars -> pt]), \[FormalK]]/\[FormalK]!, {\[FormalK], 0, n}, Method -> "Procedural"] multiTaylor[f[x, y], {{x, y}, {0, 0}, 2}] f[...


15

This method of developing a truncated solution can be done as below. I illustrate with an example that DSolve does not seem much to like. ode = x''[t] - t*x'[t] + Sin[t] == 0; initconds = {x'[0] == 1, x[0] == 0}; We create a differentail operator to create this ode. odeOperator = D[#, {t, 2}] - t*D[#, t] + Sin[t] &; Now set up our Taylor series as ...


13

Series Expansion Answering the question we show how to construct the series expansion of f[x] about x=0. From the basic equation we find f'[x]==2(Log[a x + b]-Log[Cosh[f[x]]]) the derivative of f[x] in terms of the function f[x] itself and some other terms. Hence in the Taylor expansion of the function f[x] = f[0] + x f'[0] + x^2/2! f''[0] + x^3/3! f''...


12

Had InverseSeries[] not been a built-in function, one option might be to invert the Carleman matrix corresponding to the function: CarlemanMatrix[f_, {x_, x0_, {m_Integer, n_Integer}}] := Prepend[Table[ If[k == 0, Function[x, f][x0]^j, BellY[Table[{FactorialPower[j, i] Which[#2 == 0, 1, #1 == 0, 0, True, #1^#2] &[Function[x, f][x0], j - ...


12

Is InverseSeries what you are looking for? InverseSeries[Series[ArcTan[Log[1 + x]/(1 + x)], {x, 0, 5}]] (* x+(3 x^2)/2+3 x^3+(149 x^4)/24+(68 x^5)/5+O[x]^6 *) EDIT: looks reasonable: Plot[{ pl[x], invs }, {x, -.3, .3}, PlotStyle -> {{Dashed, Black}, Red} ] Who knows what the radius of convergence is, though.


12

For polynomials, you don't need to do any integrals to find the expansion. Take a polynomial p and a list basis containing the basis functions. Then define a function that takes these two, identifies the variable x, and solves for the coefficients in basis that make the two polynomials equal in terms of their CoefficientLists: expandPoly[p_, basis_, x_] := #...


12

Chances are it will behave similarly to Integrate[Exp[-x t^3 ], {t, 0, π/2}]. I show a numerical verification below. We'll use the dominant series term, which we can compute, for the above integral, and compare to numerical integrations of the one we cannot compute analytically. ee1[x_] := Exp[-x*t^3] ee2[x_] := Exp[-x*t^3*Cos[t]]; Let's get the candidate ...


12

One slick way to derive the analytic Chebyshev series of a function is to use the relationship between the Chebyshev polynomials and the cosine, and then use the built-in FourierCosSeries[]. As an example: f[x_] := Exp[x]; n = 5; (* degree of approximation *) approx[x_] = FourierCosSeries[f[Cos[t]], t, n] /. Cos[k_. t] :> ChebyshevT[k, x] (Note that ...


12

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 ...


11

Try this Normal@Series[expr/.{f->x f, g->x^2 g, h->x^3 h},{x,0,4}] /.x->1


11

The Hermite polynomials are orthogonal with respect to the inner product $$\langle f,g \rangle = \int_{-\infty}^{\infty} f(x)g(x)e^{-x^2} \, \mathrm dx.$$ Thus, the $n$-th coefficient can be computed using the inner product of your polynomial with the $n$-th normalized Hermite polynomial. Example: p[x_] = 1 + x + x^2 + x^3; coeffs = Table[ Integrate[...


11

Partial sums of this sequence are given by: Sum[(-1)^(n + 1) Cos[3^n x]^3/3^n, {n, 1, m}] (* output: 1/4 Cos[3 x] - 1/4 (-(1/3))^m Cos[3^(1 + m) x] *) For real $x$, we know this converges because $\cos(3^{1+m}x)$ is bounded. Mathematica does not assume $x$ is real and, as Bob Hanlon notes, will produce the correct result by evaluating a partial sum, ...


11

There is a straightforward answer analogous to that in Maple : Coefficient[ Sum[t^i, {i, 5}] Sum[t^i, {i, 2, 6}] Sum[t^i, {i, 3, 9}], t, 15] 19 This can be verified by expanding the polynomial: Expand[ Sum[t^i, {i, 5}] Sum[t^i, {i, 2, 6}] Sum[t^i, {i, 3, 9}]] However you can do it in many different ways e.g. by exploiting CoefficientRules or ...


11

@Artes's use of Coefficient certainly seems the most straightforward and probably the best for small examples. If the polynomials have very many terms, the use of SeriesData to represent the polynomials will give better performance. The multiplication of series is efficient in Mathematica. One should note that it is truncated beyond the maximum degree ...


11

Note that the expression returned by Sum is correct and equals $x(1-x)$ for $0 \leq x \leq 1$. I assume your question is how to simplify the expression into $x(1-x)$? I was able to hack a solution, and unfortunately I don't think it scales very well to other expressions. But here goes: First, evaluate the sum: sum = 1/6 - Sum[Cos[2 x Pi n]/(Pi n)^2, {n, ...


10

After you define your function execute this line: Series[f, {x, \[Infinity], 1}] // Normal // PowerExpand Following your $x \gg a$ we can rewrite it as % /. (-a + x) -> x // FullSimplify which gives: Now you have to be very careful dealing with derivative. It is not enough to keep 0th and 1st terms (as you did) - you will loose information. ...


10

Here is another variant along the same lines as @whuber proposed. Consider function $$ f(x,y,z,t)=\sum _{i=1}^{\infty } \sum _{j=1}^{\infty } \sum _{k=1}^{\infty } x^{i-1} y^{j-1} z^{k-1} t^{i+j+k}. $$ Mma gives f[x_, y_, z_, t_] = Sum[x^(i - 1) y^(j - 1) z^(k - 1) t^(i + j + k), {i, 1, \[Infinity]}, {j, 1, \[Infinity]}, {k, 1, \[Infinity]}] $$ -\...


10

Let's look at the InputForm of your expression: expr = 3.4235 + (4.22 - 5.2342 I) a + 7.543 a^6 + O[a]^7; InputForm[expr] SeriesData[a, 0, {3.4235, 4.22 - 5.2342*I, 0, 0, 0, 0, 7.543}, 0, 7, 1] You want to set all the coefficients to one, so let's do that with Unitize: MapAt[Unitize, expr, 3] 1 + a + a^6 + O[a]^7 Or, if you prefer, as a Rule: ...


10

You can use b.gatessucks idea to make it analytically: f[t_] = Exp[z - 1/z] /. z -> E^(I t) // FullSimplify then integrate: 1/(2 Pi) Integrate[E^(I t) f[t], {t, 0, 2 Pi}] (* -BesselJ[1, 2] *)


10

The fastest way to do this is to note that for any function $f$ with a convergent power series, the quasi-hyperbolic function $$g(x)=\frac{f(ix)-f(-ix)}{2i}$$ has the power series of $f$ with only odd, alternating sign terms (provided that it converges). Here's an example: f[x_] := x + x^2 + x^3 - x^4; (f[I x] - f[-I x])/(2 I) // Simplify which produces ...


10

It seems, that findExponentialGeneratingFunction would be equivalent to FindGeneratingFunction of the sequence {a1/0!,a2/1!,a3/2!,...}. Therefore findExponentialGeneratingFunction = FindGeneratingFunction[#1/(Factorial /@ Range[0, Length@#1 - 1]), #2] & findExponentialGeneratingFunction[{1,1,1,1,1,1,1,1},x] (* Exp[x] *)


10

Using Series as suggested by Wolfgang Hintze: Series[n!, {n, Infinity, 4}]/(Sqrt[2 π n] n^(n Exp[n])) // FullSimplify (*Exp[(-1 - Log[1/n]) n + SeriesData[n, DirectedInfinity[1], {}, -1, 1, 1]^5] * (SeriesData[n, Infinity, {1, 0, 1/12, 0, 1/288, 0, -139/51840, 0, -571/2488320}, 0, 10, 2]/n^(E^n*n))*) Also, Eric W. Weisstein provides some ...


10

You can just take Bob Hanlon's answer from 2006 directly, and modify the plot just a bit to update it. ChebyshevApprox[n_Integer?Positive, f_Function, x_] := Module[{c, xk}, xk = Pi (Range[n] - 1/2)/n; c[j_] = 2*Total[Cos[j*xk]*(f /@ Cos[xk])]/n; Total[Table[c[k]*ChebyshevT[k, x], {k, 0, n - 1}]] - c[0]/2]; f = 3*#^2*Exp[-2*#]*Sin[2 #*Pi] &; ...



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