> 
HybrFunc:=proc(N, M, tj) # N=Number of subintervals, M=Number of functions in subintervals local B, n, m; global b; for n from 1 to N do for m from 0 to M1 do B := (i,m,t) > C(m,i)*(1t)^(mi)*t^i: b[n,m]:=unapply(piecewise(t>=(n1)*tj/N and t<n*tj/N, B(m,2,N*t(n1)*tj), 0), t): od:od: Array(1..N, 0..M1, (n,m)>b[n,m](t)): #convert(%,vector); end proc: HybrFunc(3, 3, 1); # End Of Definition g2(t):=t; #*exp(t1): # Any other function can be replaced here g1(t):=add(add(c[n,m]*b[n,m](t), m=0..2), n=1..3); Optimization[Minimize](sqrt(int((g2(t)g1(t))^2, t=0.. 1))); assign(op(%[2])); plot([g2(t),g1(t)], t=0..1, 0..5, color=[blue,red],thickness=[1,3],discont, scaling=constrained);
