

I'm sure I could have looked into SymPy functionality, but in ~10 minutes I threw together: clear The current basis is then C n P n (x) (superscripts denote degree, not exponentiation).Get the highest non-zero coefficient from the current Legendre basis, L.Get the highest non-zero coefficient from the residual function, R.Iterate from the highest degree basis to the lowest degree basis.Let r(x) = f(x) - g(x), where g(x) is the function our current basis representation encodes.Construct the Legrendre basis polynomials, P n (x) up through the degree of f(x).
#PRICE MATLAB SYMBOLIC TOOLBOX CODE#
For instance, I recently needed to throw together some code (for teaching a class) that would decompose a polynomial function into the Legendre basis polynomials.
#PRICE MATLAB SYMBOLIC TOOLBOX LICENSE#
I agree that there are really good free options, but I talk to a lot of people who are under the notion that Matlab is prohibitively expensive at $5,000/year - which is approximately the commercial license cost - and are not aware that it's actually reasonably priced for consumers. I use Python for my "glue" or "wrapping" projects, Julia & C++ for my production/high-performance projects. I personally just find that Matlab is a perfect tool for those kinds of investigations. I just wanted to quickly dive in to setting up my nonlinear least-squares system, polynomial decomposition, various optimization methods, and real-time plotting of intermediate steps. For example, I spent some time learning about the moment-method for designing quadrature. I prefer applying code to my hobby/research problems, not getting into the weeds of the code. And I've used it quite a few times this year. I'm lucky enough that one-hour of time-savings more than pays for the curve-fitting toolbox cost. I can do that in ~ a minute in Matlab, several days in C++, or a few hours in Python/Julia. And yeah, I get that there are other tools out there, but sometimes I just want to graphically create a smoothing-spline fit to noisy sensor data, compute derivatives, export session to a re-usable function, and move on. Dropbox, MS Office, Fusion360, Acrobat, Zoom (professional), Visual Studio, and more have gone subscription. I don't recommend anyone step onto the subscription treadmill for any desktop software.
