Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

Re: [Phys-l] quadratic uncertainty



On 08/26/2010 04:22 AM, Brian Blais wrote:

In my little error propagation (monte carlo) routines, I get this
nice little bit:

a=Quantity('1 +- .0001')
b=Quantity('-2.08 +- .01')
c=Quantity('1.08 +- .01')


In [3]:evaluate('b**2-4*a*c')
Out[3]:0.00699313256158 +- 0.0579303054605

which gives rise to complex solutions if I try:

In [4]:evaluate('-b+sqrt(b**2-4*a*c)/(2*a)')
Out[4]:nan +- nan

Not sure what the best way to handle that is!

If the tool cannot directly represent complex numbers,
the trick is to ask it to solve for Re(x) and Im(x)
separately.

This trick requires two or three times more work than
would be required if the tool supported complex numbers
(or if the task didn't require complex numbers). A
factor of two or three is annoying but not fatal.