My question is, using the below functions, how can I numerically find the optimized values of USL and LSL so that the return value of the function Pythag is at a global minimum (i.e. the gradient of Pythag == 0) while somehow tethering Cp and Cpk so that Cp returns the value 2 and Cpk returns the value of 1.5.(Cp==2 and Cpk==1.5)
import numpy as np
import matplotlib.pyplot as plt
def Cp(USL,LSL,s):
return (USL-LSL)/(6*s)
def Cpk(USL,LSL,mean,sd):
return min((USL-mu)/(3*s),(mu-LSL)/(3*s))
def Pythag(USL,LSL):
return np.sqrt(np.square(USL)+np.square(LSL))
#This code below is for practice data
x = np.linspace(0,100,101)
y = np.random.random(101)
sd = np.std(y)
mu = np.mean(y)
Please let me know if further clarification is needed. Thanks for your question Rory, I've added some key changes above so the question makes more sense. The reason that the other answers to similar questions were not sufficient is because I'm having a difficult time integrating them with the min parameter on the Cpk function.