What is the Gist of the Double-Colon “::” in Julia?

There are two different ways to use the double colon “::” in Julia. First, it can be used to check to make sure a variable is of the correct type. Secondly, it can be used to force a local variable to always (locally) be of a certain data type.

The syntax for making sure the variable is the correct type is “x::type”. If x is the same type as “type,” then x is returned. If not, a TypeError is returned. For example:

julia> (1+2)::AbstractFloat
ERROR: TypeError: in typeassert, expected AbstractFloat, got Int64

julia> (1+2)::Int
3

(Code example from “Type Declarations,” JuliaLang.org)

The syntax for forcing a local variable to (locally) always have a certain data type is “x::type = value”. Trying to make x become a value that isn’t “type” will cause an error. For example:

julia> function foo(num)
           x::Int8 = num
           x
       end
foo (generic function with 1 method)

julia> foo(100)
100

julia> typeof(ans)
Int8

julia> foo(3.5)
ERROR: InexactError: Int8(3.5)

(Code example based on code found in “Type Declarations,” JuliaLang.org, which also has an example of how to do this to force the outputs of functions to be a certain type)

.

Sources:

.

Disclaimer:

I am not a professional in this field, nor do I claim to know all of the jargon that is typically used in this field. I am not summarizing my sources; I simply read from a variety of websites until I feel like I understand enough about a topic to move on to what I actually wanted to learn. If I am inaccurate in what I say or you know a better, simpler way to explain a concept, I would be happy to hear from you :).

What is the Gist of an “IOStream” or an “I/O Stream” in Programming?

(Note: this post is based on two Java-based sources and one C++-based source. It may not be true for every program)

First, the “I” in IOStream seems to stand for “Input” and the “O” seems to stand for “Output.” So these might be thought of as “Input/Output Streams“. But what is a stream? A stream can be thought of as either the source or destination of a sequence of data or as the sequence of data itself [1,2,3]. The source/destination can be varied and the types of data can be varied [1]. “A program uses an input stream to read data from a source, one item at a time… [and] an output stream to write data to a destination, one item at time” [1]. “Once a file stream is used to open a file, any input or output operation performed on that stream is physically reflected in the file” [2]. “No matter where the data is coming from or going to and no matter what its type, the algorithms for sequentially reading and writing data are basically the same:” [3]

Source: [3]

[1]: “I/O Streams,” Oracle Java Documentation

[2]: “Input/Output,” cplusplus.com

[3]: “Overview of I/O Streams,” The JavaTM Tutorial

.

Disclaimer:

I am not a professional in this field, nor do I claim to know all of the jargon that is typically used in this field. I am not summarizing my sources; I simply read from a variety of websites until I feel like I understand enough about a topic to move on to what I actually wanted to learn. If I am inaccurate in what I say or you know a better, simpler way to explain a concept, I would be happy to hear from you :).

What is the Gist of “Directed Graphs,” “Undirected Graphs,” “Oriented Graphs,” and “Networks” (Graph Theory)?

GraphsDirected

“The edges* of graphs* may… be imbued with directedness. A normal graph in which edges are undirected is said to be undirected. Otherwise, if arrows may be placed on one or both endpoints of the edges of a graph to indicate directedness, the graph is said to be directed. A directed graph in which each edge is given a unique direction (i.e., edges may not be bidirected and point in both directions at once) is called an oriented graph. A graph or directed graph together with a function which assigns a positive real number to each edge (i.e., an oriented edge-labeled graph) is known as a network.” (“Graph,” WolframMathWorld, retrieved 6/25/2020, including the picture).

.

*What is the Gist of a “Graph” (Graph Theory)?

.

Disclaimer:

I am not a professional in this field, nor do I claim to know all of the jargon that is typically used in this field. I am not summarizing my sources; I simply read from a variety of websites until I feel like I understand enough about a topic to move on to what I actually wanted to learn. By definition, none of these posts address every aspect of a topic. If I am inaccurate in what I say or you know a better, simpler way to explain a concept, I would be happy to hear from you :).

