I hope you will forgive me this simple question on titration. I'm trying to find very small values from the algorithm below, which I believe is correctly formatted, and the constants are also correct. When SID goes over ATOT, fitted vales are much too low compared to the literature. I guess I must be using optimize in a wrong way but cannot find out how to improve it. I'm on windows, R 2.0. Best wishes Troels Ring, Aalborg ATOT <- 0.019 KA <- 3e-7 KW <- 4.4e-14 SID <- 0.01 ff <- function(H,KA,SID,ATOT) {H^3 + (KA+SID)*H^2+(KA*(SID-ATOT)-KW)*H- KA*KW} -log10(optimize(ff,c(0,.1),tol=.Machine$double.eps,KA=KA,SID=SID,ATOT=ATOT)$minimum)
Troels Ring wrote:> I hope you will forgive me this simple question on titration. > I'm trying to find very small values from the algorithm below, which I > believe is > correctly formatted, and the constants are also correct. When SID goes > over ATOT, fitted vales are > much too low compared to the literature. I guess I must be using > optimize in a wrong way but cannot find out how to improve it. I'm on > windows, R 2.0. Best wishes > Troels Ring, Aalborg > > ATOT <- 0.019 > KA <- 3e-7 > KW <- 4.4e-14 > SID <- 0.01 > > ff <- function(H,KA,SID,ATOT) > {H^3 + (KA+SID)*H^2+(KA*(SID-ATOT)-KW)*H- KA*KW} > -log10(optimize(ff,c(0,.1),tol=.Machine$double.eps,KA=KA,SID=SID,ATOT=ATOT)$minimum)Well, whether the usage is appropriate depends on the problem. At least I have not understood what you are going to minimize... Uwe Ligges> > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html
Dear friends - just to prevent further loss of time on the problem below - I realized that it was really a root finding exercise and not a minimization - uniroot solved the problem. Sorry for the confusion. Best wishes Troels At 00:06 11/23/04, you wrote:>I hope you will forgive me this simple question on titration. >I'm trying to find very small values from the algorithm below, which I >believe is >correctly formatted, and the constants are also correct. When SID goes >over ATOT, fitted vales are >much too low compared to the literature. I guess I must be using optimize >in a wrong way but cannot find out how to improve it. I'm on windows, R >2.0. Best wishes >Troels Ring, Aalborg > >ATOT <- 0.019 >KA <- 3e-7 >KW <- 4.4e-14 >SID <- 0.01 > >ff <- function(H,KA,SID,ATOT) >{H^3 + (KA+SID)*H^2+(KA*(SID-ATOT)-KW)*H- KA*KW} >-log10(optimize(ff,c(0,.1),tol=.Machine$double.eps,KA=KA,SID=SID,ATOT=ATOT)$minimum) > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Seemingly Similar Threads
- plot representation of calculated value known to be 7.4
- plot representation of calculated value known to be 7.4
- plot representation of calculated value known to be 7.4
- R and Excel disagreement - Goal Seek versus uniroot
- aproximate a titration kurve to the measure data.