Floating point error computing

Use this forum to post Vensim related questions.
Post Reply
grockson
Junior Member
Posts: 19
Joined: Mon Apr 14, 2008 4:19 pm

Floating point error computing

Post by grockson »

Dear Experts,

Could you assist me to manage the above subject in my model.

Hope to hear from you soon, with you suggestions and comments.

Sincerely,

George Rockson
Attachments
Passive C Oct1T.mdl
(11.95 KiB) Downloaded 420 times
LAUJJL
Senior Member
Posts: 1426
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Floating point error

Post by LAUJJL »

Hi George

I have replaced the formula "area cs-0"*(1-compaction factor^(2/3)) by
"area cs-0"*(1-((compaction factor^2) ^(1/3) ) )
Compaction factor ^2 becomes positive with compaction factor being negative and the exponential value ^1/3 can then be calculated.

The first formula probably tries to compute first a negative number with the exponential 1/3. It seems to be unable to do it. Strange behaviour.
See the joined model.
But there are other errors coming next eventually of the same kind.
If you try to do the same calculation in Excel, it works the same and can calculate (-1) ** (1/3) but not (-1) ** (2/3).
In Excel the calculation of exponential are strange too.
In fact the 'error' which is not a real error is due to the definition of the Power function in Vensim and probably in Excel too , due to discontinuities in the function if it is directly calculated. If the exponent is an integer it is calculated directly because it has always a result, otherwise it is
(see the Power definition in the Vensim index) equal to
EXP(X*LN(BASE)). If the base is negative and the exponent is not an integer, LN(base) being not defined, it does not give a result in return. Hence problems of continuity of definition of the Power function.
If Vensim accepted complex numbers, the continuity problem would not exist as the function y = a^x has always a solution but in complex numbers whatever a or x of the form a + bi. i being the square of -1. In fact there is a problem of continuity of the real definition when the solution y becomes complex.
the function y = a^X has a derivative too in the C complex numbers set (holomorphism for the mathematicians).
No units in the model?. Very bad practice.
Regards.
JJ

[Edited on 25-10-2008 by LAUJJL]

[Edited on 27-10-2008 by LAUJJL]

[Edited on 28-10-2008 by LAUJJL]

[Edited on 28-10-2008 by LAUJJL]
Attachments
Passive_C_Oct1T_2.mdl
(11.98 KiB) Downloaded 384 times
grockson
Junior Member
Posts: 19
Joined: Mon Apr 14, 2008 4:19 pm

Post by grockson »

[quote]Originally posted by grockson
Dear Experts,

I have attached the governing equations responsible for the differential equations. The Floating error computing still persist after the unit check. The power functions posses a change to, how do i represent them well. The equation are standardized to SI units.

I have a attached the mdl file for your comment and advice

Thanks in advance.

[Edited on 10-31-2008 by grockson]
Attachments

[The extension ocx has been deactivated and can no longer be displayed.]

grockson
Junior Member
Posts: 19
Joined: Mon Apr 14, 2008 4:19 pm

Post by grockson »

Originally posted by grockson
Originally posted by grockson
Dear Experts,

I have attached the governing equations responsible for the differential equations( earlier quote). The Floating error computing still persist after the unit check. The power functions posses a change to, how do i represent them well. The equation are standardized to SI units.

I have a attached the reviewed mdl file for your comment and advice

Thanks in advance.

[Edited on 10-31-2008 by grockson]
Attachments
Passive_C_OctT31.mdl
(11.88 KiB) Downloaded 343 times
LAUJJL
Senior Member
Posts: 1426
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Floating point error

Post by LAUJJL »

Hi Grockson

I do not consider myself as an 'expert' but something looks weird in your model.
First your model runs on 60 days, with a time step of one day and a unit of time of a second. Why?
Secondly the floating point error is due to the fact that the exponent is equal to around 8.000.000 which explains the
floating point error computing the degradation constant (k) which is not a constant by the way!
So there must be an error computing the core temperature.
Again solving the unit errors, press ctrl U would eventually detect your errors.
Regards.
JJ
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

There is a chapter in the User's Guide on finding and fixing errors that should be helpful (Chapter 7). You should also be using RK4 integration and, as JJ points out, clean up the Units problems to make sure things make sense.
grockson
Junior Member
Posts: 19
Joined: Mon Apr 14, 2008 4:19 pm

Floating point error computing

Post by grockson »

Dear Experts

I have restructured the model to ensure unit consistency, although some of the equations where valid, i had to re-write them to get them consistent units.However, I still keep receiving the floating point error message when trying to run the simulation.

Am I over looking something?

What could be your suggestion

Sincerely,


George

[Edited on 11-13-2008 by grockson]
Attachments
Passive_C_NOV11.2mdl
(12.48 KiB) Downloaded 334 times
Post Reply