Discussion:
How to let MetaPost ignore redundant equations
(too old to reply)
wensa
2007-12-26 05:28:58 UTC
Permalink
AFAIK, redundant equations is harmless in most situations

but mpost.exe always complains about it

Is there any way to let MP ignore redundant equations? or check
whether an equation is redundant in MP source file, just like `if
known <var>' works?

Thanks in advance
Dan
2007-12-26 06:03:28 UTC
Permalink
Post by wensa
AFAIK, redundant equations is harmless in most situations
but mpost.exe always complains about it
Is there any way to let MP ignore redundant equations? or check
whether an equation is redundant in MP source file, just like `if
known <var>' works?
Thanks in advance
It depends on the equation. If x is known,
x=1;
is either redundant or inconsistent. If one is confident of
the correctness of this equation then
x:=1;
would avoid error messages. If one is confident any previous
known value is correct then
if unknown x: x = 1; fi
would avoid a redundant equation.

For less simple equations, e.g.,
x = u + v;
the "if unknown" trick is not so simple. One would have to
check all variables and omit the equation if all are known.
Of course the
x := u + v;
thing only works if u and v are known.

I don't think there is a way out of this. Certainly there is no
state variable that can be set to cause mpost to not treat
this as an error. Of course, one can always run mpost in
batch mode.

I tend to take the "redundant equation" message personally,
and am not satisfied until I know why it occurs and correct
the problem code.


Dan
wensa
2007-12-26 06:49:58 UTC
Permalink
Post by Dan
Post by wensa
AFAIK, redundant equations is harmless in most situations
but mpost.exe always complains about it
Is there any way to let MP ignore redundant equations? or check
whether an equation is redundant in MP source file, just like `if
known <var>' works?
Thanks in advance
It depends on the equation. If x is known,
x=1;
is either redundant or inconsistent. If one is confident of
the correctness of this equation then
x:=1;
would avoid error messages. If one is confident any previous
known value is correct then
if unknown x: x = 1; fi
would avoid a redundant equation.
For less simple equations, e.g.,
x = u + v;
the "if unknown" trick is not so simple. One would have to
check all variables and omit the equation if all are known.
Of course the
x := u + v;
thing only works if u and v are known.
I don't think there is a way out of this. Certainly there is no
state variable that can be set to cause mpost to not treat
this as an error. Of course, one can always run mpost in
batch mode.
I tend to take the "redundant equation" message personally,
and am not satisfied until I know why it occurs and correct
the problem code.
Dan
The situation i met was sth like this

a = b; b = c; c = d;

and a,b,c,d are all unknown vars

then i set

d = b;

in some place, and of course this is a redundant equation

maybe i should try a different approach to solve this, using a Set or
sth to put all equal vars together, and declare them in equations at
the final stage

Loading...