Why I can not plot 1-t and 2-d plot?

Why I can not plot 1-t and 2-d plot? - I have 3-d plot! - 消息

#1 已发布: 2023/12/11 17:25:07
Valery Ochkov

Valery Ochkov

67个赞,共716个帖子。

组: User

linterp.sm (21.54 KiB)已下载 1488 次。
#2 已发布: 2023/12/11 18:01:43
Вячеслав Мезенцев

Вячеслав Мезенцев

1,558个赞,共1,868个帖子。

组: Moderator

As a temporary solution:

Click to enlarge

linterp-xyplot-using-defined-argument.sm (21.7 KiB)已下载 1570 次。

interp(), ... functions from Mathcad Toolbox still have a bug. The implementation used does incorrect interpolation on some intervals. I don't know how to fix this yet, because the algorithm was restored according to the article and perhaps it was done incorrectly.
Russia ☭ forever, Viacheslav N. Mezentsev
2位用户喜欢此帖子
Valery Ochkov 2023/12/11 23:17:00, Alvaro 2023/12/13 00:10:00
#3 已发布: 2023/12/11 18:49:37
Valery Ochkov

Valery Ochkov

67个赞,共716个帖子。

组: User

Благодарствую!
And what is it?
Spline-Bug.png
See the 3-d plot in attach without this bug!linterp.sm (21.44 KiB)已下载 1531 次。

#4 已发布: 2023/12/11 19:25:45
Вячеслав Мезенцев

Вячеслав Мезенцев

1,558个赞,共1,868个帖子。

组: Moderator

Это и есть баг в численном алгоритме. К сожалению, требуется основательная переработка алгоритма для выяснения причины такого поведения. Я не силён в кубических сплайнах, в их реализации.
Эта проблема также ведёт к неправильной интерполяции в решателях ОДУ, которые кроме табличного решения предлагают и интерполированные функции. Там используется интерполятор из Mathcad Toolbox.
После реализации этих функций я делал только примитивные тесты и ошибка не была вовремя обнаружена.
Russia ☭ forever, Viacheslav N. Mezentsev
1位用户喜欢此帖子
Valery Ochkov 2023/12/11 23:17:00
#5 已发布: 2023/12/11 21:53:52
Valery Ochkov

Valery Ochkov

67个赞,共716个帖子。

组: User

Wrote

Это и есть баг в численном алгоритме. К сожалению, требуется основательная переработка алгоритма для выяснения причины такого поведения. Я не силён в кубических сплайнах, в их реализации.
Эта проблема также ведёт к неправильной интерполяции в решателях ОДУ, которые кроме табличного решения предлагают и интерполированные функции. Там используется интерполятор из Mathcad Toolbox.
После реализации этих функций я делал только примитивные тесты и ошибка не была вовремя обнаружена.


Это не просто баг. Это, как говаривал ваш катькин Ельцин, какая-то загогулина!


#6 已发布: 2023/12/11 23:30:38
Martin Kraska

Martin Kraska

1,362个赞,共2,276个帖子。

组: Moderator

Wrote

Это и есть баг в численном алгоритме. К сожалению, требуется основательная переработка алгоритма для выяснения причины такого поведения. Я не силён в кубических сплайнах, в их реализации.
Эта проблема также ведёт к неправильной интерполяции в решателях ОДУ, которые кроме табличного решения предлагают и интерполированные функции. Там используется интерполятор из Mathcad Toolbox.
После реализации этих функций я делал только примитивные тесты и ошибка не была вовремя обнаружена.



Is that bug only related to non-equidistant points? In that case, the functions would still be good enough for the ode solvers, at least for rkfixed()
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
#7 已发布: 2023/12/12 19:56:30
Jean Giraud

Jean Giraud

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

组: User

Wrote

Is that bug only related to non-equidistant points ?


The lspline(X,Y) produces the wrong vector
k ... [0 3 0 0 0.6629 ...suite OK]
k ... [0 0.6629 ...suite OK]
Put the right vector in interp(k,X,Y,x) fails.
Simply a bug ... reflexive double bug.
My Smath Solver 30405 document is fine,
Interpolate, 1rst Derivative, 2nd Derivative, Integrate.
Jean.

#8 已发布: 2023/12/12 21:02:48
Вячеслав Мезенцев

Вячеслав Мезенцев

1,558个赞,共1,868个帖子。

组: Moderator

Wrote

The lspline(X,Y) produces the wrong vector


Jean Giraud produces useless messages.

