# Numerically find temperature in function of concentration...

Tags:
1. Apr 3, 2016

### ramzerimar

1. The problem statement, all variables and given/known data
I don't even know if this is the correct forum for this question, but here we go. This exercise is from my numerical methods for engineers class, and it says the following:
The coefficient of saturation of oxygen dissolved in fresh water is given by the equation:

$$\ln(o_{sf}) = - 139.34411 + \frac{1.575701e5}{T_a} - \frac{6.642308e7}{T_a^2} + \frac{1.243800e10}{T_a^3} - \frac{8.621949e11}{T_a^4}$$
Where osf is the concentration of saturation of oxygen dissolved in fresh water at 1atm(mg/L) and Ta is the absolute temperature (K). The problem gives some additional information: this equation can be used to determine the variation of oxygen concentration from 14,621 mg/L at 0ºC to 6,413 mg/L at 40ºC. Given this formula, the oxygen concentration, we can use bisection method to find the temperature.
So, given inital approximations 0 and 40ºC, develop some program using bisection method to determine T = Ta + 273,15 as a function of a given oxygen concentration with a error of 0.05ºC, for osf = 8, 10 and 12mg/L.

2. Relevant equations
Only the algorithm for the bisection method and the equation above.
The algorithm is:
1. Find points a and b such that a < b and f(a) * f(b) < 0.
2. Take the interval [a, b] and find its midpoint x1.
3. If f(x1) = 0 then x1 is an exact root, else if f(x1) * f(b) < 0 then let a = x1, else if f(a) * f(x1) < 0 then let b = x1.
4. Repeat steps 2 & 3 until f(xi) = 0 or |f(xi)| <= DOA, where DOA stands for degree of accuracy.

3. The attempt at a solution
Using the method is fine. I developed a program in C so I can solve functions using the bisection method. What I don't know is how can I use this method to find the temperature in celsius given those conditions. I mean, the bisection method will find roots of a function in a given interval, how to apply this to the problem?
I know it's a laborious problem, but I need some help figuring out what to do.

Last edited: Apr 3, 2016
2. Apr 3, 2016

### SteamKing

Staff Emeritus
If you rewrite the equation above as:

$$- 139.34411 + \frac{1.575701e5}{T_a} - \frac{6.642308e7}{T_a^2} + \frac{1.243800e10}{T_a^3} - \frac{8.621949e10}{T_a^4} - \ln(o_{sf}) = 0$$

then aren't you using the bisection method to find Ta, if you are given osf?

BTW, if Ta is the absolute temperature, then shouldn't T = Ta - 273.15, where T is in °C ?

3. Apr 3, 2016

### ramzerimar

Yeah, I just realized I was confusing everything. By some reason, I was trying to rewrite the whole thing as a 4 degree polynomial in the form ax^4 + bx^3... It's so simple I'm ashamed.

4. Apr 3, 2016

5. Apr 3, 2016

### ramzerimar

Just corrected that in the post. Thanks for the hint. I can get the results now.