"Marshall, John" <j.marshall at geos.com> writes:
> The three parameters with uncertainty are Heave, Pitch and Roll, since
> they are ?real? measurements from a sensor. Has anyone had experience
> of using maxima to calculate error propagation?
>
> I?m happy to dig up my old notes and derive the uncertainty of each
> part of the expression, and hence derive the resultant uncertainty in
> the numerical output, but it?s a bit of a chore if there?s a
> straightforward way to do the calculations within Maxima.
>
> Does anyone have any wisdom to share?
I don't know whether this counts as wisdom :-) But here goes:
If you assume that input errors are small, and you know that your
function has bounded derivative, then you can approximate the answer to
your question by doing a first order Taylor expansion. Let's take a
portion of your example (to avoid the expressions getting too unpleasant
for an email):
(%i1) func: cos(pitch)*(-cos(roll)*z - sin(roll)*y)+heave;
(%o1) cos(pitch)*(-cos(roll)*z-sin(roll)*y)+heave
(%i2) jacobian: [diff(%, heave), diff(%, pitch), diff(%, roll)];
(%o2) [1,-sin(pitch)*(-cos(roll)*z-sin(roll)*y),
cos(pitch)*(sin(roll)*z-cos(roll)*y)]
Notice that I've ditched all the %pi/180 terms. You'll find that the
expressions you work with are *much* simpler if you convert to radians
at the start.
Now, what does the Jacobian tell me? Let's evaluate it at some point:
(%i3) subst([pitch=0.1, roll=-0.2, heave=1, x=0.5, y=5, z=1], %);
(%o3) [1,-.001325795373793656,-5.073528447663164]
Right, now I know that (at my arbitrary choice of point) error in roll
scales by 5, error in pitch is pretty much ignored and error in heave is
unscaled (unsurprising as it appears just as "+heave" in the function).
If I want a single number for the scaling of my uncertainty, I can take
the largest absolute value. For example, here I can say that if my error
is a vector with magnitude less than h << 1, then the error of the
output will have absolute value less than 5.1 * h.
Finally, what happens if you're feeling really paranoid and want a
cast-iron guarantee about the uncertainty of the output value given a
certain input? Or maybe you don't know that the input is particularly
small: maybe the pitch could be much larger? Well, that's kind of more
difficult. If your function is reasonably well behaved, you could look
at bounding the first derivative using Taylor's theorem, but that's
going to require some careful analysis (in both senses of the word!) I
don't think that Maxima can do this for you automatically. Indeed, I'm
not sure if any computer algebra systems claims to (and I'd be
distinctly wary of such claims)
Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20131008/bd50c805/attachment.pgp>