acer

32822 Reputation

29 Badges

20 years, 131 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by 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

> with(StringTools):

> G := CharacterFrequencies("I have the best dog."):
 
> [seq([lhs(x),rhs(x)],x in G)];

[[" ", 4], [".", 1], ["I", 1], ["a", 1], ["b", 1], ["d", 1],
 ["e", 3], ["g", 1], ["h", 2], ["o", 1], ["s", 1], ["t", 2],
 ["v", 1]]

acer

> with(StringTools):

> G := CharacterFrequencies("I have the best dog."):
 
> [seq([lhs(x),rhs(x)],x in G)];

[[" ", 4], [".", 1], ["I", 1], ["a", 1], ["b", 1], ["d", 1],
 ["e", 3], ["g", 1], ["h", 2], ["o", 1], ["s", 1], ["t", 2],
 ["v", 1]]

acer

Right. That's why I used CoefficientVector, as it is the efficienct way to get all coefficients, in order.

And so I used it to construct the data in columns. (I amended with an example showing an extra column, using the angle-bracket notation, without having to use Transpose).

acer

Right. That's why I used CoefficientVector, as it is the efficienct way to get all coefficients, in order.

And so I used it to construct the data in columns. (I amended with an example showing an extra column, using the angle-bracket notation, without having to use Transpose).

acer

For me, issuing evalf(solAC[1]) returns 1.582989180.

You could also do evalf([solAC]), and so on.

> evalf([solAC]);
[1.582989180, 0.7753797235 + 1.370887407 I,
-0.7914541420 + 1.343041826 I, -1.550840342,
-0.7914541420 - 1.343041826 I, 0.7753797235 - 1.370887407 I]

acer

For me, issuing evalf(solAC[1]) returns 1.582989180.

You could also do evalf([solAC]), and so on.

> evalf([solAC]);
[1.582989180, 0.7753797235 + 1.370887407 I,
-0.7914541420 + 1.343041826 I, -1.550840342,
-0.7914541420 - 1.343041826 I, 0.7753797235 - 1.370887407 I]

acer

I didn't notice the comma in the rhs of the original post. That, and the use of round-brackets, threw me off. I suppose now that the OP was actually using a syntax for a vector-valued function (just not Maple syntax). Sorry.

acer

I didn't notice the comma in the rhs of the original post. That, and the use of round-brackets, threw me off. I suppose now that the OP was actually using a syntax for a vector-valued function (just not Maple syntax). Sorry.

acer

Have a look at the help-page ?allvalues

minor point: Above, you use the word "evaluate" when it seems you actually mean evaluate an approximation in floating-point. The same term is also misused here. In Maple, the term "evaluation" means something quite distinct, but not that. The routine evalf does floating-point approximate evaluation. See also ?radnormal if you are interested in treatment of expressions containing radicals of exact symbolic values.

acer

First 526 527 528 529 530 531 532 Last Page 528 of 601