connect f1(x0) to f2(x2) with a very smooth polynomial. If auto_center is False, function(midpoint)=y1 at midpoint of the join and poly is 6th order. If auto_center is True, poly is 5th order, and y(midpoint) is whatever it has to be. Definition at line 1483 of file C2Functions.py. 01483 : 01484 """ connect f1(x0) to f2(x2) with a very smooth polynomial. If auto_center is False, 01485 function(midpoint)=y1 at midpoint of the join and poly is 6th order. 01486 If auto_center is True, poly is 5th order, and y(midpoint) is whatever it has to be.""" 01487 fdx=self.fdx=(x2-x0)/2.0 01488 self.fhinv=1.0/fdx 01489 self.fx1=(x0+x2)/2.0 01490 sef.fx0=x0 01491 self.fx2=x2 01492 01493 y0, yp0, ypp0=f1.value_with_derivatives(x0) # get left wall values from conventional computation 01494 y2, yp2, ypp2=f2.value_with_derivatives(x2) # get right wall values from conventional computation 01495 01496 # scale derivs to put function on [-1,1] since mma solution is done this way 01497 yp0*=fdx 01498 yp2*=fdx 01499 ypp0*=fdx*fdx 01500 ypp2*=fdx*fdx 01501 01502 ff0=(8*(y0 + y2) + 5*(yp0 - yp2) + ypp0 + ypp2)*0.0625 01503 if auto_center: y1=ff0 # forces ff to be 0 if we are auto-centering 01504 01505 # y[x_] = y1 + x (a + b x) + x [(x-1) (x+1)] (c + d x) + x (x-1)^2 (x+1)^2 (e + f x) 01506 # y' = a + 2 b x + d x [(x+1)(x-1)] + (c + d x)(3x^2-1) + f x [(x+1)(x-1)]^2 + (e + f x)[(x+1)(x-1)](5x^2-1) 01507 # y'' = 2 b + 6x(c + d x) + 2d(3x^2-1) + 4x(e + f x)(5x^2-3) + 2f(x^2-1)(5x^2-1) 01508 self.fy1=y1 01509 self.fa=(y2 - y0)*0.5 01510 self.fb=(y0 + y2)*0.5 - y1 01511 self.fc=(yp2+yp0-2.*self.fa)*0.25 01512 self.fd=(yp2-yp0-4.*self.fb)*0.25 01513 self.fe=(ypp2-ypp0-12.*self.fc)*0.0625 01514 self.ff=(ff0 - y1) 01515 self.SetDomain(x0,x2) # this is where the function is valid def value_with_derivatives(self, x):
|