Posted on

# Define a function trophiclevelindex(chla , tn, tp) that takes values for Chorophyll-a (CHLA), Total Nitrogen (TN), and Total Phosphorus (TP) and returns the Trophic Index (TLI3) using the calculation below.  Define a function trophic_level_index(chla , tn, tp) that takes values for Chorophyll-a (CHLA), Total Nitrogen (TN), and Total Phosphorus (TP) and returns the Trophic Index (TLI3) using the calculation below. The TLI3 is calculated as the average of the three transformed values, where each value is transformed as follows:

```tlc = 2.22 + 2.54 ∗ log10​CHLA
tln = −3.61 + 3.01 ∗ log10​TN
tlp = 0.218 + 2 .92 ∗ log10​TP
```

​For example, if CHLA = 10, TN = 100, and TP = 1000, then:

```tlc = 2.22 + 2.54 ∗ 1 = 4.76
tln = −3.61 + 3.01 ∗ 2 = 2.410
tlp = 0.218 + 2.92 ∗ 3 = 8.978
and
TLI3 = 5.383 (to 3 decimal places)
```

Notes:

– The notation log10​x means the logarithm to base 10 of x, i.e. the power to which 10 must be raised to yield x.

– In Python, log10​x can be calculated (after importing the math module) as math.log(x, 10)

– You can assume that CHLA, TN, and TP values are positive, i.e. greater than 0.

– Your function should not round its result.

– TN, TP, and CHLA are commonly used variable names in the literature, so you can use the following variable names in your code in this assignment: tn, tp, and chla (note they are lower case).

Solved By Verified
Study Co-Pilot

Instant