$多个变量的假设
我想将整个笔记本的变量限制在特定范围内,有没有一种方法可以一次性做到这一点,而无需为每个变量输入不同的 $asstitution 行?
编辑:我想定义笔记本中所有计算的变量域(谷歌搜索帮助我更好地构建了我的需求!)
I want to restrict my variables to certain ranges for my entire notebook, is there a way I can do that in one go without entering a different $assumption line for every variable?
Edit: I want to define the domain of variables for all calculations in my notebook (googling helped me frame my needs better!)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的所有变量都将是(例如)
Real
,那么您可以 拦截新符号的创建并将该假设添加到$Asminations
。例如,如果您创建一个您不想成为真实的新符号,那么您可以使用类似
$Asminations = Most[$Asminations]
的内容。注意:我不一定认为这种方法是个好主意......
最好只为您要使用的变量定义
$Asminations
。这可以使用Map
、Table
等以编程方式完成。If all of your variables are going to be (for example)
Real
, then you can intercept the creation of new symbols and add that assumption to$Assumptions
. E.g.Then if you create a new symbol that you don't want to be real, then you could follow up with something like
$Assumptions = Most[$Assumptions]
.Note: I don't necessarily claim that this approach is a good idea...
It's probably best to just define the
$Assumptions
for the variables you are going to use. This can be done programmatically usingMap
,Table
, etc.全局定义如下
然后使用全局定义的变量如下
Globally define as follows
then use globally defined variables as follows