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

Notification

Icon
Error

Login


14 Pages«<56789>»
Options
Go to last post Go to first unread
Offline Davide Carpi  
#121 Posted : 01 February 2013 05:15:37(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,648
Man
Italy
Location: Italy

Was thanked: 1330 time(s) in 876 post(s)
Originally Posted by: mkraska Go to Quoted Post
Hello w3bsurf3r,

I played around with nonlinear solvers, unfortunately without any success. At least not if units are involved.

Are the solvers supposed to work with units?
- can the unknown variables have units (given via units of limits or start point)?
- need the epsilons have units as well?

do I need to define functions or can I just give expressions as first argument?


Are the solvers supposed to work with units? -> yes...
- can the unknown variables have units (given via units of limits or start point) -> yes...
- need the epsilons have units as well? -> yes, of course...

...but something is clearly broken, somewhere Crazy (here there is an example of applications with units)
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline kilele  
#122 Posted : 01 February 2013 12:32:14(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: mkraska Go to Quoted Post

- need the epsilons have units as well?
kilele attached the following image(s):
rootsunits.png
thanks 2 users thanked kilele for this useful post.
on 01/02/2013(UTC),  on 01/02/2013(UTC)
Offline mkraska  
#123 Posted : 01 February 2013 13:34:41(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
Thanks, kilele, for the examples.

Indeed most of my problems were caused by my wrong assumption of epsilon being a tolerance to the unknown variable to be solved for. Obviously it is a tolerance to the function. I remember that we had a discussion on the subject if we should have tolerances to variables and function values and how to specify them. For now I shall assume that all implemented Solvers assume function tolerances.

The question of function vs. expression remains open.

Martin

Edited by user 01 February 2013 13:38:33(UTC)  | Reason: Not specified

mkraska attached the following image(s):
Bisection test.png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline mkraska  
#124 Posted : 01 February 2013 14:04:25(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
Hello w3bsurf3r,

Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post


Are the solvers supposed to work with units? -> yes...
- can the unknown variables have units (given via units of limits or start point) -> yes...
- need the epsilons have units as well? -> yes, of course...


Thanks for clarifying, now I made some progress.
I still fail to specify systems of equations correctly. Any idea what is wrong?

I like the feature of the roots() function that you can specify an equation with RHS and LHS. As I understand the solvers in the plugin do not allow that type of specification. Ok, it is allowed but then the solution is any set of unknowns that render the equations unsatisfied (boolean equal giving 0).

Would that be difficult to implement (perhaps by internal transformation to standard form)?
File Attachment(s):
AS 7-7Bisection.sm (100kb) downloaded 52 time(s).
mkraska attached the following image(s):
AS 7-7Bisection.png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline mkraska  
#125 Posted : 01 February 2013 15:06:43(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
The Bisection test file in the plugin docs is outdated (examples have the now removed iterations argument). I attached a corrected version.

Martin
File Attachment(s):
Bisections_testing.sm (30kb) downloaded 54 time(s).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 01/02/2013(UTC)
Offline Davide Carpi  
#126 Posted : 01 February 2013 19:11:49(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,648
Man
Italy
Location: Italy

Was thanked: 1330 time(s) in 876 post(s)
Originally Posted by: mkraska Go to Quoted Post
Thanks for clarifying, now I made some progress.
I still fail to specify systems of equations correctly. Any idea what is wrong?

I like the feature of the roots() function that you can specify an equation with RHS and LHS. As I understand the solvers in the plugin do not allow that type of specification. Ok, it is allowed but then the solution is any set of unknowns that render the equations unsatisfied (boolean equal giving 0).

Would that be difficult to implement (perhaps by internal transformation to standard form)?

I think the issue involving the massive solver it's something related with multiple convergence criterions; I need to investigate...

As a general rule, input bounds (or initial guess) have the same unit of unknown; so if you use a dimensionless unknown, you must input dimensionless bounds. What's the unknown, x or D? Basically D=f(x) it's a parametric variable, so the parameter (x) it's the unknown. Look the symbolic evaluation of your input function to check this (see the attachments).

The RHS/LHS function was in my goals from the beginning; working with DataExchange export features I've understand how to do it, will be implemented ASAP... Unfortunately, the code of the plugin is currently as a Dr. Frankenstein creature, so it will take some time to restore the order and then introduce new features. Crazy

Originally Posted by: mkraska Go to Quoted Post
The Bisection test file in the plugin docs is outdated (examples have the now removed iterations argument). I attached a corrected version.

Martin

Thank you very much Biggrin


best regards,

w3b5urf3r

Edited by user 01 February 2013 21:04:17(UTC)  | Reason: Not specified

