#APL NARS, 37 chars {(a b n k)←⍵⋄l←n÷⍨b-a⋄l×+/⍺⍺a+l×k+⍳n} The function has the argument in the left the function, in the right numeric argument a b n k. In the question k=left here it means k=¯1; k=right here it means k=0. Test: f←{(a b n k)←⍵⋄l←n÷⍨b-a⋄l×+/⍺⍺a+l×k+⍳n} {1+2×⍵} f 5 13 4 0 168 {√⍵} f 1 2.5 3 ¯1 1.819479217 {4+(¯3×⍵)+0.2×⍵×⍵} f 12.5 2.5 10 0 55.5 {9+(¯4×⍵)+7÷⍨2×⍵×⍵} f 0 15 3 ¯1 13.57142857 {6-0×⍵} f 1 4 2 0 18 {1+(165×⍵)+⍵*7} f 7 7 4 ¯1 0 {⍵×1○÷⍵} f 0 1 50 0 0.3857239529 https://tio.run/##nZDBSsNAEIbvPsV/S@o26U6y2@DjbCsVaYhCT1JyEy8l4qXkFXrroYjgsXmTfZE4m9SYRlFwswvZmfn@@XfMfRpcP5j07iaYp2a1up3X9do3mCHDcmSfXmzxajePKf9l1ZstdrPAuHtViokt3nkbwZelsMUhy@sF1/0fv7DPW6701iSiqmQ098bora84FtCgGAqygzh@GeoBgs8wE4Qo1Ihx3FMHKeEf93EjOhIybOW73r@lnaDTc4dkz8eVY9SJSZpXn8v@VcHKEjR0Og3kjzPp4s0LFaKeFRI@TfWpkRtEknsYt5P8lmE@4U@ddW1MkS03zuWg9zDZ@oZ2w6g/AA