Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

As shown by bbgodfreybbgodfrey , NIntegrate can solve your problem, but I just want to add, Integrate can actually handle InterpolatingFunction:

int[t_] = Integrate[y1[t] /. S1, t]

The output is an InterpolatingFunction representing the definite integral of $y_1(t)$ over $[0,t]$. The advantage of this approach is, you don't need to integrate again and again if you want to know the integral at other points. Just compare the following:

Table[int@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {0.015558, Null} *)
int2[tt_] := NIntegrate[y1[t] /. S1, {t, 0, tt}]
Table[int2@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {2.340323, Null} *)

Then

同学,如果你现在所获得的两个答案中的某一个真的帮到了你的话,你完全可以点一下你所满意的答案旁边的小勾(也就是上面那条评论里所说的Click the checkmark sign)来把它采纳(accept)了的。

As shown by bbgodfrey , NIntegrate can solve your problem, but I just want to add, Integrate can actually handle InterpolatingFunction:

int[t_] = Integrate[y1[t] /. S1, t]

The output is an InterpolatingFunction representing the definite integral of $y_1(t)$ over $[0,t]$. The advantage of this approach is, you don't need to integrate again and again if you want to know the integral at other points. Just compare the following:

Table[int@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {0.015558, Null} *)
int2[tt_] := NIntegrate[y1[t] /. S1, {t, 0, tt}]
Table[int2@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {2.340323, Null} *)

Then

同学,如果你现在所获得的两个答案中的某一个真的帮到了你的话,你完全可以点一下你所满意的答案旁边的小勾(也就是上面那条评论里所说的Click the checkmark sign)来把它采纳(accept)了的。

As shown by bbgodfrey , NIntegrate can solve your problem, but I just want to add, Integrate can actually handle InterpolatingFunction:

int[t_] = Integrate[y1[t] /. S1, t]

The output is an InterpolatingFunction representing the definite integral of $y_1(t)$ over $[0,t]$. The advantage of this approach is, you don't need to integrate again and again if you want to know the integral at other points. Just compare the following:

Table[int@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {0.015558, Null} *)
int2[tt_] := NIntegrate[y1[t] /. S1, {t, 0, tt}]
Table[int2@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {2.340323, Null} *)

Then

同学,如果你现在所获得的两个答案中的某一个真的帮到了你的话,你完全可以点一下你所满意的答案旁边的小勾(也就是上面那条评论里所说的Click the checkmark sign)来把它采纳(accept)了的。

replaced http://meta.stackexchange.com/ with https://meta.stackexchange.com/
Source Link

As shown by bbgodfrey , NIntegrate can solve your problem, but I just want to add, Integrate can actually handle InterpolatingFunction:

int[t_] = Integrate[y1[t] /. S1, t]

The output is an InterpolatingFunction representing the definite integral of $y_1(t)$ over $[0,t]$. The advantage of this approach is, you don't need to integrate again and again if you want to know the integral at other points. Just compare the following:

Table[int@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {0.015558, Null} *)
int2[tt_] := NIntegrate[y1[t] /. S1, {t, 0, tt}]
Table[int2@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {2.340323, Null} *)

Then

同学,如果你现在所获得的两个答案中的某一个真的帮到了你的话,你完全可以点一下你所满意的答案旁边的小勾(也就是上面那条评论里所说的Click the checkmark signClick the checkmark sign)来把它采纳(accept)了的。

As shown by bbgodfrey , NIntegrate can solve your problem, but I just want to add, Integrate can actually handle InterpolatingFunction:

int[t_] = Integrate[y1[t] /. S1, t]

The output is an InterpolatingFunction representing the definite integral of $y_1(t)$ over $[0,t]$. The advantage of this approach is, you don't need to integrate again and again if you want to know the integral at other points. Just compare the following:

Table[int@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {0.015558, Null} *)
int2[tt_] := NIntegrate[y1[t] /. S1, {t, 0, tt}]
Table[int2@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {2.340323, Null} *)

Then

同学,如果你现在所获得的两个答案中的某一个真的帮到了你的话,你完全可以点一下你所满意的答案旁边的小勾(也就是上面那条评论里所说的Click the checkmark sign)来把它采纳(accept)了的。

As shown by bbgodfrey , NIntegrate can solve your problem, but I just want to add, Integrate can actually handle InterpolatingFunction:

int[t_] = Integrate[y1[t] /. S1, t]

The output is an InterpolatingFunction representing the definite integral of $y_1(t)$ over $[0,t]$. The advantage of this approach is, you don't need to integrate again and again if you want to know the integral at other points. Just compare the following:

Table[int@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {0.015558, Null} *)
int2[tt_] := NIntegrate[y1[t] /. S1, {t, 0, tt}]
Table[int2@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {2.340323, Null} *)

Then

同学,如果你现在所获得的两个答案中的某一个真的帮到了你的话,你完全可以点一下你所满意的答案旁边的小勾(也就是上面那条评论里所说的Click the checkmark sign)来把它采纳(accept)了的。

added 306 characters in body
Source Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489

As shown by bbgodfrey , NIntegrate can solve your problem, but I just want to add, Integrate can actually handle InterpolatingFunction, in a quite fast way:

NIntegrate[y1[t]int[t_] = Integrate[y1[t] /. S1, t]

The output is an InterpolatingFunction representing the definite integral of $y_1(t)$ over $[0,t]$. The advantage of this approach is, you don't need to integrate again and again if you want to know the integral at other points. Just compare the following:

Table[int@t, {t, 0, 100, 1/10}]]; // AbsoluteTiming
(* {0.015559015558, {1.17532*10^9}Null} *)
(int[t_]int2[tt_] := Integrate[y1[t]NIntegrate[y1[t] /. S1, t];{t, int[100])0, tt}]
Table[int2@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {02.340323, {1.17532*10^9}Null} *)

Then

同学,如果你现在所获得的两个答案中的某一个真的帮到了你的话,你完全可以点一下你所满意的答案旁边的小勾(也就是上面那条评论里所说的Click the checkmark sign)来把它采纳(accept)了的。

As shown by bbgodfrey , NIntegrate can solve your problem, but I just want to add, Integrate can actually handle InterpolatingFunction, in a quite fast way:

NIntegrate[y1[t] /. S1, {t, 0, 100}] // AbsoluteTiming
(* {0.015559, {1.17532*10^9}} *)
(int[t_] = Integrate[y1[t] /. S1, t]; int[100]) // AbsoluteTiming
(* {0., {1.17532*10^9}} *)

Then

同学,如果你现在所获得的两个答案中的某一个真的帮到了你的话,你完全可以点一下你所满意的答案旁边的小勾(也就是上面那条评论里所说的Click the checkmark sign)来把它采纳(accept)了的。

As shown by bbgodfrey , NIntegrate can solve your problem, but I just want to add, Integrate can actually handle InterpolatingFunction:

int[t_] = Integrate[y1[t] /. S1, t]

The output is an InterpolatingFunction representing the definite integral of $y_1(t)$ over $[0,t]$. The advantage of this approach is, you don't need to integrate again and again if you want to know the integral at other points. Just compare the following:

Table[int@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {0.015558, Null} *)
int2[tt_] := NIntegrate[y1[t] /. S1, {t, 0, tt}]
Table[int2@t, {t, 0, 100, 1/10}]; // AbsoluteTiming
(* {2.340323, Null} *)

Then

同学,如果你现在所获得的两个答案中的某一个真的帮到了你的话,你完全可以点一下你所满意的答案旁边的小勾(也就是上面那条评论里所说的Click the checkmark sign)来把它采纳(accept)了的。

added 25 characters in body
Source Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489
Loading
Source Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489
Loading