def g(s,x,e,p,diff=False): if diff: [y,y_s,y_x] = aa(s,x,p,diff=True) [S,S_s,S_x,S_y,S_e] = gg(s,x,y,e,p,diff=True) S_s = S_s + serial_mult(S_y,y_s) S_x = S_x + serial_mult(S_y,y_x) return [S,S_s,S_x,S_e] y = aa(s,x,p) S = gg(s,x,y,e,p) return S
def expectation(S,X,p,diff=False): if diff: [y,y_S,y_X] = aa(S,X,p,diff=True) [z, z_S, z_X, z_Y] = hh(S,X,Y,p,diff=True) z_S = z_S + serial_mult(z_Y,Y_S) z_X = z_X + serial_mult(z_Y,Y_X) return [z, z_S, z_X] Y = aa(S,X,p) z = hh(S,X,Y,p) return z
def g(s, x, e, p, derivs=False): if derivs: [y, y_s, y_x] = aa(s, x, p, derivs=True) [S, S_s, S_x, S_y, S_e] = gg(s, x, y, e, p, derivs=True) S_s = S_s + serial_mult(S_y, y_s) S_x = S_x + serial_mult(S_y, y_x) return [S, S_s, S_x, S_e] y = aa(s, x, p) S = gg(s, x, y, e, p) return S
def value(s,x,S,X,V,p,diff=False): if diff: [y,y_s,y_x] = aa(s,x,p,diff=True) [y,y_S,y_X] = aa(S,X,p,diff=True) [v, v_s, v_x, v_y, v_S, v_X, v_Y, v_V] = vv(s,x,y,S,X,Y,V,p,diff=True) v_s = v_s + serial_mult(v_y,y_s) v_x = v_x + serial_mult(v_y,y_x) v_S = v_S + serial_mult(v_Y,Y_S) v_X = v_X + serial_mult(v_Y,Y_X) return [v, v_s, v_x, v_S, v_X, v_V] y = aa(s,x,p) Y = aa(S,X,p) v = vv(s,x,y,S,X,Y,V,p) return v
def f(s,x,E,S,X,p,diff=False): if diff: [y,y_s,y_x] = aa(s,x,p,diff=True) [Y,Y_S,Y_X] = aa(S,X,p,diff=True) [r,r_s,r_x,r_y,r_E,r_S,r_X,r_Y] = ff(s,x,y,E,S,X,Y,p,diff=True) r_s = r_s + serial_mult(r_y,y_s) r_x = r_x + serial_mult(r_y,y_x) r_S = r_S + serial_mult(r_Y,Y_S) r_X = r_X + serial_mult(r_Y,Y_X) return [r, r_s, r_x, r_E, r_S, r_X] y = aa(s,x,p) Y = aa(S,X,p) r = ff(s,x,y,E,S,X,Y,p) return r
def f(s, x, S, X, p, derivs=False): if derivs: [y, y_s, y_x] = aa(s, x, p, derivs=True) [Y, Y_S, Y_X] = aa(S, X, p, derivs=True) [r, r_s, r_x, r_y, r_S, r_X, r_Y] = ff(s, x, y, S, X, Y, p, derivs=True) r_s = r_s + serial_mult(r_y, y_s) r_x = r_x + serial_mult(r_y, y_x) r_S = r_S + serial_mult(r_Y, Y_S) r_X = r_X + serial_mult(r_Y, Y_X) return [r, r_s, r_x, r_S, r_X] y = aa(s, x, p) Y = aa(S, X, p) r = ff(s, x, y, S, X, Y, p) return r