cl

Make grid In : F_R = 0.1; N = 10; In : Delta = 1 – sqrt(1 – F_R); dy = (1 – Delta – 2/N)/(N/2 – 1); In : x_i_half = [Delta for i in 1:N/2]; y_i_half = [1 – (i – 1)*dy for i in 1:N/2]; In : x_i = vcat(x_i_half, y_i_half[end:-1:1]); y_i = vcat(y_i_half, x_i_half[end:-1:1]); In : xi_i = x_i.^2 – y_i.^2; h_i = 2x_i.*y_i; In : x_i.^2 Out: 10-element Array{Float64,1}: 0.002633403898972404 0.002633403898972404 0.002633403898972404 0.002633403898972404 0.002633403898972404 0.06316008467876688 0.1922713108628637 0.3914483721444348 0.6606912685234803 1.0 Make polynomialy approximated function of ()=21(14,12;32;−12) f ( x ) = 2 F 1 ( 1 4 , 1 2 ; 3 2 ; − 1 x 2 ) In : using SingularIntegralEquations using Polynomials ┌ Info: Recompiling stale cache file /home/naoki/.julia/compiled/v1.1/SingularIntegralEquations/OCv8s.ji for SingularIntegralEquations [e094c991-5a90-5477-8896-c1e4c9552a1a] └ @ Base loading.jl:1184 ┌ Warning: Package SingularIntegralEquations does not have Random in its dependencies: │ – If you have SingularIntegralEquations checked out for development and have │ added Random as a dependency but haven’t updated your primary │ environment’s manifest file, try `Pkg.resolve()`. │ – Otherwise you may need to report an issue with SingularIntegralEquations └ Loading Random into SingularIntegralEquations from project dependency, future warnings for SingularIntegralEquations are suppressed. In : hypergeom = x -> SingularIntegralEquations.HypergeometricFunctions._₂F₁(0.25, 0.5, 1.5, -1/(x^2)) Out: #9 (generic function with 1 method) In : polys = Dict{Float64, Any}() Out: Dict{Float64,Any} with 0 entries In : #coefs = {} #for power in np.arange(-6, 4.0, 0.1): # xs = np.logspace(power, power + 0.1, 10000) # ys = np.log(hyp2f1(0.25, 0.5, 1.5, -1/xs**2)) # coef = np.polyfit(xs, ys, 6) # coefs[power] = coef In : for power in -6:0.1:3.9 xs = 10 .^ (range(power, stop=power+0.1, length=10000)) ys = log.(hypergeom.(xs)) poly = polyfit(xs, ys, 14) polys[power] = poly end In : #def approxfunc(arg): # for power in np.arange(-6, 4, 0.1): # if np.log10(arg) < power + 0.1: # return np.exp( # np.sum( # [c*arg**n for n, c in enumerate( # reversed(coefs[power]) # ) # ] # ) # ) In : function approx_hypergeom(x) for power in -6:0.1:3.9 if log10(x) < power + 0.1 return exp(polys[power](x)) end end end Out: approx_hypergeom (generic function with 1 method) Calculate In : using ForwardDiff In [ ]: function FG(hf::Vector) FG = similar(hf) N = length(hf) for i in 2:(N/2-1) FG[i] = 1.0/(xi[i]^2 + epsilon^2 * hf[i]^2) end for i in (N/2 + 2):(N – 1) end end In [ ]: FG([2; 3]) In [ ]: