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 omorr  
#1 Posted : 08 May 2013 13:49:38(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello,

Here is another example I wanted to solve for a long time in SMath. Actually, you can not have a real numerical derivatives in SMath and I also mentioned that few times. If the expression is a bit more complex, there is quite a chance of getting into trouble with derivatives. Moreover, you can not find numerical derivatives of a spline function in SMath. Here is an example where I used Gradient.CD() from the BETANonlinearSolvers (see this thread - this plugin includes many other "derivative free" numerical procedures). I do not know any other more elegant way to solve these kind of problems in SMath. Although it was mentioned here BETANonlinearSolvers among many other things, I just put this example here because I wanted to get it into attention once more.

Regards,
Radovan

Edited by user 08 May 2013 15:07:07(UTC)  | Reason: Not specified

File Attachment(s):
interpdiff.sm (13kb) downloaded 86 time(s).
omorr attached the following image(s):
interpdiff.png
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 1 user thanked omorr for this useful post.
on 08/05/2013(UTC)

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

Offline oscampo  
#2 Posted : 08 May 2013 16:24:04(UTC)
oscampo


Rank: Advanced Member

Groups: Registered
Joined: 10/12/2009(UTC)
Posts: 249
Man
Colombia
Location: Cali, Colombia

Was thanked: 87 time(s) in 66 post(s)
Thanks Omorr, really it's an elegant form.
I'm trying to work with your file but the solve function gives me a "index out of matrix bounds" error, you know what would be the problem?

Regards,

Oscar
Offline omorr  
#3 Posted : 08 May 2013 18:39:49(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello Oscar,
Originally Posted by: oscampo Go to Quoted Post
Thanks Omorr, really it's an elegant form.
I'm trying to work with your file but the solve function gives me a "index out of matrix bounds" error, you know what would be the problem?

I do not know, sorry. It works for me. Actually, my point was that the differentiation in SMath is problematic - actually there is no pure numerical differentiation at all (there is a numerical integration procedure but SMath's symbolic engine does not have symbolical integration yet). If you want to solve a nonlinear equation, just use the mentioned plugin (SMath's solve() and roots() might give us a hedeack sometimes Wallbash ). There are many functions for this problem. Here is the previous example with the functions for the nonlinear equation solving from the mentioned plugin.

Regards,
Radovan

Edited by user 08 May 2013 19:06:25(UTC)  | Reason: Not specified

File Attachment(s):
interpdiff-1.sm (26kb) downloaded 52 time(s).
omorr attached the following image(s):
interpdiff-1.png
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline oscampo  
#4 Posted : 08 May 2013 21:00:14(UTC)
oscampo


Rank: Advanced Member

Groups: Registered
Joined: 10/12/2009(UTC)
Posts: 249
Man
Colombia
Location: Cali, Colombia

Was thanked: 87 time(s) in 66 post(s)
Ok, Omorr,
My problem is due to optimization type. For me, your file only works with "optimization none" except for Brent method, which doesn't works with none optimization method.
Offline omorr  
#5 Posted : 08 May 2013 21:17:59(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Originally Posted by: oscampo Go to Quoted Post
Ok, Omorr,
My problem is due to optimization type. For me, your file only works with "optimization none" except for Brent method, which doesn't works with none optimization method.

Sorry, I do not know what is the reason of this behavior Sad

Regards,
radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline kilele  
#6 Posted : 08 May 2013 22:04:31(UTC)
kilele


Rank: Advanced Member

Groups: Registered
Joined: 30/03/2011(UTC)
Posts: 393

Was thanked: 132 time(s) in 113 post(s)
Originally Posted by: oscampo Go to Quoted Post
Ok, Omorr,
My problem is due to optimization type. For me, your file only works with "optimization none" except for Brent method, which doesn't works with none optimization method.


Did you installed customFunctions plugin ? it is required for the beta version.
You may want to try the mono version until Davide and Andrey publish the stable versions, I guess your problems might be related to having several installations.
Offline oscampo  
#7 Posted : 08 May 2013 22:48:25(UTC)
oscampo


Rank: Advanced Member

