Opened 12 years ago

Closed 7 years ago

#1930 closed defect (worksforme)

Wrong symbolic simplification

Reported by: Vitalij Ruge Owned by: somebody
Priority: high Milestone: 1.13.0
Component: Frontend Version: trunk
Keywords: Cc:

Description

The follow is a model with wrong symbolic simplification.

model A
  Real x1;
  Real x2;
  Real y;
  Real w;
equation
  x1 = 0/y;
  y*x2 = 0;
  der(y) = 1;
  w = x1/sin(x1);
initial equation
  y = 0;
  x2 = 1;
end A;

Output with +d=optdaedump

Known Variables (constants) (3)
=============================
1:  x1:VARIABLE(start = 0.0 )  = 0.0 .A, .Real type: Real (start = 0.0 )
2:  w:VARIABLE(start = 0.0 )  = 0.0 .A, .Real type: Real (start = 0.0 )
3:  x2:VARIABLE(start = 0.0 )  = 0.0 .A, .Real type: Real (start = 0.0 )

Initial Equations (2, 2)
)
=========
1 : y = 0.0
2 : 0.0 = 1.0

Error 1
If x1 is 0 then w is "division by zero" or 1.

Error 2
x1 is (to runtime = 0) not define (x1 =0/0).

Error 3
From y*x2 = 0 not follows x2 = 0/y = 0. In this case is correct x2 = 1, y = 0
(see initial equation).

Change History (10)

comment:1 by Jens Frenkel, 12 years ago

Component: BackendFrontend

The error is caused by Expression Simplification because this reports the frontend

class SimplifyEquations
  Real x1;
  Real x2;
  Real y;
  Real w;
initial equation
  y = 0.0;
  x2 = 1.0;
equation
  x1 = 0.0;
  y * x2 = 0.0;
  der(y) = 1.0;
  w = x1 / sin(x1);
end SimplifyEquations;

comment:2 by Martin Sjölund, 11 years ago

Milestone: 1.9.01.9.1

Postponed until 1.9.1

comment:3 by Martin Sjölund, 10 years ago

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:4 by Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:5 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:6 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:7 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:8 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:9 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

in reply to:  description comment:10 by Francesco Casella, 7 years ago

Milestone: 1.12.01.13.0
Resolution: worksforme
Status: newclosed

Replying to vitalij:

Error 1
If x1 is 0 then w is "division by zero" or 1.

As of v1.13.0-dev-155-g68350e9 a division by zero error is generated and the simulation is aborted at initialization.

Note: See TracTickets for help on using tickets.