def function(x): """a 8th-order Chebyshev polynomial + sin + a constant 8 6 4 2 f = (128*x1 - 256*x1 + 160*x1 - 32*x1 + 1) + sin(x2) + x3 Input: - x -- 1-d array of coefficients [x1,x2,x3] Output: - f -- the function result """ return poly1d(Chebyshev8)(x[0]) + sin(x[1]) + x[2]
def function(x): """a 8th-order Chebyshev polynomial + sin + a constant 8 6 4 2 f = (128*x1 - 256*x1 + 160*x1 - 32*x1 + 1) * sin(x2) * x3 Input: - x -- 1-d array of coefficients [x1,x2,x3] Output: - f -- the function result """ return poly1d(Chebyshev8)(x[0]) * sin(x[1]) * x[2]
def output_chebyshev(): # Chebyshev8 polynomial from mystic.models.poly import chebyshev8coeffs as target_coeffs from mystic.models.poly import poly1d print("target:\n%s" % poly1d(target_coeffs)) print("\nSolver Solution:\n%s" % poly1d(app.solution))
diameters.append(subdiameter) total_func_evals += function_evaluations[-1] total_diameter += diameters[-1] print "subdiameters (squared): %s" % diameters print "diameter (squared): %s" % total_diameter print "func_evals: %s => %s" % (function_evaluations, total_func_evals) return ####################################################################### # rank, bounds, and restart information # (similar to concentration.variables) ####################################################################### if __name__ == '__main__': RVstart = 0; RVend = 2 lower_bounds = [-2.0,-2.0,-2.0] upper_bounds = [ 2.0, 2.0, 2.0] print " function:\n %s * sin(x2) * x3" % poly1d(Chebyshev8) print " parameters: ['x1', 'x2', 'x3']" print " lower bounds: %s" % lower_bounds print " upper bounds: %s" % upper_bounds print " ..." UQ(RVstart,RVend,lower_bounds,upper_bounds)
diameters.append(subdiameter) total_func_evals += function_evaluations[-1] total_diameter += diameters[-1] print("subdiameters (squared): %s" % diameters) print("diameter (squared): %s" % total_diameter) print("func_evals: %s => %s" % (function_evaluations, total_func_evals)) return ####################################################################### # rank, bounds, and restart information # (similar to concentration.variables) ####################################################################### if __name__ == '__main__': RVstart = 0 RVend = 2 lower_bounds = [-2.0, -2.0, -2.0] upper_bounds = [2.0, 2.0, 2.0] print(" function:\n %s + sin(x2) + x3" % poly1d(Chebyshev8)) print(" parameters: ['x1', 'x2', 'x3']") print(" lower bounds: %s" % lower_bounds) print(" upper bounds: %s" % upper_bounds) print(" ...") UQ(RVstart, RVend, lower_bounds, upper_bounds)
diameters.append(subdiameter) total_func_evals += function_evaluations[-1] total_diameter += diameters[-1] print "subdiameters (squared): %s" % diameters print "diameter (squared): %s" % total_diameter print "func_evals: %s => %s" % (function_evaluations, total_func_evals) return ####################################################################### # rank, bounds, and restart information # (similar to concentration.variables) ####################################################################### if __name__ == '__main__': RVstart = 0; RVend = 2 lower_bounds = [-2.0,-2.0,-2.0] upper_bounds = [ 2.0, 2.0, 2.0] print " function:\n %s + sin(x2) + x3" % poly1d(Chebyshev8) print " parameters: ['x1', 'x2', 'x3']" print " lower bounds: %s" % lower_bounds print " upper bounds: %s" % upper_bounds print " ..." UQ(RVstart,RVend,lower_bounds,upper_bounds)
diameters.append(subdiameter) total_func_evals += function_evaluations[-1] total_diameter += diameters[-1] print("subdiameters (squared): %s" % diameters) print("diameter (squared): %s" % total_diameter) print("func_evals: %s => %s" % (function_evaluations, total_func_evals)) return ####################################################################### # rank, bounds, and restart information # (similar to concentration.variables) ####################################################################### if __name__ == '__main__': RVstart = 0; RVend = 2 lower_bounds = [-2.0,-2.0,-2.0] upper_bounds = [ 2.0, 2.0, 2.0] print(" function:\n %s * sin(x2) * x3" % poly1d(Chebyshev8)) print(" parameters: ['x1', 'x2', 'x3']") print(" lower bounds: %s" % lower_bounds) print(" upper bounds: %s" % upper_bounds) print(" ...") UQ(RVstart,RVend,lower_bounds,upper_bounds)