Re: A question on interval arithmetic
- To: mathgroup at smc.vnet.net
- Subject: [mg43747] Re: A question on interval arithmetic
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Thu, 2 Oct 2003 02:52:35 -0400 (EDT)
- Organization: The University of Western Australia
- Sender: owner-wri-mathgroup at wolfram.com
In article <blcq5l$p5f$1 at smc.vnet.net>, Oliver Friedrich <oliver.friedrich at tzm.de> wrote: > the resistance of 2 resistors in parallel is r1*r2/(r1+r2). Now I want to > introduce tolerances in the resistors and ask for the range of resistance > of the combination. One may think that e.g > > (r1*r2)/(r1+r2)/.{r1->Interval[{10,20}],r2->Interval[{20,40}]} > > would lead to the correct result, but there's a trap. If I replace the > expressions by the intervals, Mathematica evaluates the new expression > assuming that all four intervals are independant from each other. And that's not > correct. Taken either the minimum or the maximum from a certain interval , > Mathematica should stick to that, because it is nonsense to take Min[r1] and > Max[r1] within the same expression, r1 can have only one value at a time. > > How can I avoid this problem? Further to my previous posting, here are some additional comments. Define the resistance of 2 resistors in parallel: R[r1_,r2_] = 1/(1/r1+1/r2) Note that Mathematica does not simplify this result to r1*r2/(r1+r2) and that r1 and r2 only appear _once_ in the result. Hence R[Interval[{10,20}],Interval[{20,40}]] works as you would like. You can also compute the extremal values directly: NMinimize[{R[r1, r2], 10 < r1 < 20 && 20 < r2 < 40}, {r1, r2}] NMaximize[{R[r1, r2], 10 < r1 < 20 && 20 < r2 < 40}, {r1, r2}] Alternatively, you could use a statistical approach (other correspondents could easily improve on the following primitive effort) assuming the resistor values are normally distributed: << "Statistics` r1 := Random[NormalDistribution[15,5]] r2 := Random[NormalDistribution[30,10]] Table[R[r1,r2], {10000}]; {Mean[%], StandardDeviation[%]} But calculus of errors is probably the best approach. Cheers, Paul -- Paul Abbott Phone: +61 8 9380 2734 School of Physics, M013 Fax: +61 8 9380 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA