acer

32353 Reputation

29 Badges

19 years, 331 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

If you click on the user's handle (appearing underneath the title of the post) then it takes you to that user's profile-page. I see an entry (on that page, not in the sidebar, if I am logged in) named "Write private message" under the heading "Private messages".

acer

convert(...,`+`) is an old technique. I am not 100% sure, but I suspect that it may predate add.

acer

convert(...,`+`) is an old technique. I am not 100% sure, but I suspect that it may predate add.

acer

>for i from 1 to 5 do
>   x := 5*i^2+2*i-2;
>   if x=22 then
>     next;
>   end if;
>   print(x);
> end do:
                        5

                        49

                        86

                        133

Maple also has a goto, but in your example it looked like what you were after was actually next. (I could be wrong in that guess -- it really wasn't clear. x never equals 20, using that formula with x from 1 to 100. And if say it did then is the posted code supposed to simply skip to the next i, or to loop indefinitely?)

acer

>for i from 1 to 5 do
>   x := 5*i^2+2*i-2;
>   if x=22 then
>     next;
>   end if;
>   print(x);
> end do:
                        5

                        49

                        86

                        133

Maple also has a goto, but in your example it looked like what you were after was actually next. (I could be wrong in that guess -- it really wasn't clear. x never equals 20, using that formula with x from 1 to 100. And if say it did then is the posted code supposed to simply skip to the next i, or to loop indefinitely?)

acer

Ok, it's Friday evening, and time to relax with a little coding. I think that something can be done here using StringTools:-HammingDistance, random permutations of the (usual) most frequent English letters, some fixed-length wordlists, a mix of frequency analysis and a little early deduction (eg, recognition of apostrophe-s and single-letter "a", etc).

acer

Ok, it's Friday evening, and time to relax with a little coding. I think that something can be done here using StringTools:-HammingDistance, random permutations of the (usual) most frequent English letters, some fixed-length wordlists, a mix of frequency analysis and a little early deduction (eg, recognition of apostrophe-s and single-letter "a", etc).

acer

> M:=Matrix(3,4);
                                 [0    0    0    0]
                                 [                ]
                            M := [0    0    0    0]
                                 [                ]
                                 [0    0    0    0]
 
> M(4,1..):=<1,2,3,4>:

> <<a,b,c,d>|M>;
                            [a    0    0    0    0]
                            [                     ]
                            [b    0    0    0    0]
                            [                     ]
                            [c    0    0    0    0]
                            [                     ]
                            [d    1    2    3    4]

acer

> M:=Matrix(3,4);
                                 [0    0    0    0]
                                 [                ]
                            M := [0    0    0    0]
                                 [                ]
                                 [0    0    0    0]
 
> M(4,1..):=<1,2,3,4>:

> <<a,b,c,d>|M>;
                            [a    0    0    0    0]
                            [                     ]
                            [b    0    0    0    0]
                            [                     ]
                            [c    0    0    0    0]
                            [                     ]
                            [d    1    2    3    4]

acer

Suppose you (somehow!) knew what the 10 top frequencies were in the decrypted message. Suppose that you knew that they were "teahinrlos".

> relorder := cat(map(lhs,sort([Characte\
> rFrequencies(S)], (a,b)->(rhs(a)>rhs(b))))[]);
                  relorder := " ABUWNMeXPrKaZSJyDC'zOL.wnlh,"

> CharacterMap(Take(relorder,11),cat(" ","teahinrlos"),S);
"wt's aerD harK to liae in a stLKio aSartJent in zan nose Zith a Jan Zho's \
    learninO to SlaD the aiolin. yhat's Zhat she tolK the SoliCe Zhen she h\
    anKeK theJ the eJStD reaolaer. liCharK hraLtiOan, yhe zCarlatti yilt"

There's still quite a bit to figure out, even there. But the problem is that there's no easy way to figure out the frequencies of letters in the decrypted message. That sequence "teahinrlos" is not the usual sequence that Joe mentioned as usually occurring for long messages. So how could you find it? Even if you focused on just the six most frequent letters, how would you figure out that they were "teahin" rather than "etaoni"? I don't see how frequency analysis (alone) helps solve this problem.

acer

Suppose you (somehow!) knew what the 10 top frequencies were in the decrypted message. Suppose that you knew that they were "teahinrlos".

> relorder := cat(map(lhs,sort([Characte\
> rFrequencies(S)], (a,b)->(rhs(a)>rhs(b))))[]);
                  relorder := " ABUWNMeXPrKaZSJyDC'zOL.wnlh,"

> CharacterMap(Take(relorder,11),cat(" ","teahinrlos"),S);
"wt's aerD harK to liae in a stLKio aSartJent in zan nose Zith a Jan Zho's \
    learninO to SlaD the aiolin. yhat's Zhat she tolK the SoliCe Zhen she h\
    anKeK theJ the eJStD reaolaer. liCharK hraLtiOan, yhe zCarlatti yilt"

There's still quite a bit to figure out, even there. But the problem is that there's no easy way to figure out the frequencies of letters in the decrypted message. That sequence "teahinrlos" is not the usual sequence that Joe mentioned as usually occurring for long messages. So how could you find it? Even if you focused on just the six most frequent letters, how would you figure out that they were "teahin" rather than "etaoni"? I don't see how frequency analysis (alone) helps solve this problem.

acer

I find it interesting that it can be difficult to apply relative frequency analysis alone and gain insight on such short (substitution) enciphered messages.

For this example, generating and apply all permutations of maps of the first handful of usually-most-frequent letters would produce a too large number of candidate "decrypted" messages. The best of those may not even have many actual full valid English words in it, so filtering them by dictionary matching  may also be involved.

For short messages, some combination of deduction, inspired guesswork, and relative frequency analysis might be a good all round approach. I notice that, after guessing the encrypted "r" and "w", the next that I obtained by inspired deduction were "AUPMNWB"  which also happen to comprise quite a bit of the most frequent encrypted letters "ABUWNM".

acer

I find it interesting that it can be difficult to apply relative frequency analysis alone and gain insight on such short (substitution) enciphered messages.

For this example, generating and apply all permutations of maps of the first handful of usually-most-frequent letters would produce a too large number of candidate "decrypted" messages. The best of those may not even have many actual full valid English words in it, so filtering them by dictionary matching  may also be involved.

For short messages, some combination of deduction, inspired guesswork, and relative frequency analysis might be a good all round approach. I notice that, after guessing the encrypted "r" and "w", the next that I obtained by inspired deduction were "AUPMNWB"  which also happen to comprise quite a bit of the most frequent encrypted letters "ABUWNM".

acer

Sure, I could have written,

map([lhs,rhs],[G]);

It seems to me that, when the OP appears to be learning Maple, a little longer and more clear is more helpful.

acer

Sure, I could have written,

map([lhs,rhs],[G]);

It seems to me that, when the OP appears to be learning Maple, a little longer and more clear is more helpful.

acer

First 516 517 518 519 520 521 522 Last Page 518 of 592