Update
This commit is contained in:
parent
246d228d98
commit
cd6c3a313d
6 changed files with 28 additions and 16 deletions
22
algorithm.md
22
algorithm.md
|
@ -6,7 +6,7 @@ Cooking recipes are sometimes given as an example of a non-computer algorithm. T
|
||||||
|
|
||||||
Interesting fact: contrary to intuition there are problems that are mathematically proven to be unsolvable by any algorithm, see [undecidability](undecidability.md), but for most practically encountered problems we can write an algorithm (though for some problems even our best algorithms can be unusably slow).
|
Interesting fact: contrary to intuition there are problems that are mathematically proven to be unsolvable by any algorithm, see [undecidability](undecidability.md), but for most practically encountered problems we can write an algorithm (though for some problems even our best algorithms can be unusably slow).
|
||||||
|
|
||||||
Algorithms are mostly written as a **series of steps** (or instructions); these steps may be specific actions (such as adding two numbers or drawing a pixel to the screen) or **conditional jumps** to other steps ("if condition X holds then jump to step N, otherwise continue"). These jumps can be used to create **[branches](branch.md)** (in programming known as *if-then-else*) and **[loops](loop.md)** (these two constructs are known as [control structures](control_structure.md) -- they don't express an action but control where we move in the algorithm itself). All in all, **any algorithm can be written with only these three constructs**:
|
Algorithms are mostly (possibly [not always](declarative.md), depending on definitions) written as a **series of steps** (or instructions); these steps may be specific actions (such as adding two numbers or drawing a pixel to the screen) or **conditional jumps** to other steps ("if condition X holds then jump to step N, otherwise continue"). These jumps can be used to create **[branches](branch.md)** (in programming known as *if-then-else*) and **[loops](loop.md)** (these two constructs are known as [control structures](control_structure.md) -- they don't express an action but control where we move in the algorithm itself). All in all, **any algorithm can be written with only these three constructs**:
|
||||||
|
|
||||||
- **sequence**: A series of steps, one after another.
|
- **sequence**: A series of steps, one after another.
|
||||||
- **selection** (branches, *if-then-else*): Two branches (sequences of steps) preceded by a condition; the first branch is executed only if the condition holds, the second ("else") branch is executed only if the condition doesn't hold (e.g. "If user password is correct, log the user in, otherwise print out an error.").
|
- **selection** (branches, *if-then-else*): Two branches (sequences of steps) preceded by a condition; the first branch is executed only if the condition holds, the second ("else") branch is executed only if the condition doesn't hold (e.g. "If user password is correct, log the user in, otherwise print out an error.").
|
||||||
|
@ -26,8 +26,8 @@ Let's write a simple algorithm that counts the number of divisors of given numbe
|
||||||
2. Set the *divisor counter* to 0.
|
2. Set the *divisor counter* to 0.
|
||||||
3. Set *currently checked number* to 1.
|
3. Set *currently checked number* to 1.
|
||||||
4. While *currently checked number* is lower or equal than *x*:
|
4. While *currently checked number* is lower or equal than *x*:
|
||||||
a. If *currently checked number* divides *x*, increase *divisor counter* by 1.
|
- a: If *currently checked number* divides *x*, increase *divisor counter* by 1.
|
||||||
b. Increase *currently checked number*.
|
- b: Increase *currently checked number*.
|
||||||
5. Write out the *divisor counter*.
|
5. Write out the *divisor counter*.
|
||||||
6. If *divisor counter* is equal to 2, write out the number is a prime.
|
6. If *divisor counter* is equal to 2, write out the number is a prime.
|
||||||
|
|
||||||
|
@ -60,8 +60,14 @@ Notice that *x*, *divisor counter* and *currently checked number* are [variables
|
||||||
| increase divisor | |
|
| increase divisor | |
|
||||||
| count by 1 | |
|
| count by 1 | |
|
||||||
| | | |
|
| | | |
|
||||||
| V | |
|
| | | |
|
||||||
--------------<------------- |
|
| |<------------- |
|
||||||
|
| | |
|
||||||
|
| V |
|
||||||
|
| increase checked V
|
||||||
|
| number by 1 print divisor count
|
||||||
|
| | |
|
||||||
|
-------------- |
|
||||||
V no
|
V no
|
||||||
divisor count = 2 ? ------
|
divisor count = 2 ? ------
|
||||||
| |
|
| |
|
||||||
|
@ -69,7 +75,7 @@ Notice that *x*, *divisor counter* and *currently checked number* are [variables
|
||||||
V |
|
V |
|
||||||
print "number is prime" |
|
print "number is prime" |
|
||||||
| |
|
| |
|
||||||
|<---------------|
|
|<----------------
|
||||||
V
|
V
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -83,7 +89,7 @@ x = int(input("enter a number: "))
|
||||||
divisors = 0
|
divisors = 0
|
||||||
|
|
||||||
for i in range(1,x + 1):
|
for i in range(1,x + 1):
|
||||||
if x % i == 0:
|
if x % i == 0: # i divides x?
|
||||||
divisors = divisors + 1
|
divisors = divisors + 1
|
||||||
|
|
||||||
print("divisors: " + str(divisors))
|
print("divisors: " + str(divisors))
|
||||||
|
@ -104,7 +110,7 @@ int main(void)
|
||||||
scanf("%d",&x); // read a number
|
scanf("%d",&x); // read a number
|
||||||
|
|
||||||
for (int i = 1; i <= x; ++i)
|
for (int i = 1; i <= x; ++i)
|
||||||
if (x % i == 0)
|
if (x % i == 0) // i divides x?
|
||||||
divisors = divisors + 1;
|
divisors = divisors + 1;
|
||||||
|
|
||||||
printf("number of divisors: %d\n",divisors);
|
printf("number of divisors: %d\n",divisors);
|
||||||
|
|
3
audiophilia.md
Normal file
3
audiophilia.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Audiophilia
|
||||||
|
|
||||||
|
Audiophilia is a mental disease that makes one scared of low or normal quality audio.
|
|
@ -23,7 +23,7 @@ There are many terms that are very similar and are sometimes used interchangeabl
|
||||||
- **[communism](communism.md)** vs **[Marxism](marxism.md)**
|
- **[communism](communism.md)** vs **[Marxism](marxism.md)**
|
||||||
- **[computer language](computer_language.md)** vs **[programming language](programming_language.md)**
|
- **[computer language](computer_language.md)** vs **[programming language](programming_language.md)**
|
||||||
- **[computer science](compsci.md)** vs **[information technology](it.md)** vs **[informatics](informatics.md)**
|
- **[computer science](compsci.md)** vs **[information technology](it.md)** vs **[informatics](informatics.md)**
|
||||||
- **[concurrency](concurrency.md)** vs **[parallelism](parallelism.md)**
|
- **[concurrency](concurrency.md)** vs **[parallelism](parallelism.md)** vs **[quasiparallelism](quasiparallelism.md)**
|
||||||
- **[constant](constant.md)** vs **[literal](literal.md)**
|
- **[constant](constant.md)** vs **[literal](literal.md)**
|
||||||
- **[coding](coding.md)** vs **[programming](programming.md)**
|
- **[coding](coding.md)** vs **[programming](programming.md)**
|
||||||
- **[codec](codec.md)** vs **[container format](container_format.md)**
|
- **[codec](codec.md)** vs **[container format](container_format.md)**
|
||||||
|
|
|
@ -37,6 +37,7 @@ These are mainly for [C](c.md), but may be usable in other languages as well.
|
||||||
- **Mental calculation tricks**, e.g. multiplying by one less or more than a power of two is equal to multiplying by power of two and subtracting/adding once, for example *x * 7 = x * 8 - x*; the latter may be faster as a multiplication by power of two (bit shift) and addition/subtraction may be faster than single multiplication, especially on some primitive platform without hardware multiplication. However this needs to be tested on the specific platform. Smart compilers perform these optimizations automatically, but not every compiler is high level and smart.
|
- **Mental calculation tricks**, e.g. multiplying by one less or more than a power of two is equal to multiplying by power of two and subtracting/adding once, for example *x * 7 = x * 8 - x*; the latter may be faster as a multiplication by power of two (bit shift) and addition/subtraction may be faster than single multiplication, especially on some primitive platform without hardware multiplication. However this needs to be tested on the specific platform. Smart compilers perform these optimizations automatically, but not every compiler is high level and smart.
|
||||||
- **Else should be the less likely branch**, try to make if conditions so that the if branch is the one with higher probability of being executed -- this can help branch prediction.
|
- **Else should be the less likely branch**, try to make if conditions so that the if branch is the one with higher probability of being executed -- this can help branch prediction.
|
||||||
- **You can optimize critical parts of code in [assembly](assembly.md)**, i.e. manually write the assembly code that takes most of the running time of the program, with as few and as inexpensive instructions as possible (but beware, popular compilers are very smart and it's often hard to beat them). But note that such code loses [portability](portability.md)! So ALWAYS have a C (or whatever language you are using) [fallback](fallback.md) code for other platforms, use [ifdefs](ifdef.md) to switch to the fallback version on platforms running on different assembly languages.
|
- **You can optimize critical parts of code in [assembly](assembly.md)**, i.e. manually write the assembly code that takes most of the running time of the program, with as few and as inexpensive instructions as possible (but beware, popular compilers are very smart and it's often hard to beat them). But note that such code loses [portability](portability.md)! So ALWAYS have a C (or whatever language you are using) [fallback](fallback.md) code for other platforms, use [ifdefs](ifdef.md) to switch to the fallback version on platforms running on different assembly languages.
|
||||||
|
- **[Parallelism](parallelism.md) ([multithreading](multithreading.md), [compute shaders](compute_shader.md), ...) can astronomically accelerate many programs**, it is one of the most effective techniques of speeding up programs -- we can simply perform several computations at once and save a lot of time -- but there are a few notes. Firstly not all problems can be parallelized, some problem are sequential in nature, even though most problems can probably be parallelized to some degree. Secondly it is hard to do, opens the door for many new types of bugs, requires hardware support (software simulated parallelism can't work here of course) and introduces [dependencies](dependency.md); in other words it is huge [bloat](bloat.md), we don't recommend parallelization unless a very, very good reason is given. Optional use of [SIMD](simd.md) instructions can be a reasonable midway to going full parallel computation.
|
||||||
|
|
||||||
## When To Actually Optimize?
|
## When To Actually Optimize?
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Programming Language
|
# Programming Language
|
||||||
|
|
||||||
Programming language is an artificial language created so that humans can relatively easily communicate [algorithms](algorithm.md) to computers. Such language often tries to mimic human language (practically always English) but is much MUCH simpler so that a computer can actually analyze it and understand it precisely so it also partially looks like [math](math.md) expressions.
|
Programming language is an artificial [language](formal_language.md) created so that humans can relatively easily communicate [algorithms](algorithm.md) to [computers](computer.md). Such language often tries to mimic human language (practically always [English](english.md)) but is much MUCH simpler so that a computer can actually analyze it and understand it precisely so it also partially looks like [math](math.md) expressions. A programming language can be seen as a middle ground between pure machine code (very hard to handle by humans) and natural language (very hard to handle by computers).
|
||||||
|
|
||||||
For beginners: a programming language is actually much easier to learn than a foreign language, it will typically have fewer than 100 "words" to learn (out of which you'll mostly use like 10) and once you know one programming language, learning another becomes a breeze because they're all (usually) pretty similar in basic concepts. The hard part may be learning some of the concepts.
|
For beginners: a programming language is actually much easier to learn than a foreign language, it will typically have fewer than 100 "words" to learn (out of which you'll mostly use like 10) and once you know one programming language, learning another becomes a breeze because they're all (usually) pretty similar in basic concepts. The hard part may be learning some of the concepts.
|
||||||
|
|
||||||
|
|
14
soyence.md
14
soyence.md
|
@ -1,8 +1,8 @@
|
||||||
# Soyence
|
# Soyence
|
||||||
|
|
||||||
Soyence is propaganda, [politics](politics.md), [business](business.md) and [bullshit](bullshit.md) claiming to be and trying to blend with [science](science.md), nowadays promoted typically by [pseudoleftist](pseudoleft.md) [soyboys](soyboy.md). It is what the typical reddit [atheist](atheism.md) believes is science or what Neil De Grass Tyson tells you is science. Soyence calls itself science and [gatekeeps](gatekeeping.md) the term science by calling unpopular science -- such as that regarding human [race](race.md) or questioning big pharma [vaccines](vaccine.md) -- "[pseudoscience](pseudoscience.md)". Soyence itself is pseudoscience but it has the added attributes of pursuing [evil](evil.md) and trying to hide among serious science.
|
Soyence is [propaganda](propaganda.md), [politics](politics.md), [business](business.md) and [bullshit](bullshit.md) claiming to pass as [science](science.md), nowadays promoted typically by [pseudoleftist](pseudoleft.md) [soyboys](soyboy.md). It is what the typical reddit [atheist](atheism.md) believes is science or what Neil De Grass Tyson tells you science is. Soyence calls itself science and [gatekeeps](gatekeeping.md) the term science by calling unpopular science -- such as that regarding human [race](race.md) or questioning big pharma [vaccines](vaccine.md) -- "[pseudoscience](pseudoscience.md)". Soyence itself is pseudoscience but it has the added attributes of pursuing [evil](evil.md) and trying to hide among serious science.
|
||||||
|
|
||||||
Compared to good old [fun](fun.mf) pseudosciences such as [astrology](astrology.md), soyence is extra sneaky by purposefully trying to blend in with real science, i.e. within a certain truly scientific field, such as biology, there is a soyentific cancer mixed in by activists, corporations and state, that may be hard to separate for common folk and many times even for pros. This is extremely [harmful](harmful.md) as in the eyes of retarded people the neighboring legit science gives credibility to propaganda bullshit. There is a tendency to think we somehow magically live in a time that's fundamentally different from other times in history in which it is now a pretty clear and uncontroversial fact that the name of science was abused hard by propaganda, almost everyone easily accepts that historically politically constructed lies were presented as confirmed by science, but somehow people refuse to believe it could be the case nowadays. In times of Nazism there was no doubt about race being a completely scientific term and that Jews were scientifically confirmed to be the inferior race -- nowadays in times when anti Nazis have won and politics is based on denying existence of race somehow scientists start to magically find evidence that no such thing as race have ever existed -- how convenient! And just in case you wanted to check if it's actually true, you'll be labeled a racist and you won't find job ever again.
|
Compared to good old [fun](fun.mf) pseudosciences such as [astrology](astrology.md), soyence is extra sneaky by purposefully trying to blend in with real science, i.e. within a certain truly scientific field, such as biology, there is a soyentific [cancer](cancer.md) mixed in by activists, corporations and state, that may be hard to separate for common folk and many times even for pros. This is extremely [harmful](harmful.md) as in the eyes of retarded people (i.e. basically everyone) the neighboring legit science gives credibility to propaganda bullshit. There is a tendency to think we somehow magically live in a time that's fundamentally different from other times in history in which it is now a pretty clear and uncontroversial fact that the name of science was abused hard by propaganda, almost everyone easily accepts that historically politically constructed lies were presented as confirmed by science, but somehow people refuse to believe it could be the case nowadays. In times of Nazism there was no doubt about race being a completely scientific term and that Jews were scientifically confirmed to be the inferior race -- nowadays in times when anti Nazis have won and politics is based on denying existence of race somehow scientists start to magically find evidence that no such thing as race has ever existed -- how convenient! And just in case you wanted to check if it's actually true, you'll be labeled a racist and you won't find job ever again.
|
||||||
|
|
||||||
Soyence uses all the cheap tricks of politics to win stupid people, it builds on the cult of bullying religion, overuse of twisted "rationality", punishment of the correct use of rationality, building cults of personality ("science educators", the [gatekeepers](gatekeeping.md) of "science") and appealing to egoism and naivity of wannabe smartasses while at the same time not even holding up to principles of science such as genuine objectivity. A soyence kid will for example keep preaching about how everything should be proven by reproducible experiments while at the same time accepting [de facto](de_facto.md) irreproducible results, e.g. those obtained with billion dollar worth research performed at [CERN](cern.md) which can NOT be reproduced anywhere else than at CERN with thousands of top scientist putting in years of work. Such results are not reproducible in practice, they are accepted on the basis of pure faith in those presenting it, just as religious people accept the words of preachers. The kid will argue that in theory someone else can build another CERN and reproduce the results, but that won't happen in practice, it's just a purely theoretical unrealistic scenario so his version of what "science" is is really based on reproducibility that only works in a dreamed up world, this kind of reproducibility doesn't at all fulfill its original purpose of allowing others to check, confirm or refute the results of experiments. This starts to play a bigger role when for example vaccines start to get promoted by the government as "proven safe by science" (read "claimed safe by a corporation who makes money off of people being sick"), the soyence kid will gladly accept the vaccine and [fight](fight_culture.md) for their acceptance just thanks to this label, not based on any truly scientific facts but out of pure faith in self proclaimed science authorities -- here the soyentist is relying purely on faith, a concept he would like to think he hates with his soul.
|
Soyence uses all the cheap tricks of politics to win stupid people, it builds on the cult of bullying religion, overuse of twisted "rationality", punishment of the correct use of rationality, building cults of personality ("science educators", the [gatekeepers](gatekeeping.md) of "science") and appealing to egoism and naivity of wannabe smartasses while at the same time not even holding up to principles of science such as genuine objectivity. A soyence kid will for example keep preaching about how everything should be proven by reproducible experiments while at the same time accepting [de facto](de_facto.md) irreproducible results, e.g. those obtained with billion dollar worth research performed at [CERN](cern.md) which can NOT be reproduced anywhere else than at CERN with thousands of top scientist putting in years of work. Such results are not reproducible in practice, they are accepted on the basis of pure faith in those presenting it, just as religious people accept the words of preachers. The kid will argue that in theory someone else can build another CERN and reproduce the results, but that won't happen in practice, it's just a purely theoretical unrealistic scenario so his version of what "science" is is really based on reproducibility that only works in a dreamed up world, this kind of reproducibility doesn't at all fulfill its original purpose of allowing others to check, confirm or refute the results of experiments. This starts to play a bigger role when for example vaccines start to get promoted by the government as "proven safe by science" (read "claimed safe by a corporation who makes money off of people being sick"), the soyence kid will gladly accept the vaccine and [fight](fight_culture.md) for their acceptance just thanks to this label, not based on any truly scientific facts but out of pure faith in self proclaimed science authorities -- here the soyentist is relying purely on faith, a concept he would like to think he hates with his soul.
|
||||||
|
|
||||||
|
@ -14,11 +14,13 @@ Examples of soyence:
|
||||||
- "Race is a social construct and doesn't have any biological meaning."
|
- "Race is a social construct and doesn't have any biological meaning."
|
||||||
- "Women are as intelligent as men."
|
- "Women are as intelligent as men."
|
||||||
- "This extremely lucrative [Covid](covid.md) vaccine made by us in record time is absolutely safe, don't dare question it, just take it 5 times a year and pay us each time you do, don't mind any side effects." --Big Pharma
|
- "This extremely lucrative [Covid](covid.md) vaccine made by us in record time is absolutely safe, don't dare question it, just take it 5 times a year and pay us each time you do, don't mind any side effects." --Big Pharma
|
||||||
- "We can't believe this because it wasn't peer reviewed and/or it didn't pass the [null ritual](null_ritual.md) and/or it wasn't published in a journal approved by us." (--[Wikipedia](wikipedia.md))
|
- "We can't believe this because it wasn't peer reviewed and/or it didn't pass the [null ritual](null_ritual.md) and/or it wasn't published in a journal on our approved literature list." (--[Wikipedia](wikipedia.md))
|
||||||
- "This goes against SCIENTIFIC CONSENSUS therefore it's pseudoscience and conspiration theory."
|
- "This goes against SCIENTIFIC CONSENSUS therefore it's pseudoscience and conspiration theory."
|
||||||
- "This research is racist."
|
- "This research is racist.", using terms such as "scientific racism".
|
||||||
- "This research was made by a [racist](racism.md) so it is invalid, also we should [lynch](cancel_culture.md) the guy just in case."
|
- "This research was made by a [racist](racism.md) so it is invalid, also we should [lynch](cancel_culture.md) the guy just in case."
|
||||||
- Neil de grass/Morgan Freeman "documentaries"
|
- Neil de grass/Morgan Freeman "documentaries"
|
||||||
- "We can totally trust the results of commercial research."
|
- "We can totally trust the results of commercial research."
|
||||||
- "These negative results are useful but unexciting so let's not publish them, we gotta entertain our readers to stay in the market." --soyence journals
|
- "These negative results are useful but unexciting so let's not publish them, we gotta entertain our readers to stay on the market." --soyence journals
|
||||||
- "No, you can't research the details of Holocaust." (see anti [Holocaust](holocaust.md) denial laws)
|
- "No, you can't research the details of historic events such as Holocaust." (see anti [Holocaust](holocaust.md) denial laws)
|
||||||
|
- great part of [economics](economics.md)
|
||||||
|
- "[pedophilia](pedophilia.md) is a mental illness while pure [homosexuality](gay.md) is not"
|
Loading…
Reference in a new issue