将集合转换为表达式Maple/将前缀更改为固定表达式 [英] convert a set to expression Maple/ Change prefix to In-fix expression

查看:128
本文介绍了将集合转换为表达式Maple/将前缀更改为固定表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将以下设置转换为表达式

How to convert the below set to expression

Expression := {{a°b}, {a°x°y}} # ° can be any operator

要求的输出为

result := {a°b, a°x°y}  #required output

我尝试使用以下转换函数进行转换,

I have tried to convert using convert function like below,

asString := convert(Expression, string);
with(StringTools):
asString :=Remove("{}", asString)

result := InertForm:-Parse(asString);

但是我的输出是Pre-fix表达式的顺序.

but my output is in the order of Pre-fix expression.

结果:= {"°(a,b),°(°(a,x),y)"}

result := {"°(a,b), °(°(a,x),y)"}

亲切的问候

推荐答案

restart;

foo := {{a/b}, {a+x*y}}:

result := map(op, foo):

lprint(result);
  {a/b, x*y+a}

不能保证结果集的条目将以与原始集的顺序相同的顺序出现.因此,将集合用于这种一般事物永远无法正常工作.

There is no guarantee that the resulting set will have its entries appearing in the same order as the original set of sets. And hence using sets for this general kind of thing is never going to work properly.

这就是为什么我在列表而不是嵌套的 sets 的原因上周,您对该主题的许多问题中的另一个问题-完成了功能表达式名称和功能名称的映射.您当前的问题表明您没有遵循我的建议.

That's why I used nested lists instead of nested sets, in my answers to another of your many questions on this theme last week. Your current Question indicates that you're not following my advice.

这篇关于将集合转换为表达式Maple/将前缀更改为固定表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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