Thanks @StvMath. The proposed solution is more appropriate for the proposed example, the question was asked in a simple way so as not to present a complex code to whoever could help me.
I need to give a solution to the question because I was analyzing a code published by @mkraska years ago, the code described is more complex and requires a solution with the Maxima plugin. I am also interested in learning Maxima and I think that the solution written by Martin is a very useful way to develop some functions.
"https://en.smath.com/forum/yaf_postst2447_SMath-For-Engineering-Calculations.aspx"