Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

**First time visiting? Here are some places to start:**

- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

# What about implementing universal numeric solver/optimizer?

konstantin_shiriazdanov
Member Posts:

**899**✭✭✭✭✭
From time to time there appear tasks that requare finding numeric solutions and optimization of some numeric dependences, like for example finding minimum box body of geometry or finding length of an arc of the curve given by arbitary length parameter (which was obtained without arc length parametrization). So the general solution could be implementing in FS some kind of "numeric optimizator" function that would take lambda, range of arguments, initial guess and requared accuracy and return extremum point in parameter space (or a number of points). How do you concider the value of such functionality?

0

## Comments

899✭✭✭✭✭but at least what about spline interpolation of numeric arrays?

and more general question - what is FS developers policy in the area of geometry related numeric calculations? from what i have seen on forum FS is not supposed to be used for implementing advanced numeric tasks.

921We do expose a little linear algebra, including basic matrix operations and singular value decomposition, which could be used for linear solving and linearly-constrained least squares (i.e., minimize |Ax-b|^2 subject to Cx=d), though not with amazing efficiency. Depending on the kind of spline interpolation of numeric arrays that you're talking about, this may help. The simplest way I can think of (Catmull-Rom) is relatively easy to do in raw FS and should be quick.

In general, we don't have a "policy" on numeric calculations but rather the current performance constraints of FS as an interpreted language imply that if what you're doing involves a lot of large loops, nested function calls, etc. (rather than the bulk of the work being done in builtin functions), there may be other faster ways of doing it. It's a little bit like working with Matlab -- as long as what you're doing is vectorized, you're ok, but as soon as you have to iterate over a large matrix it slows down a lot.

899✭✭✭✭✭