Mathematica中的命令完成:建议规则/选项 [英] Command completion in mathematica : suggest rules/options

查看:162
本文介绍了Mathematica中的命令完成:建议规则/选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在当前版本的Mathematica中,这些键盘快捷键非常方便

In current version of Mathematica these keyboard shortcuts are quite handy

Ctrl + K 完成当前命令

GraphPl -> press Ctrl+K  -> GraphPlot

Ctrl + Shift + K 完成当前命令并添加参数占位符,可以使用 tab

Ctrl+Shift+K completes current command and adds argument placeholders which could be replaced with actual values with tab key

GraphPl -> press Ctrl+Shift+K  ->  GraphPlot[{vi1->vj1,vi2->vj2,...}]

但是我找不到任何键盘选项来显示相关的设置/选项

However I couldn't find any keyboard option to show associated settings/options

例如说如果我需要绘制具有不同布局的图形,我知道我需要使用以下可能的设置之一来设置方法

For instance Say If I need to plot a graph with different layouts, I know I need to set Method with one of these Possible settings

  • "CircularEmbedding"
  • 随机嵌入"
  • "HighDimensionalEmbedding"
  • "RadialDrawing"
  • "SpringEmbedding"
  • "SpringElectricalEmbedding"

两件事

首先,如何自动完成这些选项,是否有任何快捷键?

First How to autocomplete these options , is there any shortcut key ?

GraphPlot[sg, Method -> <what keyboard shortcut to display all possible options>]

第二种方法以编程方式生成以下PopupMenu list

Second how to generate following PopupMenu list programmatically

  list={
   "CircularEmbedding"
   , "RandomEmbedding"
   , "HighDimensionalEmbedding"
   , "RadialDrawing"
   , "SpringEmbedding"
   , "SpringElectricalEmbedding"
   }
Manipulate[GraphPlot[sg, Method -> m], {m, list}, ControlType -> PopupMenu]

是否有什么方法可以像在Java中使用反射一样自省Mathematica函数和访问方法元数据,就像在其他编程语言中一样?

Is there any way to introspect Mathematica functions and access method Metadata similar to the way it could be done in other programming languages, Like using reflection in Java ?

推荐答案

草稿:正在进行中...

这是我到目前为止可以到达的最接近的位置,尽管它需要大量的增强功能,并添加它是因为它希望从社区中获得一些想法.如果有人可以帮助进一步增强它,或者提出任何想法,将不胜感激.

This is the nearest I could reach so far, though It needs loads of enhancement, Adding it as it is hoping to get some Ideas from community. If anyone could help enhance it further, Or suggest any Idea, It would really be appreciated.

ruleOfRule[list_] := Map[Rule[#, #] &, list];
Manipulate[
 GraphPlot @@ {{"A" -> "B", "B" -> "C", "C" -> "A"}, 
   options}, {{options, {}}, ruleOfRule[Options[GraphPlot]]}, 
 ControlType -> CheckboxBar]

这篇关于Mathematica中的命令完成:建议规则/选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