Re: Re: A question on interval arithmetic
- To: mathgroup at smc.vnet.net
- Subject: [mg43759] Re: [mg43735] Re: A question on interval arithmetic
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Fri, 3 Oct 2003 02:28:46 -0400 (EDT)
- References: <blcq5l$p5f$1@smc.vnet.net> <200310020651.CAA15238@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Steve Luttrell wrote:
>
> You need to average (r1*r2)/(r1+r2) over the required interval.
>
> Here is how I did it evaluating over the 2-dimensional tolerance region
> around r1=r10 and r2=r20. I assume each resistor independently has a
> tolerance +/-a which is uniformly distributed over an interval of length 2a,
> which gives a probability density 1/(4a^2) over the 2-dimensional tolerance
> region for the pair of resistors. I had to evaluate indefinite integrals and
> then substitute in limits because definite integration seemed to lock
> Mathematica up (I have version 5 for Windows).
>
> Integrate[((r1*r2)/(r1 + r2))*(1/(4*a^2)), r1]
> Simplify[(% /. {r1 -> r10 + a}) - (% /. {r1 -> r10 - a})]
> Integrate[%, r2]
> Simplify[(% /. {r2 -> r20 + a}) - (% /. {r2 -> r20 - a})]
>
> --
> Steve Luttrell
> West Malvern, UK
Addressing specifically the definite Integrate issue, it is slow due to
processing of parameters. It will help considerably if you pass in
assumptions. For example:
In[5]:= InputForm[Timing[Integrate[((r1*r2)/(r1 + r2))*(1/(4*a^2)),
{r2,r20-a,r20+a}, {r1,r10-a,r10+a},
Assumptions->{r10>0,r20>0,a>0,a<r10,a<r20}]]]
Out[5]//InputForm=
{8.55*Second,
-(-8*a^2*r10 - 8*a^2*r20 - 2*(r10^3 + r20^3 + 3*a^2*(r10 + r20))*
Log[r10 + r20] + (-2*a^3 + r10^3 + r20^3 + 3*a^2*(r10 + r20) -
3*a*(r10^2 + r20^2))*Log[-2*a + r10 + r20] +
2*a^3*Log[2*a + r10 + r20] + 3*a^2*r10*Log[2*a + r10 + r20] +
3*a*r10^2*Log[2*a + r10 + r20] + r10^3*Log[2*a + r10 + r20] +
3*a^2*r20*Log[2*a + r10 + r20] + 3*a*r20^2*Log[2*a + r10 + r20] +
r20^3*Log[2*a + r10 + r20])/(12*a^2)}
Another possibility is to suppress generation of conditions involving
the parameters. This tends to speed the computation, at the risk of
obtaining a result that may be incorrect for the actual parameter value
regions you have in mind.
In[1]:= InputForm[Timing[Integrate[((r1*r2)/(r1 + r2))*(1/(4*a^2)),
{r2,r20-a,r20+a}, {r1,r10-a,r10+a}, GenerateConditions->False]]]
Out[1]//InputForm=
{2.94*Second,
-(-8*a^2*r10 - 8*a^2*r20 - 2*(r10^3 + r20^3 + 3*a^2*(r10 + r20))*
Log[r10 + r20] + (-2*a^3 + r10^3 + r20^3 + 3*a^2*(r10 + r20) -
3*a*(r10^2 + r20^2))*Log[-2*a + r10 + r20] +
2*a^3*Log[2*a + r10 + r20] + 3*a^2*r10*Log[2*a + r10 + r20] +
3*a*r10^2*Log[2*a + r10 + r20] + r10^3*Log[2*a + r10 + r20] +
3*a^2*r20*Log[2*a + r10 + r20] + 3*a*r20^2*Log[2*a + r10 + r20] +
r20^3*Log[2*a + r10 + r20])/(12*a^2)}
Daniel Lichtblau
Wolfram Research
- References:
- Re: A question on interval arithmetic
- From: "Steve Luttrell" <luttrell@_removemefirst_westmal.demon.co.uk>
- Re: A question on interval arithmetic