符号工具箱修剪最终的“点"从符号名称 [英] Symbolic toolbox trims final "dot" from symbol name

查看:77
本文介绍了符号工具箱修剪最终的“点"从符号名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了八度符号工具箱的奇怪行为,其中以 -dot 结尾的符号变量丢失了最后的 dot-suffix.

I encountered weird behaviour of the symbolic toolbox of octave, where a symbolic variable ending in -dot looses the final dot-suffix.

pkg load symbolic;
clear, clc;
syms xxxdot
syms % Symbolic variables in current scope: xxxdot
xxxdot % xxxdot = (sym) xxx

我只是偶然发现了它,因为我有相同的变量,带有和不带有后缀 -dot.但请注意,如果定义了另一个符号变量而没有最后的 -dot,则 Octave 符号将不会合并它们.所以数学仍然是正确的:

I only stumbled upon it, because I had the same variable with and without the suffix -dot. But note that if another symbolic variable is defined without the final -dot, Octave symbolic will not merge them. So the math is still correct:

pkg load symbolic;
clear, clc;
syms xxxdot xxx % Symbolic variables in current scope: xxxdot xxx
xxxdot + xxx % ans = (sym) xxx + xxx

有人知道这是从哪里来的吗?

Does anyone have an idea where this comes from?

我使用的是 Octave 4.2.2-1ubuntu1,octave-symbolic 2.6.0-3build1(Ubuntu 18.04,内核 4.15.0-101-通用)

I am using Octave 4.2.2-1ubuntu1, octave-symbolic 2.6.0-3build1 (Ubuntu 18.04, Kernel 4.15.0-101-generic)

推荐答案

我猜你在运行图形界面.

I would guess you are running the graphical interface.

如果您在终端上运行八度音程,您会看到某些 unicode 字符似乎从 GUI 中被截断了.

If you run octave on the terminal, you will see certain unicode characters that seem to be truncated from the GUI.

此功能没有很好的文档记录(实际上根本没有),但请查看以下页面以了解正在发生的事情:

This functionality is not well documented (at all, actually), but have a look at the following pages to get an idea of what is happening:

  • https://octave.sourceforge.io/symbolic/function/sympref.html (look at the display section)
  • https://octave.sourceforge.io/symbolic/function/@sym/pretty.html

本质上,似乎八度/符号足够聪明,可以理解变量名称后跟有效的类似乳胶的符号"修饰符,如点、帽子、波浪号、ddot、dddot、ddddot,并相应地表示变量:

Essentially, it seems that octave / symbolic is smart enough to understand a variable name is followed by a valid latex-like 'notation' modifier, like dot, hat, tilde, ddot, dddot, ddddot, and represents the variable accordingly:

octave:1> sym('xdot'), sym('xddot'), sym('xdddot'), sym('xddddot'), sym('xhat'), sym('xtilde')
ans = (sym) ẋ
ans = (sym) ẍ
ans = (sym) x⃛
ans = (sym) x⃜
ans = (sym) x̂
ans = (sym) x̃

(实际上,Unicode 在 StackOverflow 上似乎没有那么好,但在终端中看起来还可以).

(actually, the unicode doesn't seem as good on StackOverflow, but it looks ok in the terminal).

正如 sympref 所建议的,如果你不喜欢这种行为(或者如果你在 GUI 上并且它不起作用,呃),你可以改变它,例如sympref display asciisympref display flat.

As sympref suggests, if you don't like this behaviour (or if you're on the GUI and it doesn't work, duh), you can change it, e.g. sympref display ascii or sympref display flat.

话虽如此,我鼓励您履行您的社区职责,并将 GUI 输出的缺失报告为 Octave 错误跟踪器上的错误.:)
我确定这不是故意的,可能与用于 GUI 的终端中缺乏对 unicode 的完全支持有关...

Having said that, I would encourage you to do your community duty and report the lack of output for the GUI as a bug on the octave bug tracker. :)
I'm sure it's not intentional, and probably has more to do with lack of full support for unicode in the terminal used for the GUI...

这篇关于符号工具箱修剪最终的“点"从符号名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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