AlgLib 3.1x

AlgLib 3.1x - AlgLib Plugin (based on ALGLIB 3.1x) - Messages

#1 Posted: 4/26/2013 6:52:04 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Didn't find an explicit alglib topic, thus I post this here:

It seems that the convolution function from the alglib plugin does not care for the second and fourth arguments (problem size in alglib ). I guess that the problem size is nothing else than the size of the 1st and 3rd arguments, thus they are obsolete.

If that is correct than I suggest to provide a convr1d(2) function.
BTW, a real symmetric eigensolver would be fine...

It seems that the alglib license does not allow for inclusion of the plugin in any smath distribution, except if someone buys a commercial license.

[Moderator]: Moved.
conv.sm (6 KiB) downloaded 167 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#2 Posted: 4/27/2013 6:18:16 AM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

AlgLib 3.1x

SMath Studio compatibility SMath Viewer compatibility mono compatibility Extension page Sources


Functions list: al_airy(), al_beta(), al_convr1d(), al_convr1dinv(), al_fftc1d(), al_fftc1dinv(), al_nleqsolve(), al_rkckadapt(), al_polyroots().


[albumimg]81[/albumimg] [albumimg]83[/albumimg] [albumimg]121[/albumimg] [albumimg]1546[/albumimg] [albumimg]1585[/albumimg]
[albumimg]1560[/albumimg] [albumimg]1547[/albumimg] [albumimg]1561[/albumimg] [albumimg]1562[/albumimg] [albumimg]1563[/albumimg]

Examples:

alglib.ode.integrate.sm (11 KiB) downloaded 92 time(s).
alglib.ode.kinetic1.sm (7 KiB) downloaded 139 time(s).
alglib.ode.kinetic2.sm (10 KiB) downloaded 119 time(s).
alglib.ode.kinetic3.sm (10 KiB) downloaded 118 time(s).
alglib.ode.test1.sm (10 KiB) downloaded 130 time(s).
alglib.ode.test2.sm (10 KiB) downloaded 116 time(s).
alglib.ode.Amplitude detector.sm (19 KiB) downloaded 122 time(s).

alglib.ode.integrate.pdf (92 KiB) downloaded 99 time(s).
alglib.ode.kinetic1.pdf (75 KiB) downloaded 121 time(s).
alglib.ode.kinetic2.pdf (89 KiB) downloaded 96 time(s).
alglib.ode.kinetic3.pdf (83 KiB) downloaded 109 time(s).
alglib.ode.test1.pdf (85 KiB) downloaded 106 time(s).
alglib.ode.test2.pdf (89 KiB) downloaded 103 time(s).
alglib.ode.Amplitude detector.pdf (147 KiB) downloaded 111 time(s).

Fourier series coefficients.sm (28 KiB) downloaded 165 time(s).
Fourier series coefficients.pdf (170 KiB) downloaded 127 time(s).

Links:

1. ALGLIB
Russia ☭ forever, Viacheslav N. Mezentsev
3 users liked this post
Radovan Omorjan 4/27/2013 7:03:00 AM, Davide Carpi 4/27/2013 6:37:00 AM, ioan92 5/8/2013 2:08:00 PM
#3 Posted: 4/27/2013 7:57:43 PM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

Wrote

It seems that the convolution function from the alglib plugin does not care for the second and fourth arguments (problem size in alglib ). I guess that the problem size is nothing else than the size of the 1st and 3rd arguments, thus they are obsolete.

If that is correct than I suggest to provide a convr1d(2) function.


I think it's best to follow the description in the source code (see doc.pdf). I corrected the behavior of the function and added an inverse function convr1dinv().
Russia ☭ forever, Viacheslav N. Mezentsev
#4 Posted: 4/28/2013 2:34:59 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote


I think it's best to follow the description in the source code (see doc.pdf). I corrected the behavior of the function and added an inverse function convr1dinv().



Uni, thanks for the update. Now the function convr1d seems to insist on providing the correct vector sizes as arguments. This is not really an improvement unless values differing from the actual length can be provided for some magic purpose. I did not find any such hint in the doc. Thus, in order to keep the argument list lean, I would recommend to have
[MATH]convr1d(f;g)[/MATH] and let the interface determine the sizes as in the previous version.

However, I do not want to distract you from progress in the xyplot-plugin!

Martin

Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#5 Posted: 4/28/2013 6:24:22 AM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

Wrote

Wrote


I think it's best to follow the description in the source code (see doc.pdf). I corrected the behavior of the function and added an inverse function convr1dinv().


Thus, in order to keep the argument list lean, I would recommend to have
[MATH]convr1d(f;g)[/MATH] and let the interface determine the sizes as in the previous version.


Ok, I'll add this too. It seems to me that I need to follow the documentation to describe the interfaces of functions.
Russia ☭ forever, Viacheslav N. Mezentsev
#6 Posted: 4/28/2013 7:52:45 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

Wrote


Thus, in order to keep the argument list lean, I would recommend to have
[MATH]convr1d(f;g)[/MATH] and let the interface determine the sizes as in the previous version.


Ok, I'll add this too. It seems to me that I need to follow the documentation to describe the interfaces of functions.



Thanks for considering the change. This would perhaps apply to the other integral transforms as well. When providing sort of convr1d(2), then you could add a hint to the doc string that the size parameters in alglib are determined from the actual size).

The alglib version of the Beta function seems o return values if one argument is negative despite of the docs limiting the range to posive arguments. Also, in contrast to the implementation in the StatisticalTools Plugin, the function cannot handle complex numbers.

I added the plugin to the inofficial SMath distribution.

