On 8/26/21 10:38 AM, andy pugh wrote: > On Thu, 26 Aug 2021 at 00:34, Alexander Brock <a.br...@hhv-rheinklang.de> > wrote: > >> There is an elegant way to compute exact derivatives without computing >> analytical derivatives by hand. Here is a nice introduction: > > Is that applicable to the LinuxCNC kinematics functions? (Which are > kernel modules written in C).
The idea can be implemented in C and for simple cases like 1D funktions it should be fairly straight-forward. The beauty with C++ is having templates and operator overloading so the kinematic function needs to implemented only once and can then be used for all datatypes (double, Jet). Also, operator overloading makes code more readable, for example in C++ I could write (random example): x = cos(4*t) + 2*t*t + 9 and it works with Jet but in C that would probably translate to something like x = sum(cos(product(4,t)), product(2,t,t), 9) I'm using C++ 99.99% of the time so if I would be tasked with providing derivatives in a C program I would try to make some kind of library / module where I just use C++ for the actual computations but I don't know how that would work or what the downsides would be. Best Regards, Alexander _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users