2

The following asymptotic

AsymptoticIntegrate[Sqrt[n^2 - k^2], {k, 1, n - 1}, {n, Infinity, 1}]

fails in 13.3 on Windows 10, returning the input. However, the following

Assuming[n >= 3, AsymptoticIntegrate[ Sqrt[n^2 - k^2], {k, 1, n - 1}, {n, Infinity, 1}]]

1/(6 n) + 1/(5 Sqrt[2] Sqrt[n]) - (2 Sqrt[2] Sqrt[n])/3 - n + ( n^2 \[Pi])/4

works well. What is the reason of it? I don't find any explanation in the documentation.

user64494
  • 26,149
  • 4
  • 27
  • 56
  • AsymptoticIntegrate[Sqrt[n^2 - k^2], {k, 1, n - 1}, {n, Infinity, 1}, PerformanceGoal -> "Quality"] also fails. – user64494 Jan 23 '24 at 07:18
  • The @Nasser's answer does not explain why AsymptoticIntegrate[Sqrt[n - k], {k, 1, n - 1}, {n, Infinity, 1}] works well, producing -(2/3) + 1/(4 Sqrt[n]) - Sqrt[n] + (2 n^(3/2))/3 – user64494 Jan 23 '24 at 10:08
  • I'm waiting for a rich-in-content answer. – user64494 Jan 23 '24 at 10:15
  • I'd like to add that Assuming[n >= - 30, AsymptoticIntegrate[ Sqrt[n^2 - k^2], {k, 1, n - 1}, {n, Infinity, 1}]] performs 1/(6 n) + 1/(5 Sqrt[2] Sqrt[n]) - (2 Sqrt[2] Sqrt[n])/3 - n + ( n^2 \[Pi])/4 . – user64494 Jan 23 '24 at 19:12

1 Answers1

5

It seems because Integrate itself needs to know n is in integer domain.

Compare

Integrate[Sqrt[n^2 - k^2], {k, 1, n - 1}]

Which does not evaluate, with

Assuming[Element[n, Integers],  Integrate[Sqrt[n^2 - k^2], {k, 1, n - 1}]]

Which evaluates giving

Mathematica graphics

Hence your command becomes now

Assuming[Element[n, Integers], 
   AsymptoticIntegrate[Sqrt[n^2 - k^2], {k, 1, n - 1}, {n, Infinity, 1}]]

Mathematica graphics

V 14

