using DifferentialEquations, Yao, QuantumNLDiffEq
# Making the ODEProblemfunctionf(u, p, t)
λ, κ = p
return-1*λ*u*(κ +tan(λ*t))
end
prob =ODEProblem(f, [1.0], (0.0, 0.9), [8.0, 0.1])
functionloss_func(a, b)
return (a - b)^2end#Making the DQC
DQC = [QuantumNLDiffEq.DQCType(afm = QuantumNLDiffEq.ChebyshevSparse(2), fm =chain(6, [put(i=>Ry(0)) for i in1:6]), cost = [Add([put(6, i=>Z) for i in1:6])], var =dispatch(EasyBuild.variational_circuit(6,5), :random), N =6)]
config =DQCConfig(abh = QuantumNLDiffEq.Floating(), loss = loss_func)
M =range(start=0; stop=0.9, length=20)
evalue(M) = [QuantumNLDiffEq.calculate_evalue(DQC[1], DQC[1].cost, prob.u0[1], config.abh, params[1], M[x], M[1]) for x in1:length(M)]
params = [Yao.parameters(DQC[1].var)]
#Training the circuit
QuantumNLDiffEq.train!(DQC, prob, config, M, params)
#Plotting the solutionusing Plots
new_M =range(start=0; stop=0.9, length=100)
Plots.plot(new_M, reduce(vcat, real.(evalue(new_M))), xlabel="x", ylabel="f(x)", legend=false)