[R] Calculating with tolerances
    Carl Witthoft 
    carl at witthoft.com
       
    Fri Sep 10 00:28:53 CEST 2010
    
    
  
That won't do much good.  Tolerances don't add (except in rare 
circumstances), and certainly not when they're in different units.
There's nothing wrong with the first part, i.e. setting up variables 
whose contents include the mean and the tolerance, but is that peak? or 
sigma?  and so on.
Then you need to apply the errors properly.  If the variables are 
uncorrelated, there are some simple formulas for calculating the 
variance of a product based on the magnitudes of the items and on their 
variances.  Stuff all that into some function
product.tolerance<- function(q,h){
	productmean = 5*q[1]*h[1]
	productvariance = 5*q[1]^2*h[2] + 5*h[1]^2*q[2] + q[2]*h[2]*5
	return(list(productmean,productvariance)
	}
That's not exactly correct, but you see how this goes.
Carl
<quote>
From: Bernardo Rangel Tura <tura_at_centroin.com.br>
Date: Thu, 09 Sep 2010 05:58:35 -0300
On Thu, 2010-09-09 at 09:16 +0430, Jan private wrote:
 > Dear list,
 >
 > I am from an engineering background, accustomed to work with tolerances.
 >
 > For example, I have measured
 >
 > Q = 0.15 +- 0.01 m^3/s
 > H = 10 +- 0.1 m
 >
 > and now I want to calculate
 >
 > P = 5 * Q * H
 >
 > and get a value with a tolerance +-
 >
 > What is the elegant way of doing this in R?
 >
 > Thank you,
 > Jan
Hi Jan,
If I understood your problem this script solve your problem:
q<-0.15 + c(-.1,0,.1)
h<-10 + c(-.1,0,.1)
5*q*h
[1] 2.475 7.500 12.625
</quote>
    
    
More information about the R-help
mailing list