(* 2023-07-09-hkn-int.m H^k_n by integration *)
(* From non-center/Prog/a26-ppp.m, 2017.06.06 *)
hh[k_,n_,x_,y_]:=NIntegrate[t^k*Exp[-t]*HypergeometricPFQ[{},{n},t*y],{t,0,x}];
hhwithPrec[k_,n_,x_,y_,prec_]:=N[Integrate[t^k*Exp[-t]*HypergeometricPFQ[{},{n},t*y],{t,0,x}],prec];

(* hhB is H^k_n/(Exp[2*Sqrt[x*y]]*(x*y)^(-(1/2)*(1/2+n))) *)
hhBwithPrec[k_,n_,x_,y_,prec_]:=Block[{v},
  v=N[Integrate[t^k*Exp[-t]*HypergeometricPFQ[{},{n},t*y],{t,0,x}],prec];
  Return[v/N[Exp[2*Sqrt[x*y]]*(x*y)^(-(1/2)*(1/2+n)),prec]]
]

zhhBwithPrec[k_,n_,x_,z_,prec_]:=hhBwithPrec[k,n,x,z^2,prec]

zuval[z_,u_]:=WriteString["stdout","u(",z,")-",u]
bv[k_,n_,x_,zz_,prec_]:=Block[{u,i},
  For[i=1,i<=Length[zz],i++,
      u=zhhBwithPrec[k,n,x,zz[[i]],prec];
      zuval[zz[[i]],u];
      WriteString["stdout","; "]
  ]
]
(* boundary value in matlab format *)
bv[10,1,1,{1,1.01146374020412,29.9885362597959,30},20]

(* z=[1,30] --> y=[1,900]*)

(* by chebfun3.rr, 
[2144] set_cheb_interval([1,30]);
Note: Cheb_interval is set to [1,30]  (0 means [-1,1]).
[1,30]
[2145] chebpts(80);
[ 1 1.01146374020412 1.04583683428691 1.10306493132139 1.18305754192317 ... 
  29.8969350686786 29.9541631657131 29.9885362597959 30 ]
*)

(* --------- initial value in z -------- *)
iv[zval_,prec_]:=Block[{u0,u1,u2,u3,i,u},
  f=Integrate[t^k*Exp[-t]*HypergeometricPFQ[{},{n},t*y],{t,0,x}]/(Exp[2*Sqrt[x*y]]*(x*y)^(-(1/2)*(1/2+n))) /. {y->z^2,k->10,n->1,x->1};
  u0=N[f /. {z->zval},prec];
  u1=N[D[f,z] /. {z->zval},prec];
  u2=N[D[f,{z,2}] /. {z->zval},prec];
  u3=N[D[f,{z,3}] /. {z->zval},prec];
  u={u0,u1,u2,u3};
  WriteString["stdout","L.lbc = @(u) [u-(",u0,");"];
  For[i=2,i<=4,i++,
      WriteString["stdout","diff(u,",i-1,")-(",u[[i]],")"];
      If[i != 4,WriteString["stdout","; "]];
  ];
  WriteString["stdout","]\n"];
  Return[u]
]
iv[1,20]
 
(*
L.lbc = @(u) [u-(0.010569873920998992234);diff(u,1)-(0.0085091837408939365844); diff(u,2)-(-0.0021133670684273923006); diff(u,3)-(0.0047746095210963082814)]

{0.010569873920998992234, 0.0085091837408939365844, -0.0021133670684273923006, 0.0047746095210963082814}
*)
