Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
In Book, "But how do it know" I am trying to understand how CPU actually works. I got the concept of bit. But I am not getting this line: "The computer part has a device that does something with bits. If you have 2 bits and you connect those two bits to input, the device looks at those bits and "Decides" Whether to turn one output bit on or off"
Author explains a little later, " when both inputs are off, the output is on, so.... how do you get electricity at the output if both inputs are off?. Well, that is an excellent question, and the excellent answer is that every one of these devices is also connected to power."
HOW?
Sounds like what you are talking about is an XNOR gate. These gates are similar to AND gates but also activate when both inputs are 0.
Logic gates use power similar to how many other electrical devices do. For example, a light switch only turns on the lightbulb when you apply the correct input (closing the switch). The gates simply have a more complicated switch that activates when the correct inputs "close the switch" and allow current to flow from the power source to the output of the gate.
The internals of logic gates can get fairly complicated which is why we simplify the logic to easily identifiable boolean logic gate symbols and their corresponding truth tables. You'll notice that these symbols often don't include any power inputs as they are assumed and omitted from the boolean logic diagrams.
https://www.electronics-tutorial.net/digital-logic-gates/xnor-gate/
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Can an Operating System be considered as an algorithm? Focus on the finiteness property, please. I have contradicting views on it right now with one prof. telling me something and the other something else.
The answer depends on picky little details in your definition of word 'algorithm', which are not relevant in any practical context.
"Yes" is a very good answer, since the OS is an algorithm for computing the next state of the kernel given the previous state and a hardware or software interrupt. The computer runs this algorithm every time an interrupt occurs.
But if you are being asked to "focus on the finiteness property", then whoever is asking probably wants you to say "no", because the OS doesn't necessarily ever terminate... (except that when you characterize it as I did above, it does :-)
By definition an Operation System can not be called an algorithm.
Let us take a look at what an algorithm is:
"a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer."
The Operating System is composed by set of rules (in the software coding itself) which allow the user to perform tasks on a system but is not defined as a set of rules.
With this said, the Operating System itself is not an algorithm, but we can write an algorithm on how to use it. We can also write algorithms for Operating Systems, defining how it should work, but to call the Operating System itself an algorithm does not make much sense. The Operating System is just a piece of software like any other, though considerably bigger and complex. The question is, would you call MS Word or Photoshop an algorithm?
The Operating System is, however, composed of several algorithms.
I'm sure people will have deferring views on this matter.
From Merriam-Webster: "a procedure for solving a mathematical problem ... in a finite number of steps that frequently involves repetition of an operation". The problem with an OS, is even if you are talking about a fixed distribution, so that it can consist of a discrete step-by-step procedure, it is not made for solving "a problem". It is made for solving many problems. It consists of many algorithms, but it is not a discrete algorithm in and of itself.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 7 years ago.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I love using Google for quick back-of-the-envelope calculations. For instance, if I want to know the approximate weight of a carbon-12 ion with charge state 4, I search for
12 u -4*electron mass in u
and get the answer 11.9978057 atomic mass units. More complex things, such as the cyclotron frequency of this ion in some magnetic field, are just as easy:
1/(2*pi)*4* (elementary charge)/(12 u - 4*(electron mass)) * 5.1125 Tesla
This returns the correct answer 26.174171 MHz. The fact that I can enter 12u - 4*(electron mass) and Google converts the units on the fly, is really helpful to me. WolframAlpha can do even more, but Google is a lot quicker and does not ask for a subscription after my nth query.
As an offline solution, I used a Matlab script in which I had most constants defined, but Matlab takes 30 sec to 1 min to start up, which is frustrating. Mathematica is not much faster to start up, either. Also, for technical reasons I have to use network licenses, so these programs are not offline solutions anymore. I switched to Excel (which loads quite fast), where I have a sheet that used named ranges. This is semi-convenient, but it just feels wrong.
Is there any lightweight Windows program that provides this functionality offline?
You can use the Units program that was originally developed for UNIX. There is a native Windows port that is based on version 1.87 (2008). The current version of the UNIX tool is 2.01 (2012).
Units was originally designed to do simple unit conversion, but it also supports evaluating mathematical expressions. It requires you to specify the unit of the output and gives you two lines as a result: The result that you want is the first line, the second line is the inverse of the result.
This program has three major shortcomings when compared to the Google math expression evaluation:
You have to know the unit that you want to get in advance. (I don't always know it, and sometimes I just don't care. Often this unit is "1", as for the result of the calculation sin(pi).)
It does not tell you how it interpreted the units that you entered. Google always returns a parsed version of the input string, so that you can see where Google misunderstood you.
It is quite strict when it comes to variable names. Multi-word names are not permitted, so electron mass is called electronmass (m_e also works).
The installer.exe is easy enough to use, but on my Windows XP machine it did not set the path variables of the command line correctly. I set up a simple shortcut on my Desktop that points to: C:\Programs\GnuWin32\bin\units.exe.
Overall, Units is a nice and quick calculator that starts up a few thousand times faster than Matlab or Mathematica - but the user interface has some shortcomings.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
One of the distinguishing features of a good encryption algorithm, is that it is easy to encrypt, and hard to crack. Are there any that are easy enough for average folk to remember, and calculate by hand, and still stand up to brute force attacks on a computer.
Imagine, a prisoner (with pen and paper) sending a message to another inmate, and the guards seize the handwritten message - and put their prison-crypto-cracking department on it.
Currently, I am thinking TEA is the best candidate, but pretty hard to remember I think.
Yes, there are examples of strong cryptographic algorithms which can be implemented by hand. For example, in Neal Stephenson's classic - the Cryptonomicon, there's an algorithm called Solitaire (or Pontifex) developed by Bruce Schneier for use with a deck of playing cards. Here is Wikipedia's explanation, and here is the description from the author's home page.
One-time pads are do-able by hand and impossible to crack, unless the opponent gets hold of the one-time pad. Have each prisoner make up a bunch of one-time pads, number them according to some scheme, have them exchange the pads, then when transmitting the message have a set of cues as to which pad will be used, e.g. if you hand it at this part of the prison or with this gesture then use this pad, etc.
Bruce Schneier's solitaire cipher is designed to be operated by hand using only a deck of cards. There is also the VIC cipher actually used by a Soviet spy in the 1950s. Both are cumbersome to actually operate by hand, though it is possible.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I have a set of keys e.g (IENDKCAGI, RZRLBYBFH) and now I want to find the algorithm of it. I allready know the basics of cryptography but I don't know how to start reverse engeneering the algorithm.
I don't search a certain algorithm, I'm just interested how the process would look like.
cheers
EDIT: I don't want to crack any key!!! I buy the software I need!
I'm just interested in the approach of reengeneering a checksum from the result, thats my conceptual formulation, without knowing the algorythm. This topic is more theorethical, but in my opinion it has a certain relevancy also for stackoverflow
You can analyze it to some degree, at least enough to rule out several possibilities. You say you have a set of keys, and I'm not sure what you mean by that, so pretend for discussion that the left value is the plaintext and the right value is the encrypted equivalent.
You can determine that the left value has only one repeating character, "I", and that the right value has two, "R" and "B". From that you can rule out a simple substitution cipher, even one with characters rearranged.
Both values appear to have only characters in the range [A-Z] (a larger sample would help confirm), so you can rule out encryption techniques that yield binary results, like most block and stream ciphers. In fact, use of such a limited character set implies that it was designed for use by people rather than machines. That would imply a relatively simple cipher technique, but may also involve an additional key to which you do not have access.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
My problem is that I do not know how to change the numbering style for algorithms. I have created an algoritm and its number is "Algorithm 1", but I want to have "Algorithm N.1", where N is the number of current chapter.
Let assume I have something like below
\begin{algorithm}
\begin{algorithmic}
\FOR{$i = 1$ till end}
\STATE do something
\ENDFOR
\end{algorithmic}
\label{aForLoop}
\caption{some caption}
\end{algorithm}
Any help will appreciated.
As in the documentation:
The numbering of algorithms can be influenced by providing the name of the document component within which numbering should be recommenced. The legal values for this option are: part, chapter, section, subsection, subsubsection or nothing. The default value is nothing which causes algorithms to be numbered sequentially throughout the document.
So, I think it will be enough determining the section value, like that:
\begin{algorithm}[section]
...
Didn't test, but should work.
This question is already 8 years old and the link in the accepted answer doesn't work anymore, so I'll post an answer here for future reference. Also, it belongs on tex.stackexchange.com.
Just add the [chapter] (or [section]) to the package declaration
\usepackage[chapter]{algorithm}
and make sure to have a caption and a label in the algorithm, in that order:
\caption{The Foo Algorithm}
\label{algorithm:foo}
This page explains it quite well: https://web.archive.org/web/20100901100351/https://www.iam.ubc.ca/old_pages/newbury/tex/numbering.html
I assume this would work for algorithms as well by redefining the \thealgorithm command, in fact I read on a German forum that a user managed to disable numbering for algorithms by redefining this, so it should work.