Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • $\begingroup$ thank you very much for helping me. I already run it but how can I do if I want to substitute the list {-3,0,1,2} as A not the list.? $\endgroup$ Commented Aug 5, 2016 at 13:56
  • 2
    $\begingroup$ @munirah I may misunderstand but I think you mean simply A = {-3, 0, 1, 2} and then on another line -Total[#*pLog2[#] & @ A], or just -Total[A*pLog2[A]]. By the way it is best not to start user Symbol names (like A) with capital letters, as these may conflict with built-ins, e.g. C, D, E, I, N` are all existing reserved Symbols. $\endgroup$ Commented Aug 5, 2016 at 19:05
  • $\begingroup$ It mean when I want to make any, it better for me use small letter?Here, I try to replace the symbol A instead the list {-3, 0, 1, 2} since the list can be variety. hence, I do like this : -Total[#*pLog2[#] & @ A] but iit come error $\endgroup$ Commented Aug 7, 2016 at 0:32
  • 1
    $\begingroup$ @munirah: in short, always use a instead of A, c instead of C, etc. as your variables. $\endgroup$ Commented Aug 7, 2016 at 1:13