get the value of the function, and its first & second derivative
Reimplemented from C2Function. Definition at line 858 of file C2Functions.py. 00858 : 00859 y0, yp0, ypp0=self.left.value_with_derivatives(x) 00860 y1, yp1, ypp1=self.right.value_with_derivatives(x) 00861 if isinstance(self.right, C2Constant): #all derivatives of right side are zero, save some time 00862 ab2=_myfuncs.power(y0, (y1-2.0)) #this if a^(b-2), which appears often 00863 ab1=ab2*y0 #this is a^(b-1) 00864 ab=ab1*y0 #this is a^b 00865 ab1 *= yp0 00866 ab1 *= y1 #ab1 is now the derivative 00867 ab2 *= y1*(y1-1)*yp0*yp0+y0*y1*ypp0 #ab2 is now the second derivative 00868 return native(ab, ab1, ab2) 00869 else: 00870 loga=_myfuncs.log(y0) 00871 ab2=_myfuncs.exp(loga*(y1-2.0)) #this if a^(b-2), which appears often 00872 ab1=ab2*y0 #this is a^(b-1) 00873 ab=ab1*y0 #this is a^b 00874 yp=ab1*(yp0*y1+y0*yp1*loga) 00875 ypp=ab2*(y1*(y1-1)*yp0*yp0+2*y0*yp0*yp1*(1.0+y1*loga)+y0*(y1*ypp0+y0*(ypp1+yp1*yp1*loga)*loga)) 00876 return native(ab, yp, ypp) 00877 ##
|