5
$\begingroup$

Let's suppose that for the following expression:

$\qquad \alpha\,\beta +\alpha+\beta$

I know that $\alpha$ and $\beta$ are of small magnitude (e.g., 0 < $\alpha$ < 0.02 and 0 < $\beta$ < 0.02). Therefore, the magnitude of $\alpha\,\beta$ is negligible, i.e., the original expression can be approximated by

$\qquad \alpha+\beta$

Is there any command in Mathematica to do such an operation?


Reminder from original question: if and $\alpha$ and $\beta$ are of small magnitude, we may approximate the original equation by disregarding nonlinear terms, such as $\alpha^n$, $\beta^n$,n=2,3,..., and $\alpha\beta$

My observation is that by applying the good code suggestion of @Henrik Schumacher in a fraction it seems to not generate a proper result to the whole fraction. For instance,if

$\text{numerator}=\alpha \beta +\alpha +\beta ^2+\beta -\lambda \epsilon q(t)+\text{$\beta $q}(t)$

numerator = α*β + β^2 + α + β + β q[t] - ϵ*λ*q[t]

f = numerator; 
(f /. {α -> 0, β -> 0}) + (D[f, {{α, β}, 1}] /. {α -> 0, β -> 0}) . {α, β}

The code generates the correct elimination on numerator :$\alpha +\beta -\lambda \epsilon q(t)+\text{$\beta $q}(t)$

and

$\text{denominator}=\alpha +\alpha (-\beta ) \text{LD}(t)+\alpha \beta q(t)+\beta q(t)+\epsilon +1$:

denominator= 1  +α  +ϵ   -α*β*LD[t]   +β*q[t]   +α*β*q[t]

f = denominator; 
(f /. {α -> 0, β -> 0}) + (D[f, {{α, β}, 1}] /. {α -> 0, β -> 0}) . {α, β}

The code generates the correct elimination on denominator: $\alpha +\beta q(t)+\epsilon +1$

Nevertheless, when applying the suggested first order Taylor Series expansion in the fraction as a whole:

f = (numerator /denominator);
(f /. {α -> 0, β -> 0}) + (D[
  f, {{α, β}, 1}] /. {α -> 0, β -> 
   0}).{α, β} // Simplify

The result generated is incorrect. $\frac{(\epsilon +1) (\alpha +\beta )-q(t) (\lambda \epsilon (-\alpha +\epsilon +1)+\beta \text{$\beta $q}(t))+\beta \lambda \epsilon q(t)^2+(-\alpha +\epsilon +1) \text{$\beta $q}(t)}{(\epsilon +1)^2}$

That can be observed by, for instant, noticing that in the output above (i) the numerator has $\beta^2$, (ii) the code generated $q[t]^2$ that did not exist in the original equation.

I hope that this time I could express my concern in a proper format. Thank you all for your support!


Questions related to @Akku14's code suggestion

Question 1: @Akku14, I was trying to use your code suggestion with the slight modification in the original purpose(instead of eliminating α and β, now eliminating α, β and LD[t]), but I had no success. I think the reason is because I could not find a way of writing LD[t] as a parameter of function g:

for the following equation:

\[CapitalDelta]p[t] = (α*β + β^2 + α + β + β*q[t] - ϵ*λ*q[t])/(1 + α + ϵ -α*LD[t] + β*q[t] + α*β*q[t])

$\text{$\Delta $p}(t)=\frac{\alpha \beta +\alpha +\beta ^2+\beta +\beta q(t)-\lambda \epsilon q(t)}{\alpha +\alpha (-\text{LD}(t))+\alpha \beta q(t)+\beta q(t)+\epsilon +1}$

g[α_, β_, LD[t] _] = \[CapitalDelta]p[t] 

By using @Akku14's suggestion:

ser = (Series[g[α eps, β eps, LD[t] eps], {eps, 0, 1}] //
  Normal) /. eps -> 1 // Simplify

I get the following output:

