How many Distinct n variable boolean functions are there? [closed] - boolean

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Since there are n variables wouldn't there be 2^n boolean functions?

For an n-ary boolean function, there are 2^n possible boolean inputs. Each input can generate
either "true" or "false" as the output. How many different ways can you arrange the 2^n true vs. false outputs?

If there are p possibilities for choice 1 and q possibilities for choice 2 then there are a total of p*q different ways of doing both.
It is trivial that this can be extended to n choices.
http://en.wikipedia.org/wiki/Rule_of_product
So, yeah, there would be 2^n boolean functions (as for each choice there are two alternatives).

Related

How to name my averaging technique? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Suppose, I have a list of values {4, 10, 3, 6, 7, 15, 11}. The average of this number list is avg=8. Now I will select only those elements > avg, which are {10, 11, 15}. Now I am doing average again and selecting the elements bigger than their average. I believe this a helpful technique to get the top rated values from a list, I am not sure about the naming of this averaging technique. Can anybody help me with some name of this method?
Thanks in advance
How about using Averoveraging?
I'm not sure what your code looks like, but I'd imagine on one pass you are returning elements higher than the average? So I would name that method ElementsGreaterThanAverage.
If you're only always doing two passes, you could call it TopQuarterByAveraging or something.
You're computing the mean, then showing everything over it. Hence OverMean.

Numerical Methods tutorials/books/videos for non math knowers [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm currently attending the first year of college at Computer Science. I'm having great problems with something named Numerical Methods because I lack at mathematics. I don't have a basis for math concepts.
Could any of you please tell me a good book, tutorial site or videos of Numerical Methods for people that don't have a clear basic knowledge of mathematics?
I tried looking for something like "Numerical Methods for Dummies", but I didn't find anything equivalent.
For good reference books on numerical methods, you can check out the answers to the question What is the best book on numerical methods?
Bear in mind that numerical methods are a subfield of Maths. Thus you do need a clear basic knowledge of mathematics and you probably need to look for other books (not Numerical Methods ones) to fill your knowledge gaps.
Try Numerical Methods for Scientists and Engineers
Try sniffing around the internet for course notes (lecture notes) from other universities, especially for first year/second year engineering mathematics (for a general grounding) and numerical methods after that.
My university had very good lecture notes, but I can't distribute them. Other universities are more liberal.
You may also want to check out MIT OpenCourseWare, which contains lecture notes and course materials from the Massachusetts Institute of Technology. Some of the lecturers at MIT literally wrote the book on their respective field, so you can't go wrong with anything you find there.
Links to interesting courses on MIT OCW:
18.330 Introduction to Numerical Analysis
6.042J Mathematics for Computer Science
I do not know if this suits you... but you can try this:
http://apps.nrbook.com/c/index.html - Numerical Recipes ( http://www.nr.com/ )

Why languages do not allow multiple return values? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
In languages like C which supports pointer operation, you can easily get multiple values from a procedure. But in languages like Java, it is a pain if you actually need to get multiple return values. (Using an object to wrap multiple values is bad)
In my experience, allowing multiple values returned can help improve software engineering--more flexible to organise procedure invocation, etc. But why there are so many languages that do no allow returning multiple values? I am interested to know the reasons. Thank you very much.
Could be because many of the designers of these languages have strong math backgrounds and in math a function can have multiple input parameters but (almost always) only a single output value.
Also, it keeps code understandable and standardized to some extent.

Matlab code formatting similar to AStyle? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Is there any tool similar to AStyle to format matlab code in m-files?
In recent versions of MATLAB, you can use the "Smart Indent" tool programmatically using the MATLAB Editor API.
As an example, say you want to fix indentation of all M-files contained in a specific directory:
%# gel list of m-files in a directory
BASE_DIR = 'c:\path\to\folder';
files = dir( fullfile(BASE_DIR,'*.m') );
files = {files.name};
for i=1:numel(files)
%# open file in editor, apply smart indentation, save and close
doc = matlab.desktop.editor.openDocument( fullfile(BASE_DIR,files{i}) );
doc.smartIndentContents;
doc.save;
doc.close;
end
Remember that you can select text in Matlab's editor and press Ctrl+I to auto-indent it. (Also , use Ctrl+A to select all the text.)

How do I write a generic function that takes a Number or some alphabets and display that in 7- bit segment display.? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I want to write a Digital Clock application in which I have a 7- bit segment display. I want to write a generic code for displaying all the input. I have a CGPath in which I have 1 line for each segment.
Now, how would I write a generic function for the above description?
Any help with some logic or code will be appreciated.
Thanks
Simplest would be a look-up table. You could do it with ten bytes. Assign one bit in the bytes to each segment. Pre-load the table with the hex values necessary to set the bits. Index the table with your digit 0-9. If you want to have additional combinations of segments then make the table larger -- typically these are set up to display an additional 6 "characters" (eg, A, b, C, d, E, and F), making the table conveniently 16 long.
But, for extra credit, do it with NAND gates.