a simpler way? overloaded symbol operators

13 views
Skip to first unread message

Sherm Ostrowsky

unread,
Oct 7, 2011, 3:55:52 PM10/7/11
to mathpi...@googlegroups.com
In MathPiper, I know that we can define our own INFIX operators and make them do whatever we want.  This would be a shortcut way to get some of the functionality I would like to have, without making mods to the language itself.

Do you know if we can use any UNICODE special characters in MathPiper, so that, for example, CIRCLED-PLUS (as a symbol) could be used to define the operator of Addition Mod (a preselected prime)?

Sherm

Ted Kosan

unread,
Oct 7, 2011, 5:18:53 PM10/7/11
to mathpi...@googlegroups.com
Sherm wrote:

Yes, MathPiper is able to use Unicode characters:

In> αβγ
Result: αβγ

In> αβγ:= 7
Result: 7

In> αβγ * 3
Result: 21


However, I will need to enable the use of the ⊕ character before you
can use it. Do you have any other unicode characters that you would
like me to enable?

Also, of the three ways to implement an algebraic system in a CAS that
Ryoh Fuji-Hara listed, I think that #1 fits the current design of
MathPiper the best.

"(1) define new operators: for example; if we define an operator
%+% for addition on a finite field, then we could operate in the
following fashion: 2 %+% 4 . "

Ted

Sherm Ostrowsky

unread,
Oct 7, 2011, 5:31:09 PM10/7/11
to mathpi...@googlegroups.com
On Fri, Oct 7, 2011 at 2:18 PM, Ted Kosan <ted....@gmail.com> wrote:
Sherm wrote:

> In MathPiper, I know that we can define our own INFIX operators and make
> them do whatever we want.  This would be a shortcut way to get some of the
> functionality I would like to have, without making mods to the language
> itself.
>
> Do you know if we can use any UNICODE special characters in MathPiper, so
> that, for example, CIRCLED-PLUS (as a symbol) could be used to define the
> operator of Addition Mod (a preselected prime)?

Yes, MathPiper is able to use Unicode characters:

In> αβγ
Result: αβγ

In> αβγ:= 7
Result: 7

In> αβγ * 3
Result: 21


However, I will need to enable the use of the ⊕ character before you
can use it. Do you have any other unicode characters that you would
like me to enable?


Yes, circled-minus, circled-times, and circled-divide-slash.

 
Also, of the three ways to implement an algebraic system in a CAS that
Ryoh Fuji-Hara listed, I think that #1 fits the current design of
MathPiper the best.

   "(1) define new operators: for example; if we define an operator
%+% for addition on a finite field, then we could operate in the
following fashion: 2 %+% 4 . "

Ted


That's where I got the thought.

Sherm

Ted Kosan

unread,
Oct 8, 2011, 1:09:27 AM10/8/11
to mathpi...@googlegroups.com
Sherm,

>> However, I will need to enable the use of the ⊕ character before you
>> can use it. Do you have any other unicode characters that you would
>> like me to enable?
>>
>
> Yes, circled-minus, circled-times, and circled-divide-slash.

Revision 4336 now has these characters available.

You can paste the symbols into the code where they are needed and here
is a copy of them that you can use:

⊕⊖⊗⊘

Ted

grzesiek

unread,
Oct 8, 2011, 3:20:21 AM10/8/11
to mathpi...@googlegroups.com
Guys, please. It's not even funny. Using unicode characters in the code is not a sane idea, really. And if you're going to do polynomial factorization, please start from analyzing the underlying theory, then getting the algorithm right and implementing it. And I'll be happy to help, as soon as you start the real work instead of the current stream of haphazard syntactic ideas.

Grzesiek

Ted Kosan

unread,
Oct 8, 2011, 3:54:32 AM10/8/11
to mathpi...@googlegroups.com
Grzesiek:

> Guys, please. It's not even funny. Using unicode characters in the code is
> not a sane idea, really.

If Sherm wants to experiment with using Fuji-Hara's "define new
operators" approach for implementing his algorithms, what new
operators would you suggest for this?

Ted

grzesiek

unread,
Oct 8, 2011, 10:47:18 AM10/8/11
to mathpi...@googlegroups.com
Hi,
Being a theoretician, I'm not good at experiments. Anyway, my advice is
1. use only ascii characters
2. use only characters which can be entered using standard US keyboard layout

Rationale:
1. Encoding is still a problematic issue, and better avoided, especially in the source code which is being developed on many platforms.
2. How the hell I'm supposed to enter the characters using standard keyboard???
3. As soon as full Unicode is actively promoted, I'll do my best to express the code for the Chinese Remainder Theorem in Chinese.

Apart from that, I'm not convinced at all that this is the right approach. After all, expressing arithmetic modulo p you have to know p, right? And how is this going to be expressed by a weird unicode character? The next thing is that I, perhaps naïvely, assumed that the issue at hand is polynomial factorization. And I'm not convinced that reimplementation of modulo arithmetic, which is AFAIK already implemented in mathpiper, is the right place to start. But hey, you may experiment with whatever you want. Just please do not introduce weird characters.

Grzesiek

Ted Kosan

unread,
Oct 8, 2011, 2:02:06 PM10/8/11
to mathpi...@googlegroups.com
Sherm wrote:

> Being a theoretician, I'm not good at experiments. Anyway, my advice is
> 1. use only ascii characters
> 2. use only characters which can be entered using standard US keyboard
> layout
> Rationale:
> 1. Encoding is still a problematic issue, and better avoided, especially in
> the source code which is being developed on many platforms.
> 2. How the hell I'm supposed to enter the characters using standard
> keyboard???

Unicode characters are easily entered using pallets of GUI buttons and
with named characters. Mathematica has a large number of these named
characters (many of which are used as operators) and this sets a
powerful precedence for it being okay to use this approach:

http://reference.wolfram.com/mathematica/guide/ListingOfNamedCharacters.html


Sherm, my thought is to go ahead and experiment with using named
unicode characters if you would like to.

Ted

Sherm Ostrowsky

unread,
Oct 8, 2011, 2:59:10 PM10/8/11
to mathpi...@googlegroups.com
I tried a quick idea on this basis and found it unworkable.  Grzesiek may be right.  Anyhow, for now I am going to put this concept on the back burner and return to working on algorithms we REALLY need. 

Sherm

grzesiek

unread,
Oct 8, 2011, 3:59:38 PM10/8/11
to mathpi...@googlegroups.com
Hi,


On Saturday, October 8, 2011 8:02:06 PM UTC+2, tkosan wrote:
 

Unicode characters are easily entered using pallets of GUI buttons and
with named characters.

Necessity to use GUI buttons is a deal breaker for me. It slows down typing and badly distracts. And named characters just look bad.
 

Mathematica has a large number of these named
characters (many of which are used as operators) and this sets a
powerful precedence for it being okay to use this approach:

http://reference.wolfram.com/mathematica/guide/ListingOfNamedCharacters.html

I use Mathematica sometimes and I never had to use neither GUI nor named characters. Mathematica input is easy to prepare using standard text editor, again without resorting to named characters. And Mathematica can be used in text mode, again without resorting to named characters. So much about precedents.
 
Grzesiek


Ted Kosan

unread,
Oct 8, 2011, 8:23:56 PM10/8/11
to mathpi...@googlegroups.com
Sherm wrote:

> I tried a quick idea on this basis and found it unworkable.

In what ways did you find it to be unworkable?

Ted

Sherm Ostrowsky

unread,
Oct 9, 2011, 2:27:23 AM10/9/11
to mathpi...@googlegroups.com
It would take too long to reply tonight.   I'll write tomorrow and explain.  I need to clarify my thoughts. 

Sherm
Reply all
Reply to author
Forward
0 new messages