Weird Result from Range

Weird Result from Range - 消息

#1 已发布: 2023/7/17 01:20:34
netsonicyxf

netsonicyxf

2个赞,共79个帖子。

组: User

For n=5, the result is right.

But for n=6, it's supposed to have 7 elements instead of 6

未找到文件。未找到文件。
#2 已发布: 2023/7/17 06:59:01
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

Wrong way to discretize a range.
#3 已发布: 2023/7/17 08:09:12
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: Moderator

Wrote

For n=5, the result is right.

But for n=6, it's supposed to have 7 elements instead of 6



Probably something about precision of double type. In the second range if you add a 10^-14 to the uppper bound it return the expected vector.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
2位用户喜欢此帖子
netsonicyxf 2023/7/17 09:41:00, Oscar Campo 2023/7/18 15:18:00
#4 已发布: 2023/7/17 10:40:35
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

n even starts being exact ... n 10
n odd stops being exact ..... n 15
You have no control on numerical arithmetic.
  • 有新帖
  • 无新帖