Click to enlarge
Russia ☭ forever, Viacheslav N. Mezentsev
2位用户喜欢此帖子
Alvaro 2023/12/13 00:08:00, overlord 2023/12/12 22:40:00
#9 已发布: 2023/12/13 12:42:54
Alvaro

Alvaro

1,139个赞,共1,805个帖子。

组: User

Hi Viacheslav. It seems that the Mathcad lspline actually it is a cubic spline. That as conclusion comparing lspline with the maple spline function. Thus, it has the Martin's restriction: x values must to be equally spaced (but that is not required for maple algorithms). Actually, that's looks like the best option for working with ODE's, especially for boundary conditions about the derivative of the spline function.

Maple spline function.sm (23.01 KiB)已下载 1516 次。

Best regards.
Alvaro.
#10 已发布: 2023/12/13 13:21:26
Valery Ochkov

Valery Ochkov

67个赞,共716个帖子。

组: User

Spline.png

#11 已发布: 2023/12/13 13:23:24
Вячеслав Мезенцев

Вячеслав Мезенцев

1,558个赞,共1,868个帖子。

组: Moderator

Wrote

It seems that the Mathcad lspline actually it is a cubic spline.



I will remind you of this document, which describes how the functions work. My implementation of interpolation has an error, but the coefficients themselves seem to be calculated correctly.
In Mathcad the first three numbers encode the type of spline. Jean doesn't know about this.

Cubic spline interpolation using Mathcad (2009).pdf (256.71 KiB)已下载 2781 次。
Russia ☭ forever, Viacheslav N. Mezentsev
1位用户喜欢此帖子
Alvaro 2023/12/13 14:59:00
#12 已发布: 2023/12/13 14:58:24
Alvaro

Alvaro

1,139个赞,共1,805个帖子。

组: User

Hi Viacheslav.

Wrote

Wrote

It seems that the Mathcad lspline actually it is a cubic spline.



I will remind you of this document, which describes how the functions work.

Cubic spline interpolation using Mathcad (2009).pdf (256.71 KiB)已下载 2781 次。



Yes, my comment is about that the lspline and pspline names could be sort of confusing, because, as the report says, mathcad's lspline, pspline and cspline are all "cubic splines". The "l" in "lspline" is not for linear interpolation, but for linear ends conditions, also called natural conditions. The "p" is for parabolic, and the "c" for cubic, all meaning ends conditions too.

natural.png

lspline.png

Thus, Mathcad lspline is not related with SMath linterp or maple spline(X,Y,x,linear)

Wrote

In Mathcad the first three numbers encode the type of spline. Jean doesn't know about this.



As usual. Yes, I know. You can also find here an adaptive spline interpolation using that encoding.

Best regards.
Alvaro.
#13 已发布: 2023/12/13 15:08:28
Valery Ochkov

Valery Ochkov

67个赞,共716个帖子。

组: User

branch.png
1位用户喜欢此帖子
Oscar Campo 2023/12/14 23:28:00
#14 已发布: 2023/12/13 22:13:05
Jean Giraud

Jean Giraud

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

组: User

Wrote

Yes, my comment is about that the lspline and pspline names could be sort of confusing, because, as the report says, mathcad's lspline, pspline and cspline are all "cubic splines". The "l" in "lspline" is not for linear interpolation, but for linear ends conditions, also called natural conditions. The "p" is for parabolic, and the "c" for cubic, all meaning ends conditions too.


Well tutored Alvaro.
Easy to explore more from late Samples.
l & p have most remarkable effect in the start region.
Under the hood, l_spline is the interpolator ODEsolve.

#15 已发布: 2023/12/14 06:34:41
Jean Giraud

Jean Giraud

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

组: User

Wrote

My implementation of interpolation has an error,


Use the Smath code ... visit late Samples.
As an independent Smath document, can be traced
to doctor your original error.
Simply implement the Mathsoft interpolation code.



#16 已发布: 2023/12/14 08:44:53
overlord

overlord

600个赞,共1,381个帖子。

组: Moderator

Wrote

In Mathcad the first three numbers encode the type of spline. Jean doesn't know about this


I myself don't know a lot of things.
Yet I don't post useless messages just to reply.
I guess most people don't, except Jean.
More unacceptable part is, sometimes he posts false information.
Especially on engineering questions/samples.
And insist on that wrong claims like his life depends on it.
I am afraid he will cause something catastrophic in real life.
  • 有新帖
  • 无新帖