Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline OchkovVF  
#1 Posted : 11 December 2023 23:25:07(UTC)
OchkovVF


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 06/04/2023(UTC)
Posts: 338
Man
Russian Federation

Was thanked: 26 time(s) in 25 post(s)
linterp.sm (22kb) downloaded 4 time(s).

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline uni  
#2 Posted : 12 December 2023 00:01:43(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
As a temporary solution:

Click to enlarge

linterp-xyplot-using-defined-argument.sm (22kb) downloaded 7 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.

Edited by user 12 December 2023 00:08:32(UTC)  | Reason: Not specified

Russia ☭ forever
Viacheslav N. Mezentsev
thanks 2 users thanked uni for this useful post.
on 12/12/2023(UTC),  on 13/12/2023(UTC)
Offline OchkovVF  
#3 Posted : 12 December 2023 00:49:37(UTC)
OchkovVF


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 06/04/2023(UTC)
Posts: 338
Man
Russian Federation

Was thanked: 26 time(s) in 25 post(s)
Благодарствую!
And what is it?
Spline-Bug.png
See the 3-d plot in attach without this bug! linterp.sm (22kb) downloaded 5 time(s).

Offline uni  
#4 Posted : 12 December 2023 01:25:45(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Это и есть баг в численном алгоритме. К сожалению, требуется основательная переработка алгоритма для выяснения причины такого поведения. Я не силён в кубических сплайнах, в их реализации.
Эта проблема также ведёт к неправильной интерполяции в решателях ОДУ, которые кроме табличного решения предлагают и интерполированные функции. Там используется интерполятор из Mathcad Toolbox.
После реализации этих функций я делал только примитивные тесты и ошибка не была вовремя обнаружена.
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 12/12/2023(UTC)
Offline OchkovVF  
#5 Posted : 12 December 2023 03:53:52(UTC)
OchkovVF


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 06/04/2023(UTC)
Posts: 338
Man
Russian Federation

Was thanked: 26 time(s) in 25 post(s)
Originally Posted by: uni Go to Quoted Post
Это и есть баг в численном алгоритме. К сожалению, требуется основательная переработка алгоритма для выяснения причины такого поведения. Я не силён в кубических сплайнах, в их реализации.
Эта проблема также ведёт к неправильной интерполяции в решателях ОДУ, которые кроме табличного решения предлагают и интерполированные функции. Там используется интерполятор из Mathcad Toolbox.
После реализации этих функций я делал только примитивные тесты и ошибка не была вовремя обнаружена.

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


Offline mkraska  
#6 Posted : 12 December 2023 05:30:38(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: uni Go to Quoted Post
Это и есть баг в численном алгоритме. К сожалению, требуется основательная переработка алгоритма для выяснения причины такого поведения. Я не силён в кубических сплайнах, в их реализации.
Эта проблема также ведёт к неправильной интерполяции в решателях ОДУ, которые кроме табличного решения предлагают и интерполированные функции. Там используется интерполятор из 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://smath.com/wiki/SMath_with_Plugins.ashx
Offline Jean Giraud  
#7 Posted : 13 December 2023 01:56:30(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: mkraska Go to Quoted Post
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.

Offline uni  
#8 Posted : 13 December 2023 03:02:48(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
The lspline(X,Y) produces the wrong vector

Jean Giraud produces useless messages.

Click to enlarge
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 2 users thanked uni for this useful post.
on 13/12/2023(UTC),  on 13/12/2023(UTC)
Offline Razonar  
#9 Posted : 13 December 2023 18:42:54(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
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 (24kb) downloaded 8 time(s).

Best regards.
Alvaro.

Edited by user 13 December 2023 18:52:05(UTC)  | Reason: Not specified

Offline OchkovVF  
#10 Posted : 13 December 2023 19:21:26(UTC)
OchkovVF


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 06/04/2023(UTC)
Posts: 338
Man
Russian Federation

Was thanked: 26 time(s) in 25 post(s)
Spline.png

Offline uni  
#11 Posted : 13 December 2023 19:23:24(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Originally Posted by: Razonar Go to Quoted Post
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 (257kb) downloaded 39 time(s).
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 13/12/2023(UTC)
Offline Razonar  
#12 Posted : 13 December 2023 20:58:24(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi Viacheslav.

Originally Posted by: uni Go to Quoted Post
Originally Posted by: Razonar Go to Quoted Post
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 (257kb) downloaded 39 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)

Originally Posted by: uni Go to Quoted Post
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.
Offline OchkovVF  
#13 Posted : 13 December 2023 21:08:28(UTC)
OchkovVF


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 06/04/2023(UTC)
Posts: 338
Man
Russian Federation

Was thanked: 26 time(s) in 25 post(s)
branch.png
thanks 1 user thanked OchkovVF for this useful post.
on 15/12/2023(UTC)
Offline Jean Giraud  
#14 Posted : 14 December 2023 04:13:05(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: Razonar Go to Quoted Post
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.

Offline Jean Giraud  
#15 Posted : 14 December 2023 12:34:41(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: uni Go to Quoted Post
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.



Offline overlord  
#16 Posted : 14 December 2023 14:44:53(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,128
Turkey

Was thanked: 509 time(s) in 339 post(s)
Originally Posted by: uni Go to Quoted Post
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.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.