?? difenc0.prg
字號(hào):
Execute(GetConfig(1));
autoconfig(x__):={if(AskUserYesNo("There is an error in your main input configuration:"+chr(13)+chr(10)+x__+chr(13)+chr(10)+"Do you want to configure the main input automatically?")==0,{abort(x__);},
{
i:=0;
while({unknown[i]:=GetUserInput("Enter the "+numtos(i+1)+"th unknown vector:");i:=i+1;asc(unknown[i-1])!=0},{});
if(i==1,{abort("You must enter at least one unknown vector.");},{});
unknown[i-1]:=0;
h:=atol(GetUserInput("Enter the delay in the difference equation:"));
n0:=atol(GetUserInput("Enter the initial index:"));
maxn:=atol(GetUserInput("Enter the maximal index:"));
computeall:="n0:="+numtos(n0)+";"+chr(13)+chr(10)+"maxn:="+numtos(maxn)+";"+chr(13)+chr(10);
i:=0;
while({valid(unknown[i])==-4},{
computeall:=computeall+"unknown["+numtos(i)+"]:="+chr(34)+unknown[i]+chr(34)+";"+chr(13)+chr(10)+unknown[i]+"(n):={"+
GetUserInput("Enter the right hand side of the equation "+unknown[i]+"[n]=...")+"};"+chr(13)+chr(10);
j:=1;
while({j<=h},{computeall:=computeall+unknown[i]+"["+numtos(n0-j)+"]:="+
GetUserInput("Enter the value of "+unknown[i]+"["+numtos(n0-j)+"] :")+";"+chr(13)+chr(10);j:=j+1;});
i:=i+1;
});
SetConfig(computeall);
Abort("The setup is complete."+chr(13)+chr(10)+"Use File/Execute to start again."+chr(13)+chr(10)+chr(13)+chr(10)+computeall);
});
};
if(valid(n0)!=-1,
{autoconfig("You must define the variable n0 as the initial index.");},{});
if(valid(maxn)!=-1,
{autoconfig("You must define the variable maxn as the maximal index.");},{});
if((valid(unknown[0])!=-4),
{autoconfig("You must define the vector unknown[ ] as the names of the unknown vectors.");},{});
computeall1:=(computeall2:=(computeall3:=""));
i:=0;n:=n0;
while({valid(unknown[i])==-4},
{
execute(unknown[i]+ "[maxn]:=0;" );
if(valid(execute(unknown[i]))==-16,
{
if((valid(execute(execute(unknown[i])))==-1)||(valid(execute(execute(unknown[i])))==-2),
{
computeall1:=computeall1+unknown[i]+ "[n]:=execute("+unknown[i]+");";
},
{
autoconfig("The equation for "+unknown[i]+"[n] gives a non-numeric value.");
});
},
{
if((valid(execute(unknown[i]+"(n0)"))==-1)||(valid(execute(unknown[i]+"(n0)"))==-2),
{
computeall1:=computeall1+unknown[i]+ "[n]:="+unknown[i]+"(n);";
},
{
autoconfig("The equation for "+unknown[i]+"[n] is not defined or gives a non-numeric value.");
});
});
i:=i+1;
});
j:=1;
n:=n0-1;
ExecViewTemplates(1);
computeall1:=execute("{"+computeall1+"updateviews(0);}");
n:=n+1;
cont(mn):={n:=n-1;maxn:=mn;while({n:=n+1;n<=maxn},computeall1);};
cont(maxn);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -