Truncated power series in ApproxFun.jl

Thank you @stevengj for moving my post to a new thread. Much appreciated.

My query is not about Taylor approximations. I was not clear enough in my previous post. Thanks @nsajko and @cgeoga for your input.

My query is about the harmonic balance method as implemented in e.g. HarmomicBalance.jl and illustrated in a MWE for the Duffing equation at BifurcationKit: Duffing Equation: Time-Harmonic: Single Harmonic

One way to explain the harmonic balance method is to consider the ApproxFun.jl linear system example at Linear Equations · ApproxFun.jl. It is wonderful to see how succintly code is! I imagine that under the hood ApproxFun.jl assembles and solves a 2-by-2 linear system for the amplitude of cos(t) and sin(t).

Suppose now replacing the zeroth-order term c u(\theta) by the quadratic (thus non-linear) term c [u(\theta)]^2. Or by c [u(\theta)]^3 to make it more Duffing equation like. Suppose looking again for a 2pi-periodic solution. Can this non-linear problem be solved inside ApproxFun.jl.

If not directly, can ApproxFun.jl be instrument to assemble the non-linear system for the expansion coefficients? This would then allow to use ApproxFun.jl as a preprocessor for a non-linear solver or for BifurcationKit.jl as the MWE shows.