Nasser
  • 143,286
  • 11
  • 154
  • 359
  • Sorry, your attempt of the explanation is somewhat light-weighted: (i) Assuming[Element[n, PositiveReals], AsymptoticIntegrate[ Sqrt[n^2 - k^2], {k, 1, n - 1}, {n, Infinity, 1}]] works well; (ii) Integrate[Sqrt[n^2 - k^2], {k, 1, n - 1}, GenerateConditions -> False] performs 1/2 ((-1 + n) Sqrt[-1 + 2 n] - Sqrt[-1 + n^2] + n^2 ArcTan[(-1 + n)/Sqrt[-1 + 2 n]] - n^2 ArcTan[1/Sqrt[-1 + n^2]]). Thank you anyway. – user64494 Jan 23 '24 at 07:52
  • Moreover, even Assuming[Element[n, Reals], AsymptoticIntegrate[ Sqrt[n^2 - k^2], {k, 1, n - 1}, {n, Infinity, 1}]] and Assuming[Element[n, Reals], AsymptoticIntegrate[ Sqrt[n^2 - k^2], {k, 1, n - 1}, {n, -Infinity, 1}]] work. – user64494 Jan 23 '24 at 08:00
  • 1
    @user64494 OK, then use Assuming[Element[n, Reals]. Basically the issue is that Integrate needed to know it is not complex. I used Integers and found it to work. If Reals works, it leads to same conclusion. Integrate needed to know what domain n is in,. Did you really had to down vote me just for this? – Nasser Jan 23 '24 at 08:16
  • Did you carefully read my comment? I repeat that Integrate[Sqrt[n^2 - k^2], {k, 1, n - 1}, GenerateConditions -> False] without any assumptions performs 1/2 ((-1 + n) Sqrt[-1 + 2 n] - Sqrt[-1 + n^2] + n^2 ArcTan[(-1 + n)/Sqrt[-1 + 2 n]] - n^2 ArcTan[1/Sqrt[-1 + n^2]]) and then Series[%,{n,Infinity,1} does the work. – user64494 Jan 23 '24 at 08:30
  • 2
    @user64494 that is because when you add GenerateConditions -> False you are bypassing the code that caused it not to evaluate when no domain is given. It was hanging in the code which you told it not to evaluate. It is well know that GenerateConditions -> False can make many integrals not hang when they will otherwise will, since the default is GenerateConditions -> True. Of if they not hang, they will evaluate much faster when adding GenerateConditions -> False – Nasser Jan 23 '24 at 08:47
  • Sorry, I prefer formulas and arguments over ungrounded statements. – user64494 Jan 23 '24 at 09:13
  • 2
    @user64494 you want me to give a formula for saying that GenerateConditions->True can cause much more code to be evaluated and can sometime lead to hangs or slower evaluation? I've seen this many times. May be search can show some examples. But I have no time now to search for examples. But you can see this as reference what-exactly-does-generateconditions-do – Nasser Jan 23 '24 at 09:54
  • From above by Daniel Lichtblau himself: GenerateConditions -> False will both skip some code for checking parameter regions of validity for an integral, and also a regularized integral might be computed And so defaulting to True at all levels might keep many inputs from running to completion. – Nasser Jan 23 '24 at 09:56
  • Nasser (@ does not work): Sorry, your answer does not explain why AsymptoticIntegrate[Sqrt[n - k], {k, 1, n - 1}, {n, Infinity, 1}] works well, producing -(2/3) + 1/(4 Sqrt[n]) - Sqrt[n] + (2 n^(3/2))/3. I will be waiting for a rich-in-content answer. – user64494 Jan 23 '24 at 10:08
  • BTW, Integrate[Sqrt[n^2 - k^2], {k, 1, n - 1}, GenerateConditions -> True] is running without any response in a fresh kernel on my comp during a half an hour. PS. At last, it produces ConditionalExpression[ 1/2 (-Sqrt[-1 + 2 n] + n Sqrt[-1 + 2 n] - Sqrt[-1 + n^2] + n^2 (-ArcCsc[n] + ArcSin[(-1 + n)/n])), Re[n] > 2 && Im[n] == 0]. – user64494 Jan 23 '24 at 10:39
  • It's interesting that Integrate[Sqrt[n^2 - k^2], {k, 1, n - 1}] results in ConditionalExpression[ 1/2 ((-1 + n) Sqrt[-1 + 2 n] - Sqrt[-1 + n^2] + n^2 ArcTan[(-1 + n)/Sqrt[-1 + 2 n]] - n^2 ArcTan[1/Sqrt[-1 + n^2]]), ]. – user64494 Jan 23 '24 at 10:52
  • 3 + (6 + 4 Sqrt[3]) Im[n]^2 + 2 Sqrt[3] Re[n] <= 2 (3 + 2 Sqrt[3]) Re[n]^2 && ((-1 + n)/(-2 + n) \[NotElement] Reals || Re[(-1 + n)/(-2 + n)] < 0 || ((Re[(-1 + n)/(-2 + n)] >= 1 || Re[(-1 + n)/(-2 + n)] <= 0) && (( 1 - n)/(-2 + n) \[NotElement] Reals || Re[(1 - n)/(-2 + n)] < -1))) && ((1 + n)/( 2 - n) \[NotElement] Reals || Re[(1 + n)/(2 - n)] < 0 || ((Re[(1 + n)/(2 - n)] >= 1 || Re[(1 + n)/(2 - n)] <= 0) && ((1 + n)/(-2 + n) \[NotElement] Reals || Re[(1 + n)/(-2 + n)] < -1))) – user64494 Jan 23 '24 at 10:52
  • @user64494, there is no space after @. It automatically shows you what to autocomplete. Anyway, does the Integral make sense for Complex? I mean, it is clearly defaulting to Complex by default, be it variables or method of integrating. Remember this funny thing that is an exception: https://mathematica.stackexchange.com/a/272799/82985 – Валерий Заподовников Jan 23 '24 at 12:44
  • @ВалерийЗаподовников: Sorry, all that is off-topic. Thank you anyway. – user64494 Jan 23 '24 at 12:56