[R] Calculating with tolerances
Kjetil Halvorsen
kjetilbrinchmannhalvorsen at gmail.com
Fri Sep 10 01:19:16 CEST 2010
I tried RSiteSearch("Interval aritmetic")
which gives zero hits.
There exist a http://www.boost.org/
free software library for interval aritmetic, which it shoub be
possible to link to R.
Kjetil
On Thu, Sep 9, 2010 at 6:28 PM, Carl Witthoft <carl at witthoft.com> wrote:
>
> 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>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list