This might be more of a math question. I wrote some code that takes multiple bacterial samples and their associated concentrations(titer) and pools them together so that each of the samples arrive at a specified target concentration within a specified total pooled volume.
#Dummy data
df <- data.frame(bacteria = c('bacteria1', 'bacteria2', 'bacteria3', 'bacteria4'), titer = c(10000000000, 1000000000, 100000000, 10000000))
#Set input parameters
targetTiter <- 100000 #target titer (cfu/ml) of each bacteria in final pool
targetPoolVol <- 1000 #target total pooled volume (ul)
#Calculate the volumes of each bacteria to be pooled to reach specified target titer and specified total pooled volume
df$'requiredVolume' <- targetTiter * targetPoolVol / df$titer
actualPoolVolume <- sum(df$'requiredVolume')
actualPoolVolume #if this is larger than targetPoolVol, the targetTiter will be incorrect
However, if many of the samples are very dilute and/or my target pooled volume is set too low, I have to keep adjusting the targetPoolVolume after running the script and finding that the actualPoolVolume is higher than the targetPoolVolume because that would cause all the samples to be below the targetTiter.
Is there a package or function or formula out there that, given a list of samples and their titers, will tell me the minimum total pooled volume that will be required so that each bacteria arrives at the targetTiter? I have been looking into the Newton-Raphson method for root finding or some Excel Goal-seek type functions, but its still unclear if i can use these for what i need.
Thanks!