This topic is an offspring of
this topic on equation solving.
The problem is that the cross product in SMath can't handle operators which aren't vectors but for instance a product of a symbolic name and a normalized vector.
The initial proposal: Mark the symbolic names as units (these are always applied stored as part of the elements, never as a common factor)
This, however, excluded solvers like FindRoot() and roots().
Alvaro demonstrated a way to handle the issue without using Maxima and without marking the unknowns as units. (row 2 column 2 in the attached grid of tests)
Yet, even though this is a remarkable example SMath command, I am reluctant to recommend that approach to my students.
The issue is that this approach requires the vectorize() function combined with very special conditions:
- a very special way to normalize vectors
- at a certain step the expression must be stored in a variable.
If one of these conditions isn't met, then applying vectorize() silently produces wrong results.
On the other hand, when accepting unit-like unknowns, then you have no restrictions except that you are forbidden to apply vectorization to expressions which are itself vector operations (e.g. the normalization). Plus, you are restricted to either matrix inversion or Maxima Solve()
So I still recommend two adjustments:
- Improve the SMath cross product. The sheet below shows that with a proper cross product we don't need to mark the unknowns as units.
- Accept units as names of unknowns in the FindRoot() solver (if specified at the left hand side of the unknown=guess equations).
Still, unit-shaped unknowns are a bit strange to me, so a robust alternative is still welcome.
issues.sm (103 КиБ) скачан 30 раз(а).