1 страниц (7 вхождений)
Cross product error with cases() - Limitation or Bug? - Сообщения
Hello everyone,
I am working on a time-dependent FEM model in SMath and get the error “Cross product is only allowed for vectors with three components” when trying to symbolically evaluate or integrate expressions involving vectors defined via cases(). Numerical evaluation and plotting work correctly, but symbolic evaluation/integration fails although the vectors should always have dimension 3×1. I would like to understand whether this is a limitation/bug related to cases() and vector typing, and how to force purely numerical integration in such models.
I built a small FEM model in SMath consisting of springs, a rigid body, and fixed supports representing ball screw drives. The loads and motions are time-dependent, and the motion cycle is defined using `cases()`.
My problem is the following:
As soon as I try to symbolically evaluate an expression or use the built-in integral function together with my time-dependent load-vector, I get the error:

Here is a simplified version of the relevant definitions:




Everything works correctly for specific time values:

This returns valid numerical values.
Plotting also works without any problems. The issue only appears when I try to integrate `F.a.global(t)` numerically to calculate an equivalent force.
My assumption is that the built-in integral function first tries to process the expression symbolically instead of evaluating it numerically point by point. Because of that, SMath seems to lose the information that the result of `cases()` is always a 3D vector.
From my point of view, the actual calculations are correct, since:
My questions are:
Thank you very much for any help!
I am working on a time-dependent FEM model in SMath and get the error “Cross product is only allowed for vectors with three components” when trying to symbolically evaluate or integrate expressions involving vectors defined via cases(). Numerical evaluation and plotting work correctly, but symbolic evaluation/integration fails although the vectors should always have dimension 3×1. I would like to understand whether this is a limitation/bug related to cases() and vector typing, and how to force purely numerical integration in such models.
I built a small FEM model in SMath consisting of springs, a rigid body, and fixed supports representing ball screw drives. The loads and motions are time-dependent, and the motion cycle is defined using `cases()`.
My problem is the following:
As soon as I try to symbolically evaluate an expression or use the built-in integral function together with my time-dependent load-vector, I get the error:
ЦитатаCross product is only allowed for vectors with three components

Here is a simplified version of the relevant definitions:




Everything works correctly for specific time values:

This returns valid numerical values.
Plotting also works without any problems. The issue only appears when I try to integrate `F.a.global(t)` numerically to calculate an equivalent force.
My assumption is that the built-in integral function first tries to process the expression symbolically instead of evaluating it numerically point by point. Because of that, SMath seems to lose the information that the result of `cases()` is always a 3D vector.
From my point of view, the actual calculations are correct, since:
- numerical evaluation at specific times works,
- plotting works,
- only symbolic evaluation/integration fails.
My questions are:
- Is this a known issue when using `cases()` with vectors?
- Is there a way to explicitly tell SMath that `D(t)` is always a 3×1 vector?
- Is there a clean way to force purely numerical integration in SMath point by point with the built-in int() function?
Thank you very much for any help!
Отредактировано 18.05.2026 11:07:24
Try the simp() function in https://github.com/sn-code-inside/Technische-Mechanik-mit-SMath/blob/main/Auflage%201/4.2.sm. Without the worksheet, however, it is pure guessing what might help.


Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
I tried to build a minimal working example. The simp() function did not help but thank you very much.
Crossproduct + integral error.sm (14,5 КиБ) скачан 7 раз(а).
Crossproduct + integral error.sm (14,5 КиБ) скачан 7 раз(а).
I don't think cases() has a role in this issue. More like integration and processing order probably (see the alternate definition of F(t) without cases() involved).
Crossproduct + integral error_01.sm (31,71 КиБ) скачан 11 раз(а).
Crossproduct + integral error_01.sm (31,71 КиБ) скачан 11 раз(а).
Отредактировано 19.05.2026 13:49:58
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
Hi. One of the issues is with cross product. It must to "see" two explicit vectors as arguments. Martin deal with that in several ways somewhere in this forum.
Using the Davide approach, but modifying F(t) : vectorize( ... ).
Just another thing: XYPlot seems to have a bug evaluating inequalities. Counting squares, the first and last integrals looks good in the native SMath plot.

Crossproduct + integral error_02.sm (31,22 КиБ) скачан 8 раз(а).
Best regards.
Alvaro.
Using the Davide approach, but modifying F(t) : vectorize( ... ).
Just another thing: XYPlot seems to have a bug evaluating inequalities. Counting squares, the first and last integrals looks good in the native SMath plot.

Crossproduct + integral error_02.sm (31,22 КиБ) скачан 8 раз(а).
Best regards.
Alvaro.
Yes, you're right. I assumed that if there was a bug, it had to be in the plugin and not the program. But incredibly, XYPlot's calculation engine is the correct one, not SMath's. Here's a workaround: redefine the function "little than little equal", using "product" instead of "and".

Now plots and integrals are ok

Crossproduct + integral error_03.sm (31,05 КиБ) скачан 3 раз(а).
Best regards.
Alvaro.

Now plots and integrals are ok

Crossproduct + integral error_03.sm (31,05 КиБ) скачан 3 раз(а).
Best regards.
Alvaro.
1 страниц (7 вхождений)
- Новые сообщения
- Нет новых сообщений

