adrian5213

35 Reputation

4 Badges

9 years, 90 days

MaplePrimes Activity


These are replies submitted by adrian5213

@Carl Love @acer :This is the worksheet for my problem.Till now i still can't convert the message to become Huffman Code thus kindly need for help.I also upload a program code for Huffman compression crytosystem so that you can make it as reference. Thanks 

 

 

 

 

 

 

 

 

FYP_Huffman_Method.mw 

user_interface.mw

@Carl Love Thanks as i get my answer ["A" = "00", "g" = "01", "l" = "10", "o" = "11"]. But when perform the last part of the coding which are 

Do(C = table([HD]));
Do(HC = cat(map(proc (x) options operator, arrow; C[x] end proc, StringTools:-Explode(message))[])


my expected answer for the word algo should be huffman code which in the form is HC := "00100111" but the answer that give after i generate is C["m"] || (C["e"]) || (C["s"]) || (C["s"]) || (C["a"]) || (C["g"]) || (C["e"]). I don't know why,kindly seek for help.

@Carl Love I can't really understand how the process of QR:= proc(N::integer, n::integer) local r, q:= iquo(N,n,r); [q,r] end proc: execute in maple,can briefly explain?

Besides, suppose that I have z:=010100111 and rn:=10010,thus by using the source code above that provided by you instead of write &B QR(010100111, 10010); do I can write &B QR(z, rn) to get the similar answer [1001,101]. I ask this is because for your method you just need to write the number 010100111, 10010 inside the bracket but for me i have a scenario that my value of 010100111, 10010 is get from another binary arithmetic and random number generation respectively.For instance,

z := binaryAdd(100,111);        #answer is 1011

randomize();

q := rand(0 .. 2^(length(z)-1));
rn := convert(p(), binary)                #Assume we get answer 110


Then can I write &B QR(z, rn) instead of &B QR(1011,110) to get the same answer. If cannot, do the source code can be modified so that I can use the method of &B QR(z, rn) to get the answer of &B QR(1011,110)? Kindly help with thanks,hope you and others as well can understand the question.

@Carl Love how to add ,rn to the return statement to show the result??

@tomleslie ya it worked.Thanks. I can get the answer.But can i know how to show out the random binary number. For example the program will select 1101101(7-bit) and sum it together(11101100+1101101=101011001.Thus my expected output will be s1=1101101(random number) and sum=101011001.Can I retrieve the information?

@tomleslie :Thanks for ur coding,i appreciated.But here is something i can't understand. What is  rn:=convert( p(), binary); mean?And what rn,p() and binNo represent?This is because when i try execute the whole things in maple 17, it pops out errors.Thanks^^

@Kitonum :Thank you.But is it possible to have the answer of quotient and remainder after perform binary division.For instance, after 010100111/10010 we can get 1001 as quotient and 101 as the remainder.Do it worked in Maple 17?Seek for help here thanks.

@Carl Love :Thanks.But is it possible to have the answer of quotient and remainder after perform binary division.For instance, after 010100111/10010 we can get 1001 as quotient and 101 as the remainder.Do it worked in Maple 17?Seek for help here thanks.

@John Fredsted: This method is worked.Thanks.But is it possible to have the answer of quotient and remainder after perform binary division.For instance, after 010100111/10010 we can get 1001 as quotient and 101 as the remainder.Do it worked in Maple 17?Seek for help here thanks.

@John Fredsted :Thanks but the answer is in one's complement only.I am sorry as i made a mistake in my example as well. Thus, is it possible to perform two's complement from binary number?the example is at comment above.

@dharr ,i understand dy thanks.But is it possible to perform two's complement from binary number,for instance after the 2's complement of 101011001 will be 010100111 which the '0' located at the most left will not disappear.

thanks u,i try to used it @tomleslie 

Page 1 of 1