$\frac{(\epsilon +1) (\alpha +\beta )+q(t) (\lambda \epsilon (\alpha -\epsilon -1)+\beta (\epsilon +1)-\alpha \lambda \epsilon LD[t]+\beta \lambda \epsilon q(t)^2}{(\epsilon +1)^2}$

which is incorrect since $\alpha \lambda \epsilon LD[t]$ is present in the numerator of ser.

Again, I think that the problem is that my g is not recognizing LD[t] as a parameter; would any of you know how to approach this issue?

Question 2.1: in case I wanted second order Taylor Series for g[α, β, LD[t]], changing {eps, 0, 1} to {eps, 0, 2} at ser would be enough to get the correct result? Like:

ser = (Series[g[α eps, β eps, LD[t] eps], {eps, 0, 2}] //
  Normal) /. eps -> 1 // Simplify

Question 2.2: in case I wanted n order Taylor Series for g[α, β, LD[t]], changing {eps, 0, 1} to {eps, 0, n} at ser would be enough to get the correct result?

$\endgroup$
6
  • 1
    $\begingroup$ Duplicate? $\endgroup$ May 13, 2018 at 21:23
  • 1
    $\begingroup$ Please post actual code, something that can be cut-and-pasted. $\endgroup$ May 14, 2018 at 23:05
  • $\begingroup$ There is a space missing between β and q[t] in the definition of the numerator. Inserting it should fix everything. $\endgroup$ May 15, 2018 at 7:29
  • $\begingroup$ Btw.: That was one of the reasons to ask for a copy of the precise code you used. $\endgroup$ May 15, 2018 at 8:20
  • $\begingroup$ Dear @HenrikSchumacher, thank you for point that out, but unfortunately even after fixing $\beta$q[t] to $\beta *q[t] $ it still generate incorrect results. $\endgroup$ May 16, 2018 at 14:38

3 Answers 3

3
$\begingroup$

Let me give a slightly different form, that is - as far as I see quickly - equivalent to that of Henrik Schumacher, and show, why there appears a q[t]^2 term.

f[a_, b_] := a b + a + b

Take series for small eps, and fix the result with eps->1

(Series[f[a eps, b eps], {eps, 0, 1}] // Normal) /. eps -> 1

(*   a + b   *)

Higher orders give the original function

(Series[f[a eps, b eps], {eps, 0, 5}] // Normal) /. eps -> 1

(*   a + b + a b   *)

Now the rational function

numerator[a_, b_] := 
      a*b + b^2 + a + b + b q[t] - ϵ*λ*q[t]

denominator[a_, b_] := 
    1 + a + ϵ - a*b*LD[t] + b*q[t] + a*b*q[t]

ser0 = (Series[
  numerator[a eps, b eps]/denominator[a eps, b eps], {eps, 0, 
   1}] // Normal) /. eps -> 1 // Together

(*   (1/((1 + ϵ)^2))(a + b + a ϵ + b ϵ + 
      b q[t] + b ϵ q[t] - ϵ λ q[t] + 
      a ϵ λ q[t] - ϵ^2 λ q[t] + 
      b ϵ λ q[t]^2)   *)

Taking separate series

ser1 = (Series[numerator[a eps, b eps], {eps, 0, 1}] // Normal) /. 
         eps -> 1 // Together

(*   a + b + b q[t] - ϵ λ q[t]   *)

ser2 = (Series[denominator[a eps, b eps], {eps, 0, 1}] // Normal) /. 
         eps -> 1 // Together

(*   1 + a + ϵ + b q[t]   *)

Although ser1/ser2 has no q[t]^2 term, it has a term q[t]/(1 + b q[t]) which yields a q[t]^2 term with small b

(Series[q[t]/(1 + b q[t]) /. {a -> a eps, b -> b eps}, {eps, 0, 1}] //
Normal) /. eps -> 1

(*   q[t] - b q[t]^2   *)

Therefore further series ser3 has to be done, that yields the same result as ser0

ser3 = (Series[ser1/ser2 /. {a -> a eps, b -> b eps}, {eps, 0, 1}] // 
         Normal) /. eps -> 1 // Together

(*   (1/((1 + ϵ)^2))(a + b + a ϵ + b ϵ + 
      b q[t] + b ϵ q[t] - ϵ λ q[t] + 
      a ϵ λ q[t] - ϵ^2 λ q[t] + 
      b ϵ λ q[t]^2)   *)

ser3 == ser0

(*   True   *)
$\endgroup$
1
  • $\begingroup$ Thanks @Akku14, I will soon check your suggestion. $\endgroup$ May 16, 2018 at 14:42
4
$\begingroup$

You could use first order Taylor expansion, e.g. with

f = α β + α + β;
(f /. {α -> 0, β -> 0}) + (D[f, {{α, β}, 1}] /. {α -> 0, β ->0}).{α, β}

$\alpha +\beta$

For your second example (with typos fixed), I obtain

numerator = α β + β^2 + α + β + β q[t] - ϵ λ q[t];
denominator = 1 + α + ϵ - α β LD[t] + β q[t] + α β q[t];
f = numerator/denominator;
(f /. {α -> 0, β -> 0}) + (D[ f, {{α, β}, 1}] /. {α -> 0, β -> 0}).{α, β}

$$\alpha \left(\frac{\lambda \epsilon q(t)}{(\epsilon +1)^2}+\frac{1}{\epsilon +1}\right)+\beta \left(\frac{\lambda \epsilon q(t)^2}{(\epsilon +1)^2}+\frac{q(t)+1}{\epsilon +1}\right)-\frac{\lambda \epsilon q(t)}{\epsilon +1}$$

$\endgroup$
1
  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$
    – Kuba
    May 15, 2018 at 5:48
2
$\begingroup$

I would follow the approach recommended by @Jens in the linked answer, which is similar to the answer by @Akku ( It is different since @Akku takes series of the numerator and denominator separately, and then finds the series of the ratio after normalizing). Introduce a dummy scaling variable, and then do a series expansion about the scaling variable:

r = Normal @ Series[numerator/denominator /. v : α|β -> s v, {s, 0, 1}] /. s->1

-ϵ λ q[t]/(1 + ϵ) + (α + β + α ϵ + β ϵ + β q[t] + β ϵ q[t] + α ϵ λ q[t] + β ϵ λ q[t]^2)/(1 + ϵ)^2

We can use Collect to get this into basically the same form as @Henrik's answer:

Collect[r, {α, β}, Apart] //TeXForm

$\alpha \left(\frac{\lambda \epsilon q(t)}{(\epsilon +1)^2}+\frac{1}{\epsilon +1}\right)+\beta \left(\frac{\lambda \epsilon q(t)^2}{(\epsilon +1)^2}+\frac{q(t)}{\epsilon +1}+\frac{1}{\epsilon +1}\right)-\frac{\lambda \epsilon q(t)}{\epsilon +1}$

This approach will scale much better for higher order expansions.

$\endgroup$
1
  • $\begingroup$ to @Carl Woll. I take the series of the numerator and the denominator separately, only in order to show, how the term q[t]^2 arises, because Lucas Santana was astonished about that term. My ser0 is indeed the series expansion of the whole expression. $\endgroup$
    – Akku14
    May 17, 2018 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.