yasemin

15 Reputation

2 Badges

11 years, 217 days

MaplePrimes Activity


These are questions asked by yasemin

Hi,
i am trying to built a maplet which can encode and decode.  for example i have Ceasar encryption codes and i want to built a maplet that can do it. 

you can see below one of my try: encode is working but decode didnt work :/ what should i do?

restart:
with(Maplets[Elements]):
with(StringTools):

alphabet := convert([97, 98, 99, 231, 100, 101, 102, 103, 240, 104, 253, 105, 106, 107, 108, 109, 110, 111, 246, 112, 114, 115, 254, 116, 117, 252, 118, 121, 122],bytes): 

code:= letter -> SearchText(letter,alphabet)-1:
char := i -> alphabet[i+1]:
modulus := Length(alphabet): 
shift := proc(key);
i -> (i+key) mod modulus;
end:

CaesarEnc :=()-> Action(Evaluate('cpmessage'= 'Implode(map(char,map(shift('ky'),map(code,Explode('text')))))')):

CaesarDec := () -> Action(Evaluate('cpmessage' = 'CaesarEnc(-'ky','text')')):

Caesar := Maplet(Window('title'= "Caesar Encoding And Decoding", BoxLayout['BL1']( BoxColumn('halign'=left,
BoxRow(Label['l1']("Write message: ",'width'=100,'halign'=left), TextBox['text']('background'=white,'foreground'= brown,'height'=6,'editable'=true,'width'=50)),BoxRow(Label['l2']("Key: ",'width'=100,'halign'=left), TextBox['ky']('background'=white,'foreground'= black,'height'=3,'editable'=true,'width'=50)),Button("Encode",'onclick'=CaesarEnc()), Button("Decode",'onclick'=CaesarDec()),BoxRow(Label['l3']("Text: ",'width'=100,'halign'=left), TextBox['cpmessage']("",'background'=white,'foreground'= blue,'height'=6,'editable'=false,'width'=50) ))))):
Maplets[Display](Caesar);

i need to do it for my thesis. waiting for your answers, thank you :)

hi, i have a problem with maple. i took the codes from a book, it should be true but even i copied and past exactly the same, again the maple gave me error which i couldnt solve. could you please help me? how can i correct it ? incorrect codes are below, but if you need all codes i can write here. i need a solution immediately :(

>relativefrequencies := proc(text, language)
evalf(frequencies(text, language)/StringTools:-Length(text))
end proc:
VigenereKeyFind := proc(ciphertext, max:=floor(StringTools:-Length(ciphertext)/15),
{language:=en})
uses StringTools;
local freqs;
freqs := map(x -> relativefrequencies(x, language),
map(Implode, partit(Explode(ciphertext),
keylength(ciphertext, max, ’:-language’=language))));
Implode(map(li -> frequencyanalysis(li, ’:-language’=language), freqs))
end proc;

>VigenereKeyFind(c);
Error, (in VigenereKeyFind) ``’`` does not evaluate to a module

Page 1 of 1