File Attachment(s):
AS%207-7Bisection.sm (108kb) downloaded 52 time(s).
Davide Carpi attached the following image(s):
SMath Studio - [AS%207-7Bisection.sm]_3.png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 01/02/2013(UTC)
Offline mkraska  
#127 Posted : 01 February 2013 23:07:48(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
Hello w3bsurf3r,

thanks again for the help. Now I can take advantage of the unit capabilities of your plugin at least for scalar equations. That already renders the solution of my example quite lean. No need for dimensionless variables any more.

Martin

mkraska attached the following image(s):
AS 7-7Bisection_skalar.png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline mkraska  
#128 Posted : 07 February 2013 19:53:10(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
Hello w3bsurf3r,

I am again running into problems with equation solving. I never can exclude wrong operation but these seem like bugs.

Broyden and HRE.B do not handle zero starting values

Brent fails to solve a linear equation.

Martin
File Attachment(s):
AS 3-26 solvers.sm (201kb) downloaded 49 time(s).
mkraska attached the following image(s):
AS 3-26 solvers.png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Davide Carpi  
#129 Posted : 07 February 2013 20:22:45(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,648
Man
Italy
Location: Italy

Was thanked: 1330 time(s) in 876 post(s)
Originally Posted by: mkraska Go to Quoted Post
Hello w3bsurf3r,

I am again running into problems with equation solving. I never can exclude wrong operation but these seem like bugs.

Broyden and HRE.B do not handle zero starting values

Brent fails to solve a linear equation.

Martin

Hi Martin,

Yes, Broyden can't be solved with units if you use a null initial guess... In SMath Studio the 0 value have no units by default, I've already mentioned this behavior writing the first UoM() snippet function (I'm not sure if this is related to some SMath feature or it's a simple lack).
I can improve the function looking for units inside the 2nd error parameter (if any), but nothing more... As for now you can use a small number (f.e. 10^{-15}*'mm)

About Brent I see an "Units don't match" error, I need to investigate...


Thanks again for your testings

w3b5urf3r

Edited by user 07 February 2013 21:36:40(UTC)  | Reason: Not specified

Davide Carpi attached the following image(s):
SMath Studio - [AS 3-26 solvers.sm].png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline mkraska  
#130 Posted : 08 February 2013 01:40:19(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post

Yes, Broyden can't be solved with units if you use a null initial guess... In SMath Studio the 0 value have no units by default, I've already mentioned this behavior writing the first UoM() snippet function (I'm not sure if this is related to some SMath feature or it's a simple lack).


Hi w3bsurf3r

wondering why this problem obviously does not affect Newton Raphson, I came to the conclusion

The unit of measurement of the unknown can be obtained by dividing the unit of measurement of the function at x=0 by the gradient at that point. This works as long as
  • the gradient wrt the unknowns can be generated symbolically
  • the gradient is defined and nonzero at x=0

In fact, nothing else than dividing f by it's gradient is done by NR, such that the mentioned conditions should be more or less also the conditions for applicability of NR.

Martin

Edited by user 08 February 2013 01:43:02(UTC)  | Reason: Not specified

mkraska attached the following image(s):
Gradient.PNG
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Davide Carpi  
#131 Posted : 08 February 2013 13:56:55(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,648
Man
Italy
Location: Italy

Was thanked: 1330 time(s) in 876 post(s)
Originally Posted by: mkraska Go to Quoted Post
Hi w3bsurf3r

wondering why this problem obviously does not affect Newton Raphson, I came to the conclusion

The unit of measurement of the unknown can be obtained by dividing the unit of measurement of the function at x=0 by the gradient at that point. This works as long as
  • the gradient wrt the unknowns can be generated symbolically
  • the gradient is defined and nonzero at x=0

In fact, nothing else than dividing f by it's gradient is done by NR, such that the mentioned conditions should be more or less also the conditions for applicability of NR.

Martin


You're absolutely right!

However (IMHO) the native units support for zero values in SMath would be very appreciable Good
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Davide Carpi  
#132 Posted : 26 February 2013 17:27:53(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,648
Man
Italy
Location: Italy

Was thanked: 1330 time(s) in 876 post(s)
"The plotted course"

EDIT: previews



Edited by user 05 May 2013 17:07:21(UTC)  | Reason: Added new preview

Davide Carpi attached the following image(s):
SMath Studio - [NonlinearSolvers Working Plan.sm].png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 27/02/2013(UTC)
Offline Rising Eagle  
#133 Posted : 28 February 2013 02:21:31(UTC)
Rising Eagle


Rank: Member

Groups: Registered
Joined: 14/12/2012(UTC)
Posts: 23
Location: Neverland

Was thanked: 15 time(s) in 9 post(s)
Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post
can't be solved with units if you use a null initial guess... In SMath Studio the 0 value have no units by default, I've already mentioned this behavior writing the first UoM() snippet function (I'm not sure if this is related to some SMath feature or it's a simple lack).


In general, 0 is more than just a real number or place holder representing, in this case, an empty set. When it comes to systems with units, 0 is actually a chameleon with universal units (in the same way that type O blood is for universal donor). It can be handled by either treating each 0 as a function that transforms the number unitless 0 into a 0 with units of its surrounding factors as appropriate for the calculation, or by changing the rules of the uses of units as programmed into smath so that units associated with 0 (whether present or not) are completely ignored and all unit determinations are made by use of units provided by all non-0 factors.

Offline Davide Carpi  
#134 Posted : 05 March 2013 02:25:31(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,648
Man
Italy
Location: Italy

Was thanked: 1330 time(s) in 876 post(s)
Originally Posted by: Rising Eagle Go to Quoted Post
In general, 0 is more than just a real number or place holder representing, in this case, an empty set. When it comes to systems with units, 0 is actually a chameleon with universal units (in the same way that type O blood is for universal donor). It can be handled by either treating each 0 as a function that transforms the number unitless 0 into a 0 with units of its surrounding factors as appropriate for the calculation, or by changing the rules of the uses of units as programmed into smath so that units associated with 0 (whether present or not) are completely ignored and all unit determinations are made by use of units provided by all non-0 factors.

I agree with your logic Good

However I hope that in future the numeric optimization can preserve the units for zero values Good

Edited by user 28 March 2013 19:38:45(UTC)  | Reason: Not specified

Davide Carpi attached the following image(s):
SMath Studio - [Page1.sm]_2.png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline mkraska  
#135 Posted : 06 May 2013 19:39:19(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
Is the plugin expected to work under 0.96? I get just errors in type conversion.

Davide, I saw your recent previews and assume that there is a new version on the way, thus this post may be irrelevant. If not, I am ready to provide details on the problems.
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Davide Carpi  
#136 Posted : 06 May 2013 19:48:48(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,648
Man
Italy
Location: Italy

Was thanked: 1330 time(s) in 876 post(s)
Originally Posted by: mkraska Go to Quoted Post
Is the plugin expected to work under 0.96? I get just errors in type conversion.

Davide, I saw your recent previews and assume that there is a new version on the way, thus this post may be irrelevant. If not, I am ready to provide details on the problems.


Yes, there's a new version on the way, but requires time Biggrinownload:

There are no irrelevant posts for me... could be that I have already solved the problem, as well as no; feel free to post any issue Good
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline mkraska  
#137 Posted : 06 May 2013 19:55:24(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
Don't know, where to start, perhaps first making sure I have the current version of the plugin. Can you confirm that 1.0.4657.20187 is current? I got it from the link in the wiki plugin page and re-installed it in the course of trouble-shooting today.

In the handbook I have screenshots, where the Bisection function has no precision argument. That does not seem to work now. And I must admit that I didn't keep track with which version that image was generated.
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Davide Carpi  
#138 Posted : 06 May 2013 20:06:03(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,648
Man
Italy
Location: Italy

Was thanked: 1330 time(s) in 876 post(s)
Originally Posted by: mkraska Go to Quoted Post
Don't know, where to start, perhaps first making sure I have the current version of the plugin. Can you confirm that 1.0.4657.20187 is current? I got it from the link in the wiki plugin page and re-installed it in the course of trouble-shooting today.

In the handbook I have screenshots, where the Bisection function has no precision argument. That does not seem to work now. And I must admit that I didn't keep track with which version that image was generated.

Ah, yes.... this is because the screenshot is made with the latest BETA version Good

Quote:
- solver Bisection(...) revisited (the number of iterations is no longer required, as reported by adiaz) (previous BETA - no changes);




best regards,

w3b5urf3r

Edited by user 06 May 2013 20:11:50(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Andrey Ivashov  
#139 Posted : 06 May 2013 20:21:18(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post
However (IMHO) the native units support for zero values in SMath would be very appreciable Good

I'm agree. Do you have an exact example (which requires no additional plug-ins) where I can see an issue?

Regards.
Offline mkraska  
#140 Posted : 06 May 2013 23:15:17(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post

Ah, yes.... this is because the screenshot is made with the latest BETA version Good


The issue was indeed in mixing plugin versions. Now everything is red-free and consistent with the handbook. I'd recommend to put all current material (beta and non-beta) to the topic starter posting. But never mind, I am now a bit more strict in archiving plugin distros (and just can cite uni: need more sleep...)

Martin
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Users browsing this topic
Guest
14 Pages«<56789>»
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.