0

I have the following integral to evaluate numerically: $$x(t) = \frac{1}{f(t)}\int_0^{t_b} t^m (t + n)^o \sin(pt) \mathrm{d}t \quad m,n,o,p \in \mathbb{R}$$

x[t]== f[t]^-1 Integrate[t^m*(t + n)^o*Sin[p t], {t, 0, tb}]

$t_b, m, n, o,$ and $p$ are known constants. I'm quite confident that it is straightforward to employ NIntegrate to solve [and plot] x(t) if it lacks $\frac{1}{f(t)}$ but I'm unsure about how to go about evulating the above integral and then generating plots. Any advice on the same would be great help.

Thanks.

rhermans
  • 36,518
  • 4
  • 57
  • 149
gadha007
  • 21
  • 1
  • I don't see the problem... 1/f(t) is not inside the integral (?) – Ivan Sep 19 '14 at 03:32
  • Yeah, that's my problem. – gadha007 Sep 19 '14 at 03:40
  • 1
    Well, if it's not inside the integral, you can just simply use NIntegrate[t^m(t + n)^oSin[p t], {t, 0, tb}] and get a number. – Ivan Sep 19 '14 at 04:01
  • I need the entire expression on the RHS to be evaluated at every time step, however. I've done a poor job of asking the question in retrospect, I guess. But hopefully that helps clarify my issue. So, basically, I need a list of values for x[t] so that I can plot that and see how x varies with t. – gadha007 Sep 19 '14 at 09:42
  • a little more about what it is I'm trying to do. I have solved an exact ode and plotted some behaviour for $x$. I have then proceeded to solve for $x$ through some approximation and finally obtained the above expression. But now I need to evaluate the expression at discrete instants so that I can plot $x$ and compare the analytical result from approximation to the simulated result. – gadha007 Sep 19 '14 at 10:51
  • Do m and o happen to be integers? Positive integers? (Btw, the use of o as a parameter is a rather bad choice: so easily confused with zero.) – Michael E2 Sep 19 '14 at 12:28
  • I would assume the function you want is $x(t_b) = \frac{1}{f(t_b)}\int_0^{t_b} t^m (t + n)^o \sin(pt) ;dt$, since the integral is not a function of $t$ -- is that correct? (The confusing part is the use of the dummy variable $t$ inside the integral and as a free variable in the definition of $x(t)$.) – Michael E2 Sep 19 '14 at 12:33
  • 5
    This question shows how to numerically approximate an integral as a function of the end point. Do the answers to it solve your problem? It seems fundamentally the same question. – Michael E2 Sep 19 '14 at 12:36
  • 1
    @Michael E2 sorry. Yes. You're right. That's what the equation is. I'll check out the link you posted. Thanks. – gadha007 Sep 19 '14 at 18:02

0 Answers0