Overflow Error When Handling Pi Recursively

Overflow Error When Handling Pi Recursively - Smath can create numerators & denominators too large to store quickly if a recursive definition contains pi - Сообщения

#1 Опубликовано: 24.04.2025 12:56:14
Scott Bowden

Scott Bowden

0 сообщений из 1 понравились пользователям.

Группа: User

Working on a crack-propagation problem when I encountered some odd behavior with a recursive variable definition.

The dependence of β on the value of a requires an iterative process to find the critical value of a. However, attempting to evaluate this formula with pi in it yields a "Result is above max. allowed positive integer" error after just 3 iterations. Replacing pi with 3.14159 solves the issue.

It seems when SMath tries to store the definition analytically as a fraction, it quickly grows too difficult to store. Is there an option/function somewhere to instruct SMath to evaluate and store the approximate numerical result in a variable instead of the typical behavior?

image.png
#2 Опубликовано: 24.04.2025 18:15:42
overlord

overlord

554 сообщений из 1333 понравились пользователям.

Группа: Moderator

This is neither bug or problem. Limitation of symbolic equation.
Use eval(), it will convert symbolic calculation of a.f to numeric value.
Or convert calculation method of selected region to numeric.

2025-04-24_21-14.png 2025-04-24_21-18.png

Using one of these methods, increasing N to 100 won't even matter for calculation time.
Your for loop will be instantaneously calculated.

Regards
Отредактировано 24.04.2025 18:21:15
2 пользователям понравился этот пост
Alvaro Diaz Falconi 25.04.2025 07:13:22, Andrey Ivashov 26.04.2025 03:07:20
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений