Create a function that finds the largest derivative in the derivative list. Feel free to compare with the numpy function max. Let the program print out what volume this corresponds to. This is the volume of strong base added at the equivalence point. Also find the pH at the equivalence point using your program.
I was able to find the first part of the question by making a function to find max and got the correct answer from that, but im stuck on how to use that information to find the pH at the equivalence point.
My code:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
fil = pd.read_csv('https://raw.githubusercontent.com/andreasdh/programmering-i-kjemi/master/docs/datafiler/titreringsdata.txt', delimiter = ",")
volum = fil['volum']
pH = fil['pH']
print(pH, volume)
plt.plot(volum, pH, color = "#B00B69", label = "Tilpasset modell")
plt.scatter(volum, pH, color = "hotpink", label = "Datapunkter")
plt.xlabel("volum")
plt.ylabel("pH")
plt.grid()
plt.show()
d = []
for i in range(len(volum)-1):
dery = pH[i+1] - pH[i]
dert = volum[i+1] - volum[i]
dydt = dery/dert
d.append(dydt)
print(d)
def fmax(list):
max = list[0]
for x in list:
if x > max:
max = x
return max
print('the biggest element in the derivative is', fmax(d))
I believe that at somepoint I will ahve to use matplotlib.pyplot
to make a graph and scatter the data around but still can't understand what I'm supposed to do.