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! - Messages

#1 Posted: 12/11/2023 5:25:07 PM
Valery Ochkov

Valery Ochkov

55 likes in 633 posts.

Group: User

linterp.sm (21 KiB) downloaded 61 time(s).
#2 Posted: 12/11/2023 6:01:43 PM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

As a temporary solution:

Click to enlarge

linterp-xyplot-using-defined-argument.sm (21 KiB) downloaded 59 time(s).

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 users liked this post
Valery Ochkov 12/11/2023 11:17:00 PM, Alvaro Diaz Falconi 12/13/2023 12:10:00 AM
#3 Posted: 12/11/2023 6:49:37 PM
Valery Ochkov

Valery Ochkov

55 likes in 633 posts.

Group: User

Благодарствую!
And what is it?
Spline-Bug.png
See the 3-d plot in attach without this bug!linterp.sm (21 KiB) downloaded 55 time(s).

#4 Posted: 12/11/2023 7:25:45 PM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

Это и есть баг в численном алгоритме. К сожалению, требуется основательная переработка алгоритма для выяснения причины такого поведения. Я не силён в кубических сплайнах, в их реализации.
Эта проблема также ведёт к неправильной интерполяции в решателях ОДУ, которые кроме табличного решения предлагают и интерполированные функции. Там используется интерполятор из Mathcad Toolbox.
После реализации этих функций я делал только примитивные тесты и ошибка не была вовремя обнаружена.
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Valery Ochkov 12/11/2023 11:17:00 PM
#5 Posted: 12/11/2023 9:53:52 PM
Valery Ochkov

Valery Ochkov

55 likes in 633 posts.

Group: User

Wrote

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


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


#6 Posted: 12/11/2023 11:30:38 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: 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()
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#7 Posted: 12/12/2023 7:56:30 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: 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 Posted: 12/12/2023 9:02:48 PM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

Wrote

The lspline(X,Y) produces the wrong vector


Jean Giraud produces useless messages.

Click to enlarge
Russia ☭ forever, Viacheslav N. Mezentsev
2 users liked this post
Alvaro Diaz Falconi 12/13/2023 12:08:00 AM, overlord 12/12/2023 10:40:00 PM
#9 Posted: 12/13/2023 12:42:54 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1675 posts.

Group: 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 KiB) downloaded 59 time(s).

Best regards.
Alvaro.
#10 Posted: 12/13/2023 1:21:26 PM
Valery Ochkov

Valery Ochkov

55 likes in 633 posts.

Group: User

Spline.png

#11 Posted: 12/13/2023 1:23:24 PM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: 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 KiB) downloaded 122 time(s).
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Alvaro Diaz Falconi 12/13/2023 2:59:00 PM
#12 Posted: 12/13/2023 2:58:24 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1675 posts.

Group: 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 KiB) downloaded 122 time(s).



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 Posted: 12/13/2023 3:08:28 PM
Valery Ochkov

Valery Ochkov

55 likes in 633 posts.

Group: User

branch.png
1 users liked this post
Oscar Campo 12/14/2023 11:28:00 PM
#14 Posted: 12/13/2023 10:13:05 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: 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 Posted: 12/14/2023 6:34:41 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: 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 Posted: 12/14/2023 8:44:53 AM
overlord

overlord

554 likes in 1333 posts.

Group: 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.
  • New Posts New Posts
  • No New Posts No New Posts