Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wolfram mathematica 尝试删除临时符号时出现意外的Remove::rmnsm错误_Wolfram Mathematica - Fatal编程技术网

Wolfram mathematica 尝试删除临时符号时出现意外的Remove::rmnsm错误

Wolfram mathematica 尝试删除临时符号时出现意外的Remove::rmnsm错误,wolfram-mathematica,Wolfram Mathematica,你好 考虑以下几点: In[1]:= HoldComplete[With[{line=a},Null]] Names["`*"] Attributes/@Names["`*"] Remove/@Names["`*"] Out[1]= HoldComplete[With[{line=a},Null]] Out[2]= {a,line,line$} Out[3]= {{},{},{Temporary}} During evaluation of In[1]:= Remove::rmnsm: Ther

你好

考虑以下几点:

In[1]:= HoldComplete[With[{line=a},Null]]
Names["`*"]
Attributes/@Names["`*"]
Remove/@Names["`*"]
Out[1]= HoldComplete[With[{line=a},Null]]
Out[2]= {a,line,line$}
Out[3]= {{},{},{Temporary}}
During evaluation of In[1]:= Remove::rmnsm: There are no symbols matching
"line$". >>
Out[4]= {Null,Null,Null}
您可以看到,
Remove::rmnsm
消息出现,尽管临时
Symbol
行$
此时仍然存在。为什么会发生这种情况


另外,我正在使用Mathematica 7.01。在v.5.2中,此消息不会出现。

我认为当您删除符号
时,将不会再引用临时变量
行$
,因此它将自动删除

In[1]:= HoldComplete[With[{line=a},Null]]
        Names["`*"]
        Attributes/@Names["`*"]
Out[1]= HoldComplete[With[{line=a},Null]]
Out[2]= {a,line,line$}
Out[3]= {{},{},{Temporary}}

In[4]:= Remove["line"]

In[5]:= Names["`*"]
Out[5]= {a}
这是在Mma v8中测试的。那么,自v5以来,引用计数(或本地化的实现)可能发生了轻微的变化

请注意,如果您尝试先删除临时符号,您将收到一条信息丰富的警告:

In[6]:= HoldComplete[With[{line=a},Null]]
        Names["`*"]
        Attributes/@Names["`*"]
        Remove/@Reverse@Names["`*"]
Out[6]= HoldComplete[With[{line=a},Null]]
Out[7]= {a,line,line$}
Out[8]= {{},{},{Temporary}}
During evaluation of In[6]:= Remove::relex: Cannot remove lexical symbol 
   line$ except automatically (when line is removed). >>
Out[9]= {Null,Null,Null}

谢谢你的解释。在版本5.2中,符号
行$
未创建:
Hold@Evaluate@对于[{line=a},名称[“`*]”]
给出了
Hold[{a”,“line”}]
,而在7.01版中,它给出了
Hold[{a”,“line”,“line$”}]
。但是如果没有
Hold
HoldComplete
Mathematica 7.01,则不会创建符号
行$
。为什么?我认为可能
With
总是创建这样的变量,但它们在正常终止时被删除。如果某项操作(如
保持
跟踪
)停止了
的正常运行,则不会删除临时变量。但希望WRI的人会来告诉我到底发生了什么…@Alexey当我评估
Hold@Evaluate@有了[{line=a},名字[“`*]”]
从一个新内核中,我得到:
Hold[{“a”,“line”}]
@Mr.Wizard这是我的错误<代码>Hold@With[{line=a},Null];Names[“*”]`在干净的内核
Hold@With[{line=a},Null];名称[“`*]”
给了我
{“a”,“line”}