What is the Gist of “Simple Graphs,” “Multigraphs,” and Pseudographs” (Graph Theory)?

GraphsSimple

“Graphs* come in a wide variety of different sorts**. The most common type is graphs in which at most one edge* (i.e., either one edge or no edges) may connect any two vertices*. Such graphs are called simple graphs. If multiple edges are allowed between vertices, the graph is known as a multigraph***. Vertices are usually not allowed to be self-connected, but this restriction is sometimes relaxed to allow such “graph loops.” A graph that may contain multiple edges and graph loops is called a pseudograph” (“Graph,” WolframMathWorld, retrieved 6/25/2020, including the picture).

.

*What is the Gist of a “Graph” (Graph Theory)?

**The Wikipedia page called “Graphs” contains a section describing many other types beyond those shown here (retrieved 6/25/2020).

***This is the general rule. However, according to “Multigraph,” from WolframMathWorld, there can be a lot of ambiguity in what is and isn’t required for a graph to be a multigraph.

.

Disclaimer:

I am not a professional in this field, nor do I claim to know all of the jargon that is typically used in this field. I am not summarizing my sources; I simply read from a variety of websites until I feel like I understand enough about a topic to move on to what I actually wanted to learn. By definition, none of these posts address every aspect of a topic. If I am inaccurate in what I say or you know a better, simpler way to explain a concept, I would be happy to hear from you :).

What is the Gist of a “Graph” (Graph Theory)?

“The word “graph” has (at least) two meanings in mathematics.

“In elementary mathematics, “graph” refers to a function graph or “graph of a function,” i.e., a plot.

“In a mathematician’s terminology, [especially in graph theory], a graph is a collection of points and lines connecting some (possibly empty) subsetof them. The points of a graph are most commonly known as graph vertices, but may also be called “nodes” or simply “points.” Similarly, the lines connecting the vertices of a graph are most commonly known as graph edges, but may also be called “arcs” or “lines.”” (“Graph,” WolframMathWorld, retrieved 6/25/2020)

Graphs seem to be used to show how different parts of a thing or things are connected with each other.

If interested in getting a better idea of what graphs are, a good starting point would be to read “Graph,” from WolframMathWorld, (retrieved 6/25/2020) and, after the other link, “Graph (discrete mathematics),” from Wikipedia (retrieved 6/25/2020), especially the section “Properties of graphs.”

.

*What is the Gist of a “Subset”?

.

Disclaimer:

I am not a professional in this field, nor do I claim to know all of the jargon that is typically used in this field. I am not summarizing my sources; I simply read from a variety of websites until I feel like I understand enough about a topic to move on to what I actually wanted to learn. By definition, none of these posts address every aspect of a topic. If I am inaccurate in what I say or you know a better, simpler way to explain a concept, I would be happy to hear from you :).

What is the Gist of a “Cartesian Product”?

The Cartesian product of two sets A and B… is defined to be the set of all points (a, b) where a [is in set] A and b [is in set] B.” (“Cartesian Product,” WolframMathWorld). For example, if A = {1,2,3} and B = {4,5}, A x B = {(1,4), (1,5), (2,4), (2,5), (3,4), (3,5)}

Note, the Cartesian product is sometimes called “the product set, set direct product, or cross product”(ibid). That said, the cross product usually seems to apply to vectors. How exactly the two are related is unclear to me at the moment.

Cartesian coordinates seem to be related to the Cartesian product because Euclidean Spaces,* in which you can use Cartesian coordinates, are created when having the set of real numbers do the Cartesian product with itself (ibid).

.

*What is the Gist of “Euclidean Space”?

.

Disclaimer:

I am not a professional in this field, nor do I claim to know all of the jargon that is typically used in this field. I am not summarizing my sources; I simply read from a variety of websites until I feel like I understand enough about a topic to move on to what I actually wanted to learn. By definition, none of these posts address every aspect of a topic. If I am inaccurate in what I say or you know a better, simpler way to explain a concept, I would be happy to hear from you :).

What is the Gist of the “Complement of a Set”?

“In set theory, the complement of a set A refers to elements not in A.”

If A is a subset* of a given set U, then the absolute complement of A is the set of elements that are in U but not in A. Note that U may be defined only implicitly.

If A and B are both subsets* of a given set U, then “the relative complement of A with respect to a set B, also [called] the set difference of B and A, written B \ A, is the set of elements [that are] in B but not in A.

Quotes and information taken from “Complement (set theory),” Wikipedia, retrieved 6/17/2020, emphasis added. Note that, as of retrieving this information, there are some pictures there that could be useful in understanding this.

.

*What is the Gist of a “Subset”?

.

Disclaimer:

I am not a professional in this field, nor do I claim to know all of the jargon that is typically used in this field. I am not summarizing my sources; I simply read from a variety of websites until I feel like I understand enough about a topic to move on to what I actually wanted to learn. By definition, none of these posts address every aspect of a topic. If I am inaccurate in what I say or you know a better, simpler way to explain a concept, I would be happy to hear from you :).

What is the Gist of a “Family of Sets”?

“A collection F of subsets* of a given set S is called a family of subsets of S, or a family of sets over S. More generally, a collection of any sets whatsoever is called a family of sets.

“The term “collection” is used here because, in some contexts, a family of sets may be allowed to contain repeated copies of any given member” (“Family of sets,” Wikipedia, retrieved 7/17/2020).

Note that the set S is a subset* of itself, so can be in F.

.

*What is the Gist of a “Subset”?

.

Disclaimer:

I am not a professional in this field, nor do I claim to know all of the jargon that is typically used in this field. I am not summarizing my sources; I simply read from a variety of websites until I feel like I understand enough about a topic to move on to what I actually wanted to learn. By definition, none of these posts address every aspect of a topic. If I am inaccurate in what I say or you know a better, simpler way to explain a concept, I would be happy to hear from you :).

What is the Gist of a “Subset”?

set A is a subset of a set B… [if] all elements of A are also elements of B.” (“Subset,” Wikipedia, retrieved 6/17/2020, emphasis added)

For some more terminology, here’s the complete quote if you are interested:

“In mathematics, a set A is a subset of a set B, or equivalently B is a superset of A, if A is contained in B. That is, all elements of A are also elements of BA and B may be equal; if they are unequal, then A is a proper subset of B. The relationship of one set being a subset of another is called inclusion or sometimes containment.” (Ibid.)

.

Disclaimer:

I am not a professional in this field, nor do I claim to know all of the jargon that is typically used in this field. I am not summarizing my sources; I simply read from a variety of websites until I feel like I understand enough about a topic to move on to what I actually wanted to learn. By definition, none of these posts address every aspect of a topic. If I am inaccurate in what I say or you know a better, simpler way to explain a concept, I would be happy to hear from you :).

What is the Gist of “Mapping” (Mathematics)?

Mapping… often refers to the action of applying a function to the elements of its domain. This terminology is not completely fixed, as these terms are generally not formally defined.” (“Map (mathematics),” Wikipedia, retrieved 6/15/2020)

(Using “Ctrl-f” to search for “mapping” in the article “Function (mathematics),” Wikipedia, searched 6/15/2020, was also helpful)

As a noun (a “map” or a “mapping”), the definition is more confusing. The opening paragraphs of the “Map (mathematics)” article mentioned earlier seem to have a good, if difficult to read, summary. The gist is that saying “a map” or a “mapping” can often, but not always, be considered synonymous with saying “a function.”

.

Disclaimer:

I am not a professional in this field, nor do I claim to know all of the jargon that is typically used in this field. I am not summarizing my sources; I simply read from a variety of websites until I feel like I understand enough about a topic to move on to what I actually wanted to learn. By definition, none of these posts address every aspect of a topic. If I am inaccurate in what I say or you know a better, simpler way to explain a concept, I would be happy to hear from you :).