我试图设置以下约束:
assume(E1A::integer,E2A::integer,...,E2B::integer,...,E3C::integer)
additionally(E1A>=0,E2A>=0,...,E3C>=0)
additionally(E1A<=3,E2A<=3,...,E3C<=3)
有没有办法在不输入所有条款E1A, E2A,...,E3C
的情况下执行此操作?我试着做了
for i from 0 to 3 do (assume(EiA::integer)) end do
作为捷径,但Maple并不喜欢这样,大概是因为它没有将i
视为索引变量。
答案 0 :(得分:1)
您可以通过连接形成名称。
restart:
assume( seq( cat(`E`,i,`A`)::integer, i=1..3 ) );
现在,要测试,
[ seq( cat(`E`,i,`A`), i=1..3 ) ]:
map( about, % ):
Originally E1A, renamed E1A~:
is assumed to be: integer
Originally E2A, renamed E2A~:
is assumed to be: integer
Originally E3A, renamed E3A~:
is assumed to be: integer
您还可以嵌套seq
,例如
restart:
assume( seq( seq( cat(`E`,i,abc)::integer, i=1..3), abc=[A,B,C] ) );
[ seq( seq( cat(`E`,i,abc), i=1..3), abc=[A,B,C] ) ]:
map( about, % ):
答案 1 :(得分:1)
使用elementwise运算符和连接运算符,您可以将所有假设都归结为一行:
assume(E||(1..3)||A ::~ AndProp(integer, RealRange(0,3)));