How to solve it?

How to solve it? - Messages

#61 Posted: 7/6/2018 8:35:30 AM
Nicolae Olaru

Nicolae Olaru

1 likes in 115 posts.

Group: User

Hello.

I think it would not be bad for Davide to verify my algorithm (it does not correspond in any case to the syntactic precepts used in SMath) to append it and add it to its other models, from where I saw the Levenberg-Marquardt method missing . I will not have claims. What Martin has suggested to me is useless in this case. In the file below I tried to apply LevenbergMarquardt(3) to the simple example of 3 unknown 3 equations that appears in the picture in message # 54. An error occurred.

Nicolas
Untitled.sm (5 KiB) downloaded 36 time(s).
#62 Posted: 7/6/2018 10:02:17 AM
Вячеслав Мезенцев

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

1402 likes in 1708 posts.

Group: Moderator

You can try Maple region from MapleWrapper plugin (updated).

2018-07-06_18-03-00.png
2018-07-06_18-00-22.png


with(stats):
ans:=op(2,fit[leastsquare[[x,y],y=a*x^2+b*x+c]]([[10,15,17,19],[3,4,5,6]])):
Russia ☭ forever, Viacheslav N. Mezentsev
2 users liked this post
Radovan Omorjan 7/6/2018 12:39:00 PM, frapuano 7/6/2018 3:23:00 PM
#63 Posted: 7/6/2018 11:43:20 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Hello.

I think it would not be bad for Davide to verify my algorithm (it does not correspond in any case to the syntactic precepts used in SMath) to append it and add it to its other models, from where I saw the Levenberg-Marquardt method missing . I will not have claims.What Martin has suggested to me is useless in this case. In the file below I tried to apply LevenbergMarquardt(3) to the simple example of 3 unknown 3 equations that appears in the picture in message # 54. An error occurred.

Nicolas



Your About LM algorithm is not ready for publishing.
seemingly you got result in 6671, but fails 6179.
norme(,) looks strange 6671 ... and unknown
norme(,) 6179 is by the bible books.

This example gives 9 decimals in native Smath.

Solve GivenFind MCD Example.sm (21 KiB) downloaded 40 time(s).

Levenberg-Marquardt [Nicolas].sm (38 KiB) downloaded 41 time(s).

#64 Posted: 7/6/2018 5:20:23 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

In the given case LM works with symbolic optimization, but not with numeric. Also, z=0 does not work as initial value.

lm.png
lm.sm (5 KiB) downloaded 40 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#65 Posted: 7/6/2018 8:03:21 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

In the given case LM works with symbolic optimization, but not with numeric. Also, z=0 does not work as initial value.



Thanks Martin,

Will surely be useful in real applications.
Beats Mathcad in simplicity !

Jean
#66 Posted: 7/7/2018 3:37:06 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Wrote

In the given case LM works with symbolic optimization, but not with numeric. Also, z=0 does not work as initial value.

lm.png
lm.sm (5 KiB) downloaded 40 time(s).



The same problem could be solved with many other functions in NonlinearSolvers plugin including the intended FindRoot() as the principal one. Unfortunately, it seems that strictly numerical problems are still problematic and questionable.

Regards,
Radovan

lmext.sm (16 KiB) downloaded 43 time(s).
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#67 Posted: 7/7/2018 10:34:26 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

The same problem could be solved with many other functions in NonlinearSolvers plugin including the intended FindRoot() as the principal one. Unfortunately, it seems that strictly numerical problems are still problematic and questionable.

Regards,
Radovan



Of all those plugin solvers, they all work ± equivalent.
In this examples , FindRoot(,,,) = Mathcad.
But only Broyden solves for both sets of solutions
Yes, there are two sets of solutions because of z^2
Thanks Radovan.

Broyden.PNG

Solve GivenFind Broyden.sm (23 KiB) downloaded 35 time(s).

#68 Posted: 7/7/2018 1:00:17 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Sorry Jean, that was not my point. I thought on something like this one.

nlinsys.PNG

SMath can not solve strictly numerically this and similar problems. I wish I was wrong, but I mentioned this quite a lot of times. I am not sure if I was not understood or simply SMath can not cope with this.

Regards,
Radovan

EDIT: Actually, Davide mentioned this in this post
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#69 Posted: 7/7/2018 1:41:40 PM
Nicolae Olaru

Nicolae Olaru

1 likes in 115 posts.

Group: User

Hello.

From the point of view of symbolic, versus numeric optimization, something should be done to automate such a choice. From the point of view of the algorithms, I am very little experienced. If the algorithm proposed by me can be processed, including with the help of the skilled ones, then fine. My point of view is that SMath is still a non-livelier ground in terms of resolving non-linear systems containing more than two equations. Practically my skill is to effectively use such algorithms and not to produce them. I just launched a challenge and I would be happy if something new in SMath emerged.

Nicolas
1 users liked this post
Fridel Selitsky 7/7/2018 3:51:00 PM
#70 Posted: 7/7/2018 3:37:15 PM
Nicolae Olaru

Nicolae Olaru

1 likes in 115 posts.

Group: User

Wrote

In the given case LM works with symbolic optimization, but not with numeric. Also, z=0 does not work as initial value. ...


I do not even achieve symbolic optimization.

LM_.PNG
#71 Posted: 7/7/2018 6:26:30 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I do not even achieve symbolic optimization.



Try FindRoot NUMERIC. It solves for 3 sets of initials.

FindRoot3sets.PNG
#72 Posted: 7/8/2018 5:29:33 AM
Nicolae Olaru

Nicolae Olaru

1 likes in 115 posts.

Group: User

Bonjour Jean Giraud

I think it was a mere chance that the FindRoot algorithm solved that system. Try the system in the first picture. You will get the error "Cannot solve. Try using a more specific algorithm". Actually, that's what it is all about. Taking into account all the existing plugins, you need to test a wide variety of possible "more specific" algorithms. But by putting six equations of my system in the form of the image, I finally managed to get a first result using the LevenbergMarquardt algorithm (3) - even if I had to wait almost a minute and 37 seconds. It is illustrated in the second image. What did I actually do? I actually chose three disparate points on the first curve (one with a special shape) and three more on the second curve and formed a system of 6 equations. I have managed to solve it, as shown in the second picture, but the solution is far from the (very precise) found by MathCAD. As soon as I have attached another equation (the seventh) that actually represents a constraint on the system, I have not gotten anything, as shown in the third image. In this sense, it is also necessary to work in SMath. First of all you need to find more efficient algorithms for constrained systems. Then you must necessarily find a way for the program to automatically choose between all possible algorithms, only the applicable one. Let's look at things in the following way. The FindRoot algorithm in SMath could be the GivenFind algorithm in MathCAD. This must actually be a special algorithm to choose the applicable method. Among the applicable methods algorithms with constraints should also be included. Only in this way the work of a researcher using SMath as a tool can be effective. It must be borne in mind that the researcher is not necessarily an excellent mathematician of analysis, but perhaps only one of the occasions, who only attempts to obtain the results that interest him in a particular process. Otherwise, all my respect for everyone, and all the best.

Nicolas.

X1.PNG

X2.PNG

X3.PNG
#73 Posted: 7/8/2018 10:20:19 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I have managed to solve it, as shown in the second picture, but the solution is far from the (very precise) found by MathCAD.



1. What is Levenberg-Marquardt ?
An invented gadget solver for some of the casual case of their researchers.
2. Please attach the Smath for the 2nd 6 var example.
3. Mathcd 11 GivenFind solves for 299 simple demand [finite differences DE]
4. The most exhaustive algebraic case MCD 11 solved 22 ... it toke weeks
It had to be associated with lot of < ...> . Straight equalities aren't
solvable by simple algebra.
5. Your base model is not algebraic, thus you can expect infinitely many sols.
That is so true that your LM apparent solution is just one of infinitely many.
6. FindRoot solves your 1rst example.

In your examples, there is the common pitfall ... Explain:
You can't have more accuracy than the given, in this case example [1]
FindRoot epsilon 0.00001. The LM 10^-15 has no meaning at all
Two different results that do sanity identical.
What is the accuracy of pi*0.123 ? Answer => 3 decimals
What is the accuracy of pi *(123/1000) ? Answer => as many decimals as pi

Cheers Nicolas ... Jean

Page1 Nicolas.sm (19 KiB) downloaded 38 time(s).


1 users liked this post
sergio 7/8/2018 12:43:00 PM
#74 Posted: 7/8/2018 1:27:12 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

... here is your 2nd example.
Two solvers => two sets of solutions among infinitely many possible
from not available infinitely many not yet invented solvers.
What is ! true ! in your proposal ? two sets of experimental values
The model you fabricate may be correct, but not enough experimental data.
If projects are secret or not allowed to be public, public forum
is not the place to expect productive help.

page2Nicolas.PNG

Page2 Nicolas.sm (41 KiB) downloaded 28 time(s).
#75 Posted: 7/8/2018 3:46:17 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Another solver from Alglib. I just copied from this post.

al_nleqaolve-corr.PNG

al_nleqsolve-corr.sm (19 KiB) downloaded 41 time(s).

This is a gradient algorithm. You need Jacobian, unfortunately, which might be quite complicated sometimes and often can give us headaches.

Regards,
Radovan

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#76 Posted: 7/8/2018 5:03:51 PM
Nicolae Olaru

Nicolae Olaru

1 likes in 115 posts.

Group: User

Hello.

You do not have to mind Jean Giraud. In the last two posts you made me understand a lot of things. In fact, that's what I wanted from this topic. Thank you very much. Thank you all.

Nicolas.
#77 Posted: 7/8/2018 7:48:19 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Another solver from Alglib. I just copied from this post.



Thanks Radovan, interesting.
Levenberg-Marquardt is one solver, that fails this example.
You can only conclude you have solved if there is a way to
sanity out of doubt. In short, solving is more than some numbers

Jean

Solve Given_Find [CO2_6179].sm (38 KiB) downloaded 39 time(s).
#78 Posted: 7/9/2018 5:07:45 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

You are welcome Jean,

We should not forget roots() which was one of the first functions in SMath of its kind.

roots.GIF

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#79 Posted: 7/9/2018 10:01:59 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

You are welcome Jean,

We should not forget roots() which was one of the first functions in SMath of its kind.



Thanks Radovan,

... refreshed/updated both versions.

Solve Given_Find [CO2_6179].sm (36 KiB) downloaded 36 time(s).
#80 Posted: 7/9/2018 4:22:53 PM
Fridel Selitsky

Fridel Selitsky

520 likes in 451 posts.

Group: User

Determination of the coordinates of the links of spatial
mechanisms by the Alglib solver


PrimerAlgib.sm (63 KiB) downloaded 49 time(s).
3 users liked this post
NDTM Amarasekera 7/9/2018 10:26:00 PM, Radovan Omorjan 7/9/2018 5:04:00 PM, frapuano 7/10/2018 12:39:00 PM
  • New Posts New Posts
  • No New Posts No New Posts