Re: Nested numerical integral - speed: Is it suppose to be so slow?
- To: mathgroup at smc.vnet.net
- Subject: [mg127643] Re: Nested numerical integral - speed: Is it suppose to be so slow?
- From: W Craig Carter <ccarter at MIT.EDU>
- Date: Fri, 10 Aug 2012 02:43:01 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <20120809075343.71F12664F@smc.vnet.net>
Hello Sune, I believe you can work symbolically: trap[t_, t1_, t2_, a_] := Piecewise[{{0, t < 0 || t >= t1 + t2}, {a t, t >= 0 && t < t1}, {a t1, t >= t1 && t < t2}, {a (-t + t1 + t2), t >= t2 && t < t1 + t2}}] tplus = Integrate[trap[t, t1, t2, a], {u, 0, t}, Assumptions -> Element[{g, a, \[Delta], \[CapitalDelta], t}, Reals]] tminus = Integrate[trap[t - 2 \[CapitalDelta], t1, t2, a], {u, 0, t}, Assumptions -> Element[{g, a, \[Delta], \[CapitalDelta], t}, Reals]] inttminus = Integrate[tminus, {u, 0, t}, Assumptions -> Element[{g, a, \[Delta], \[CapitalDelta], t}, Reals]] inttplus = Integrate[tplus, {u, 0, t}, Assumptions -> Element[{g, a, \[Delta], \[CapitalDelta], t}, Reals]] baSym = (2.675222/10)^2 ( inttplus - inttminus) baSym /. {t -> 5.5, a -> 100000, \[CapitalDelta] -> 12, \[Delta] -> 0.25} (*the result depends on t1 and t2 which are undefined?*) W Craig Carter Professor of Materials Science, MIT On Aug 9, , at Thu Aug 9, 12 @3:53 AM, Sune wrote: > In[22]:= ba[g_,a_,\[CapitalDelta]_,\[Delta]_]:=(2.675222/10)^2 NIntegrate[Fa[x,g,a,\[CapitalDelta],\[Delta]]^2,{x,0,\[Delta]+2 \[CapitalDelta]}]
- References:
- Nested numerical integral - speed: Is it suppose to be so slow?
- From: Sune <sunenj@gmail.com>
- Nested numerical integral - speed: Is it suppose to be so slow?