Problem with the array

Problem with the array - Mensajes

#1 Publicado: 26/8/2021 5:32:35
Vasia

Vasia

0 me gusta en 17 mensajes.

Grupo: User

Столкнулся с такой проблемой:
Есть зависимость переменной А от диапазона чисел λ = [0.3, 0.31,...1.3].
При λ = 0.7 должно выводиться в массиве А = 0, но вместо этого почему-то А = 5.40901*10^{-18}.
Попробовал уменьшить диапазон λ = [0,6, 0,61,...1.3], тогда А = 0.
Что не так у меня? Archivo no encontrado.Archivo no encontrado.Archivo no encontrado.Archivo no encontrado.
#2 Publicado: 26/8/2021 11:30:40
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

Wrote

Столкнулся с такой проблемой:
Есть зависимость переменной А от диапазона чисел λ = [0.3, 0.31,...1.3].
При λ = 0.7 должно выводиться в массиве А = 0, но вместо этого почему-то А = 5.40901*10^{-18}.
Попробовал уменьшить диапазон λ = [0,6, 0,61,...1.3], тогда А = 0.
Что не так у меня?


This is because electronics, how computers store numbers.
SMath assign numbers to variables as an internal rational representation.
10^-18 is considered zero for SMath, even if it is not zero.
I have written about this issue sometime ago. This is not a bug however.
You can add an additional calculation check to your function in order to prevent this.

Regards

massiv_r1.sm (32 KiB) descargado 1172 vez(es).
#3 Publicado: 27/8/2021 2:32:56
Vasia

Vasia

0 me gusta en 17 mensajes.

Grupo: User

Wrote

Wrote

Столкнулся с такой проблемой:
Есть зависимость переменной А от диапазона чисел λ = [0.3, 0.31,...1.3].
При λ = 0.7 должно выводиться в массиве А = 0, но вместо этого почему-то А = 5.40901*10^{-18}.
Попробовал уменьшить диапазон λ = [0,6, 0,61,...1.3], тогда А = 0.
Что не так у меня?


This is because electronics, how computers store numbers.
SMath assign numbers to variables as an internal rational representation.
10^-18 is considered zero for SMath, even if it is not zero.
I have written about this issue sometime ago. This is not a bug however.
You can add an additional calculation check to your function in order to prevent this.

Regards

massiv_r1.sm (32 KiB) descargado 1172 vez(es).



Спасибо, а не составит труда кинуть ссылку на тему, где Вы об этом писали?
#4 Publicado: 27/8/2021 7:32:25
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

Wrote

Спасибо, а не составит труда кинуть ссылку на тему, где Вы об этом писали?


Look for Razonar's answers in this topic.

Regards.

https://en.smath.com/forum/yaf_postst20177_Equality.aspx
  • Nuevos mensajes
  • Sin mensajes nuevos