#2265 closed enhancement (fixed)
simplify after replace variable
Reported by: | Vitalij Ruge | Owned by: | Vitalij Ruge |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.0 |
Component: | Backend | Version: | trunk |
Keywords: | simplify | Cc: | Jens Frenkel |
Description (last modified by )
Simplify missing for der(x1)
in
model missingSimplify Real x1(start = 1, fixed = true); Real x1_dummy; Real x2(start = 1); Real x3(start = 1); equation x1_dummy = x1; der(x1) = sin(x1_dummy)/x1 - sin(x1)/x1; /* != 0 (don't work) */ der(x2) = sin(x1)/x1 - sin(x1)/x1; /* = 0 */ der(x3) = x1_dummy - x1; /* = 0 */ end missingSimplify;
with der(x2) = der(x1)
. So simplify should work for der(x1)
too.
Here the C code:
/* equation index: 3 type: SIMPLE_ASSIGN der(x1) = DIVISION(sin(x1), x1, #SHARED_LITERAL_2(String)#) + DIVISION(-sin(x1), x1, #SHARED_LITERAL_3(String)#) */ static void eqFunction_3(DATA *data) { modelica_real tmp0; modelica_real tmp1; modelica_real tmp2; modelica_real tmp3; tmp0 = sin($Px1); tmp1 = DIVISION(tmp0, $Px1, _OMC_LIT2); tmp2 = sin($Px1); tmp3 = DIVISION((-tmp2), $Px1, _OMC_LIT3); $P$DER$Px1 = (tmp1 + tmp3); }
Change History (9)
comment:1 by , 12 years ago
Cc: | added |
---|---|
Description: | modified (diff) |
comment:2 by , 12 years ago
There is a simplify after removing the aliases because there is used BackendVarTransform.replaceEquation to do this. The problem is that
sin(x1) / x1 + (-sin(x1)) / x1
is not simplified to
(sin(x1) - sin(x1)) / x1
and finally to 0.
comment:3 by , 12 years ago
Because plus is simpler :) There is just a rule missing to simplify also the above one
comment:4 by , 12 years ago
Actually, if we had a rule to simplify:
f()/x + g()/x
→ (f()+g())/x
, we would simplify the rest fine as well...
Version 0, edited 12 years ago by (next)
comment:5 by , 12 years ago
Keywords: | replace removed |
---|---|
Owner: | changed from | to
Status: | new → accepted |
follow-up: 7 comment:6 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Fixed in r16506
comment:7 by , 12 years ago
comment:9 by , 11 years ago
Milestone: | 2.0.0 → 1.9.0 |
---|
BatchModify: Updating milestone since this ticket was closed in time for the 1.9.0 release
Note:
See TracTickets
for help on using tickets.
There is probably no simplify after removing the alias variables?!