After a look at the alglib license I feel safe to do so. The available functions are (at least a little) documented in the Handbook based on alglib docs and examples by uni.
Beta2.png
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#7 Posted: 5/6/2013 6:55:55 AM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

Updated. al_convr1d(2), al_convr1dinv(2) added.

[albumimg]116[/albumimg]
Russia ☭ forever, Viacheslav N. Mezentsev
2 users liked this post
Davide Carpi 5/6/2013 7:46:00 AM, Martin Kraska 5/6/2013 10:20:00 AM
#8 Posted: 5/6/2013 10:42:24 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

Updated. al_convr1d(2), al_convr1dinv(2) added.



Thanks for implementing the proposal.

On my system, Example 2.sm fails to run correctly. If I replace the al_convr1dinv(4) by al_convr1dinv(2) then it is ok. My handbook examples show the same effect, on top of that, in conv.sm, there is an xy-plot-region throwiing an critical error. It does not recover, even if I fix the convolution problem with the new (2)-call. conv1.sm is the fixed version.
conv1.sm (11 KiB) downloaded 108 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#9 Posted: 5/8/2013 12:57:13 PM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

Updated. al_nleqsolve() function added (Levenberg-Marquardt-like nonlinear solver).

This algorithm solves system of nonlinear equations F(x).

Parameters:

X0 - starting point.
StepMax - maximum step length, >=0. Set StpMax to 0.0,  if you don't want to limit step length.
Eps - >=0. The subroutine finishes  its work if on k+1-th iteration the condition ||F||<=EpsF is satisfied.


[albumimg]121[/albumimg] [albumimg]123[/albumimg]
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Radovan Omorjan 5/8/2013 2:18:00 PM
#10 Posted: 5/8/2013 2:22:45 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Thank you uni for this one

I could see that al_nleqsolve() will not work with

[MATH=eng]f(v):eval(F(el(v,1),el(v,2),el(v,3)))[/MATH]

[MATH=eng]j(v):eval(Jac(el(v,1),el(v,2),el(v,3)))[/MATH]

Is there any way to make this possible?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#11 Posted: 5/8/2013 2:37:08 PM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

I think it is not necessary, since the function within itself already performs this. I need more examples. Try this solver at work.
Russia ☭ forever, Viacheslav N. Mezentsev
#12 Posted: 5/8/2013 4:17:40 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Wrote

I think it is not necessary, since the function within itself already performs this. I need more examples. Try this solver at work.


I just have some frustrating experience when the Jacobian is involved, and would rather appreciated some "derivative free" algorithms of this kind.

Here is just a playing with the NonlinearSolver plugin which includes Levenberg-Marquard algorithm and this one in AlgLib. For this particular example all performed quite well.

[albumimg]122[/albumimg]

Regards,
Radovan

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
1 users liked this post
#13 Posted: 5/8/2013 4:38:49 PM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

Wrote

Wrote

I think it is not necessary, since the function within itself already performs this. I need more examples. Try this solver at work.


I just have some frustrating experience when the Jacobian is involved, and would rather appreciated some "derivative free" algorithms of this kind.

Here is just a playing with the NonlinearSolver plugin which includes Levenberg-Marquard algorithm and this one in AlgLib. For this particular example all performed quite well.

[albumimg]122[/albumimg]

Regards,
Radovan



Thank you, Radovan. Unfortunately, this interface is defined by the function.

[albumimg]123[/albumimg]
Russia ☭ forever, Viacheslav N. Mezentsev
#14 Posted: 7/11/2013 7:04:23 PM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

Updated. al_rkckadapt() function added (Runge-Kutta-Cash-Karp adaptive ODE solver).

You can compare with the examples from here: Using the AlgLib ODE (Runge-Kutta) Solver with Excel.

[albumimg]228[/albumimg] [albumimg]230[/albumimg] [albumimg]231[/albumimg] [albumimg]229[/albumimg]
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Radovan Omorjan 7/12/2013 10:08:00 AM
#15 Posted: 7/19/2013 3:07:01 PM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

Updated. Source code refactoring.
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
sergio 6/17/2018 4:02:00 PM
#16 Posted: 6/17/2018 7:10:00 AM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

Updated to AlgLib 3.14, refactored.

2018-06-17_15-09-26.png

al_nleqsolve.sm (15 KiB) downloaded 110 time(s).
al_nleqsolve.pdf (41 KiB) downloaded 103 time(s).
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Andrey Ivashov 6/17/2018 2:15:00 PM
#17 Posted: 6/18/2018 12:58:25 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Updated to AlgLib 3.14, refactored



Thanks UNI, works fine 6179.

Jean
#18 Posted: 7/8/2018 2:07:58 PM
Igor Skarine

Igor Skarine

14 likes in 97 posts.

Group: User

al_nlsolve.png
Some problem in the latest plugin. Another solver f_nrk(...) works fine.
x is formal parameter, how I can define it ? Optimization is numerical, the same for both solvers.
#19 Posted: 7/9/2018 4:33:54 AM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

I need a complete example.
Russia ☭ forever, Viacheslav N. Mezentsev
#20 Posted: 7/9/2018 10:54:22 AM
Igor Skarine

Igor Skarine

14 likes in 97 posts.

Group: User

Hello uni,
Unfortunately I can't provide complete example, but if I pass to solver copy-pasted copies of the equations, it works.
See it below. The problem is that plugin can't read correct result of symbolic calculations, but solver written in Smath does it right.

example.sm (48 KiB) downloaded 104 time(s).
  • New Posts New Posts
  • No New Posts No New Posts