newRPL - build 1255 released! [updated to 1299]
01-11-2019, 04:16 PM
Post: #355
 Claudio L. Senior Member Posts: 1,885 Joined: Dec 2013
RE: newRPL - build 1089 released! [update:build 1127]
(01-11-2019 03:05 AM)The Shadow Wrote:  I'm trying to come up with situations in which one would define conditions on things other than numeric values, and so far I'm coming up blank.

I suppose there might be cases in which one would condition on the exact form of an expression, but surely that's what the actual rules are for?

Likewise, there might be cases where the exact variable being matched would matter, but every case I can think of would be better handled either by just using that variable in the rule, or by the variable attributes you've discussed. Conditioning on those attributes would indeed be very useful, I trust that is possible? (To, for example, define a rule as only applying to matrix variables.) But they'd still be numeric values.

Is there some category of conditions I'm just not seeing?

I can't come up with an example either, but also remember, many numeric expressions can't be computed exactly with ->NUM either, imagine a rule to replace exact known values for SIN(), we need that argument to be expressed as a fraction of pi, which needs to remain symbolic to be exact.
You could write SIN(.NN*pi/2) in the rule itself, but that wouldn't match SIN(pi-pi/2) at first sight. Of course, you could use RULEAPPLY, which would fail at first, then do autosimplification (turning into SIN(pi/2)), then will try again and would match, but not with RULEAPPLY1 which would fail initially and that's the end of it.
Moving that to a condition by writing SIN(.NN) :-> ... | FP(2*.NN/pi)==0 you need to first simplify the condition symbolically so if .NN has pi as a factor it would cancel out, then numerically to check that the result is an integer without precision loss.
 « Next Oldest | Next Newest »