Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3707 closed defect (fixed)

Handle roots of negative values don't work well

Reported by: Vitalij Ruge Owned by: Lennart Ochel
Priority: high Milestone: 1.9.4
Component: Code Generation Version: v1.9.4-dev-nightly
Keywords: Cc:

Description

e.g.

  model assertPow
    parameter Real Null = 0;
    Real pow1 = Null^(-0.1);
    Real pow2 = (-abs(sin(time*10)/2))^(-0.1);
  end assertPow;

simulate without assert or warnings.
I would expect some assert/warning

A test(s) for the extra lines are missing.

Change History (12)

comment:1 by Lennart Ochel, 9 years ago

Is this just about to handle 0^x with x < 0?

in reply to:  1 comment:2 by Vitalij Ruge, 9 years ago

Replying to lochel:

Is this just about to handle 0^x with x < 0?

Why pow1 inside the model 0^(-0.1) return no assert?
I guess inf == inf is true.

BTW. In this case you should move this check inside the first "if case", where you check already has a check for 0^x with x < 0.

comment:3 by Vitalij Ruge, 9 years ago

I mean |x| < 1

comment:4 by Vitalij Ruge, 9 years ago

Forget it :D

comment:5 by Vitalij Ruge, 9 years ago

I make mistake

comment:6 by Vitalij Ruge, 9 years ago

I have see you PR.
I mean you will have issues with:

  model powAssert
    Real pow2 = (-abs(cos(time*10)/2))^(-0.1);
  end assertPow;

Other tools will return here:
Model error - power: ( -abs(0.5*cos(time*10))) (-0.1) = (-0.5) (-0.1)

Version 1, edited 9 years ago by Vitalij Ruge (previous) (next) (diff)

comment:7 by Vitalij Ruge, 9 years ago

Of the other hand:

model tets
 parameter Real one = 1;
Real pow2 = (-one)^(1/3);
end tets;

will return same error in other modelica tool.

comment:8 by Vitalij Ruge, 9 years ago

Why

(-1)^(1.1) has an assert see PR203
(-0.1)^(0.1) has no assert.

Last edited 9 years ago by Vitalij Ruge (previous) (diff)

comment:9 by Vitalij Ruge, 9 years ago

I don't know the right strategie, but this has some potencial for solver issues with e.g. bad startvalues.

comment:10 by Lennart Ochel, 9 years ago

Resolution: fixed
Status: newclosed

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

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

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

Milestone: 1.9.4-1.9.x1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.