rifsimp[ranking] - understanding rankings and related concepts
rank-greater(v1,v2)
#Criterion 1: Solving variables
If v1 is a solving variable, and v2 is not, then
return(true)
If v2 is a solving variable, and v1 is not, then
return(false)
#Criterion 2: Total Degree
If dord(v1) is larger than dord(v2), then
return(true)
If dord(v2) is larger than dord(v1), then
return(false)
#Criterion 3: Independent Variable Differential Order
Loop i := each independent variable in sorted order
If diff. order of v1 in i is larger than order of v2 in i, then
return(true)
If diff. order of v2 in i is larger than order of v1 in i, then
return(false)
end loop
#Criterion 4: Dependent Variable
If dependent var for v1 occurs before v2, then
return(true)
If dependent var for v2 occurs before v1, then
return(false)
end
Dependent Variables [f(x,y,z), g(x,y), h(x,z)]
Independent Variables [x,y,z]
Constants [a,b]
Criterion 1 a < f, a < g, b < f,
b < g, a < f[x], b < h[xxzz]
Criterion 2 f[xyy] < f[xxyy], f[x] < h[zz], g[xx] < h[xxz],
h[z] < f[xx], f < h[x], h < f[x]
Criterion 3 f[xxy] < f[xxx], h[z] < f[y], g[y] < f[x],
f[xz] < g[xy], f[yz] < f[xz], h[z] < h[x]
Criterion 4 g[xxy] < f[xxy], b < a, h[z] < f[z],
g[xy] < f[xy], h[xz] < f[xz], g < f
{a, b} < {f, g, h, f[x], f[y], f[z], g[x], g[y], h[x], h[z],
f[xx], f[xy], `...`}}
{f, g, h} < {f[x], f[y], f[z], g[x], g[y], h[x], h[z]}
< {f[xx], f[xy], `...`} < ...}
{f, g, h} < {f[x], g[x], h[x]} < {f[y], g[y]} < {f[z], h[z]}
< {f[xx], g[xx], h[xx]} < {f[xy], g[xy]} < ...}
{b} < {a} < {h, h[x], h[z], h[xx], h[xz], `...`}
< {g, g[x], g[y], g[xx], g[xy], `...`}
< {f, f[x], f[y], f[z], f[xx], `...`}}
{a, b} < {g, g[x], g[y], g[xx], `...`}
< {f, b, h, f[x], f[y], f[z], h[x], h[z], f[xx], f[xy], `...`}
{b} < {a} < {g, g[x], g[y], g[xx], g[xy], `...`}
< {h, h[x], h[z], h[xx], h[xz], `...`} < {c}
< {f, f[x], f[y], f[z], f[xx], `...`}
{a, b} < {h, h[x], h[z], h[xx], `...`} <
{g, c, g[x], g[y], g[xx], `...`} < {f, f[x], f[y], f[z], f[xx], f[xy], `...`}
{b} < {a} < {h, h[x], h[z], h[xx], h[xz], `...`} < {c}
< {g, g[x], g[y], g[xx], g[xy], `...`} < {f, f[x], f[y], f[z], f[xx], `...`}
f[xyz] [1,1,1, 1,0,0,0]
h[xxxxx] [5,0,0, 0,0,1,0]
s[xzz] [1,0,2, 0,0,0,1]
g [0,0,0, 0,1,0,0]
ranking = [ [0,0,0, 1,1,1,1], # This corresponds to criterion 1
[1,1,1, 0,0,0,0], # This corresponds to criterion 2
[1,0,0, 0,0,0,0], # These three lines are criterion 3
[0,1,0, 0,0,0,0],
[0,0,1, 0,0,0,0],
[0,0,0, 4,3,2,1]] # This corresponds to criterion 4
For examples we will take as input single equations or a system of decoupled equations and observe their solved form in the output. They will be solved for their leading indeterminate.
>
with(Rif):
sys:=[diff(g(x,y,t),x,x)+diff(f(x,y,t),x,y)+
diff(f(x,y,t),y,y)+diff(f(x,y,t),t)=0];
By default, the above will be solved for the g derivative, as f and g have equal weight (criterion 1). The equation is differential order 2, so this narrows it down to the three second order derivatives (criterion 2), but x derivatives are of greater weight than y derivatives (criterion 3), so the equation will be solved for g[xx] :
> rifsimp(sys);
So how can we solve for f instead? The obvious way is to give f more weight than g by declaring it as the solving variable by using vars (alter criterion 1):
> rifsimp(sys,[f]);
What if we wanted to solve for the y derivative of f ? Well, we could then also weight y derivatives greater using indep :
> rifsimp(sys,[f],indep=[y,x]);
Good, but what if we want to solve for the t derivative of f . This is an unusual example because we are solving for a lower order derivative in terms of higher order derivatives. We could specify a new ranking that weights t derivatives higher than everything else:
>
sample_rank:=[[0,0,0,1,0], # Solve for f over g
[0,0,1,0,0]]:# t derivs are greatest
ivars:= [x,y,t]:
dvars:= [f,g]:
With the above ranking, f is always greater than g , and t derivatives are always greater than x or y derivatives of any order. We have to declare the order of occurrence in the command line arguments so that we can match the independent and dependent variables to the sample_rank table. (These are typed in above for visualization.)
> rifsimp(sys,dvars,indep=ivars,ranking=sample_rank);
Note: We did not specify a full ranking, but instead specified as much as we required, then let the default ranking take over.
Note that a ranking like the one above is natural for certain classes of equations. As an example, consider the heat equation u[t] = u[xx]+u[yy]+u[zz] where the form of the solved equation is only physically meaningful when solving for the time derivatives in terms of the space derivatives, even when the space derivatives are of higher differential order.
As a final example, we construct a strange ranking that weights t derivatives twice as heavily as x derivatives. This is done for the following:
>
sys:=[diff(f(x,t),x,x,x)+diff(f(x,t),t)+diff(f(x,t),x,x),
diff(g(x,t),t)+diff(g(x,t),x,x)];
>
sample_rank:=[[1,2,0,0], # t derivs have 2* weight of x
[0,1,0,0]]:# t derivs are greatest
ivars:= [x,t]:
dvars:= [f,g]:
rifsimp(sys,dvars,indep=ivars,ranking=sample_rank);
checkrank , rifsimp , rifsimp[nonlinear] , rifsimp[options]