Groups: Registered
Joined: 10/12/2009(UTC)
Posts: 249
Man
Colombia
Location: Cali, Colombia

Was thanked: 87 time(s) in 66 post(s)
Originally Posted by: kilele Go to Quoted Post
Did you installed customFunctions plugin ? it is required for the beta version.
You may want to try the mono version until Davide and Andrey publish the stable versions, I guess your problems might be related to having several installations.


Yes, I have this plugin installed and also the another ones are updated. I don't know way this issue happens
Offline Jean Giraud  
#8 Posted : 16 September 2015 05:59:18(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)
Hello,

Here is another example I wanted to solve for a long time in SMath. Actually, you can not have a real numerical derivatives in SMath and I also mentioned that few times. If the expression is a bit more complex, there is quite a chance of getting into trouble with derivatives. Moreover, you can not find numerical derivatives of a spline function in SMath. Here is an example where I used Gradient.CD() from the BETANonlinearSolvers (see this thread - this plugin includes many other "derivative free" numerical procedures). I do not know any other more elegant way to solve these kind of problems in SMath. Although it was mentioned here BETANonlinearSolvers among many other things, I just put this example here because I wanted to get it into attention once more.

Regards,
Radovan
____________________________________________________

Hello Radovan,

linterp, cinterp, aiterp are strictly interpolating functions in Smath.
Most evidently from old codes from times numerical methods didn't exist.
It is on my RemToDo from Mathcad. It might be possible to convert.
If successful, cubic splines will be true scalar functions.
On the other end, linterp as a function is just useless for derivatives
because linterp as a function is not analytical up to 2nd order derivatives.
To the contrary, scalar cubic spline is analytical.
In fact, cubic spline has little interst unless you have clean data set from
functions. But that is sratching the left ear with the right hand.
Again, sampled data sets are naturally noisy from the quantizing numerical
capture as well as from the nature of the experiment. That means that for
derivative, you must smooth in some way, otherwise green grass wlii grow in
your work sheet.
To the contrary of the derivative monkey business, integration of noisy
sampled data sets come out of clicking fingers with extraordinary perfection.
A while ago, I posted the finite differences derivatives & integration.

Cheers Collab, nice to read you.

Jean

Offline omorr  
#9 Posted : 16 September 2015 09:55:37(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello Jean,

Thank you for your comment, and I hope I understood your point.

I agree with you that if you have a noisy cloud of data, the things are going to be problematic in SMath. As you said "scratching the left ear with the right hand" Good . As far as I know, there is no smoothing functions present in SMath yet. I know that integration and differentiation of noisy data are quiet standard procedures, but if you like to do that in SMath - you have to think twice.

As far as I know, there is no smoothing functions present yet.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Jean Giraud  
#10 Posted : 17 September 2015 07:55:51(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)
No matter how much maths you will attempt,
basic cubic spline are NOT differentiable.

In there, if the data points would be "exact"
error in the fit is acceptable for practical use.

Jean
File Attachment(s):
Polynomial fit_D[x].sm (18kb) downloaded 52 time(s).
thanks 2 users thanked Jean Giraud for this useful post.
on 17/09/2015(UTC),  on 17/09/2015(UTC)
Offline Jean Giraud  
#11 Posted : 17 September 2015 17:03:58(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)
Hello Radovan,

I got deceived by "ainterp", it does a por job on few points, Ah !
It may have unxplored utilities.

BTW: The XY plot is not the gear to plot: linterp, ainterp, cinterp
The XY plot is strictly limited to plot "true function(s)".
Basically, it plot some default number [maybe 99]of linear segments
It has an unknown spline joint [OriginLab style], thus it plots
crappy stuff. From recollection, Excel joints Bézier ?

More spline is RemToDo [sometimes].

Cheers Collab(s), Jean
File Attachment(s):
Utilities XY plot.sm (17kb) downloaded 44 time(s).
thanks 1 user thanked Jean Giraud for this useful post.
on 17/09/2015(UTC)
Offline Jean Giraud  
#12 Posted : 25 September 2015 04:38:39(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)
Differentiation of splines is all done in the thread "Cubic Splines Read More"
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.