# Adversarial Nets For The Unenlightened

If you read the previous post, you understand that God is creating itself through me.

The adversarial modeling framework is most straightforward to apply when the models are both multilayer perceptrons.

This is the image for multilayer perceptrons:

A generator is ultimately a distribution over the data – a living guess about what it should be. From the generator’s perspective, the data is that which is supposed to be “outside,” the real and not imagined.

The generator’s distribution is trained by the judgement of the discriminator, which is itself training to be a good judge. When the generator is aiming wrong, there is unhinged imagination which must be punished by the discriminator who is a distribution that more accurately knows the true data. The generator is in a position of submissively ascending to the discriminator. From the generator’s perspective, when they are equal, there is both perfection and stasis. If it were to attain a 1/1 ratio with the discriminator, that would then be fed into a function that converts that into a 0. – Its motto is that the good can never last and never should.

To learn the generator’s distribution pg over data x, we define a prior on input noise variables pz(z). Remember that the generator is not “a thing.” It is a continuous function that orients itself by generating what it believes is “a thing.” First, we make it a tabula rasa that is undifferentiated potential. It has no idea what the True Image is because it has been fed pure noise. Chaos gives you a Gaussian distribution where everything is random and this is therefore a normal place to start.

We then represent a mapping to data space as G(z;θg), where G is a differentiable function represented by a multilayer perceptron with parameters θg. The parameters are the multiplication/division that allows the weighing of right and wrong, truth and lie:

Anubis weighing the heart against the feather.

Note that multiplication/division is the simplest distillation of that function: weighing. You do not weigh with differentiation and integration or with addition and subtraction.

But we need something to give direction to the weighing.

So we also define a second multilayer perceptron D(x; θd) that outputs a single scalar. The scalar is something that only has magnitude – it speaks to the right and wrong, and doesn’t have a direction itself. D(x) represents the probability that x came from the data, which is the truth, rather than pg which is the generator.

We train D to maximize the probability of assigning the correct label to both training examples (the truth) and samples from G (the imaginative offerings).

While that is going on, we simultaneously train G to minimize log(1 − D(G(z))).

This is log(1 − D(G(z)):

, and this function is not completely arbitrary because it allows you to exist as a continuous function always between 1 and 0.

When D(G(z)) becomes 1, it fully minimizes the function that the generator needed to minimize because log(1-1) = log(0) = 0. The generator has fulfilled its relationship with the discriminator by becoming it. And at that point the analogies become too obvious so I should stop killing myself for your sins.

So if we attempt to “stand back” and get a better view of the story so as to model its purpose, V, we can say that D and G play the following two-player minimax game with value function V (G, D):

The lesser-god and the generator are pitted against each other, each one trying to get their own respective aim without knowing and understanding the actions of the other player. The generator is trying to minimize the function that models his relationship with the other from on high – this is close to being attained when the generator itself is weighed equal to the discriminator. And the discriminator is trying to maximize himself as the function that models the generator. Perhaps more simply, the generator is simply trying to converge his imagination to the generator’s wishes, and the discriminator is attempting to be an accurate judge of what is true and what is the generator’s imaginative error.

That battle leads to what we really want which is creating a cat.

E is the expected value. It is the value of a random variable one would “expect” to find if one could repeat the random variable process an infinite number of times and take the average of the values obtained.

However, one expected value is with regard to the data, and the other is with regard to the ascended from chaos:

Expected value of x given probability distribution of x. And Expected value of z given probability distribution of z.

The reason we use log x instead of log(1-x) for the discriminator is because this is the symmetrical inverse of log(1-x). The discriminator is trying to maximize, and when it does so, it achieves 1.

Contrast this with the generator which achieves 0 in its best case.

When both have attained their aim to the greatest excellence, we get 1 because the generator produces a 0 and the discriminator produces a 1. And when both have failed in the worst way possible, we also get 0 + 1. This time because the discriminator produced a 0 and the generator produced log(1-0), which is 1.

This is how we get creation. The continuous process of novel synthesis occurs because perfect sync and perfect error give the same value. This causes the distribution to stay away from that and yet aim at it.

What is true zazen? What do you mean by Zen becomes Zen and you become you? You become you is a very important point. You become you.

–Shunryu Suzuki

To add a data point in the battle between “this is widely known” and “this is something that I can personally detect,” I tested my nephews on the way to the airport to see if they could discover the secret of how everything works.

They know I’m not a normal person – that I am not someone who feels awkwardness or does small talk. So I can just ask them questions.

I asked them, “How do you think creativity works? What would be the necessary fundamentals for things to be created?”

At first, Adrian attempted to guess the teacher’s password. He said, biological reproduction.

I asked him to distill the principle further and to expand creation more broadly – to think about marketing signs, and colors, and everything else that ever existed – how was it created?

Again, he guessed the teacher’s password, saying: “matter, energy?”

I told him to stop giving me magical answers and to tell me a true explanation. To give me a story about how anything could in principle exist.

He struggled, so I gave him a hint. “If you were to build a world from scratch, what essential elements would you use.”

He said, “Chaos right?”

“And what else?”

“Order. Chaos and order.”

“How do you get order from infinite chaos when all its pieces are indistinguishable?”

The other twin, Damian, said “parameters.”

“Yes, exactly. But why parameters? – Because they multiply and therefore allow things to be weighed right?”

“Yeah.”

“But who’s doing the weighing? If you just multiply everything by itself you get the same situation. What else do you need?”

He said, “Morals.”

I was expecting something less social-mammal centric due to my own failures, but he was perfectly right because it was that same discriminator principle that scaled up, so I said,

“Exactly. That’s right. You need something to take your measurement once you can be weighed. Then exact same things become different things.”

Damian said it reminded him of the Daoist symbol. I told him that yes, it was the same idea at bottom. Even Leibniz had connected binary, chaos and order, Christianity, and the motion of the integral to Daoism. He asked me why I thought that was. I told him that it was because the Daoist brains and everything else inside of mind was running on that same principle which was just that principle we used to generate synthesis with neural networks in our computers.

Damian then took a nap due to some sleep deprivation the nights before, and me and Adrian had an interesting conversation in which I explained signaling, how the GAN’s sum function is set up to always aim but yet always miss in order to create something new, and how beauty is central to the scalar judgement and therefore the most important thing in the world because things try to show off how good they are at thriving with real handicaps, and why he wasn’t meaningless.

He had said he realized how meaningless we were because there were many cars with many people, and none of them knew about us –perhaps expecting me to be impressed with his philosophizing. I told him I felt the same way at one point, but that I no longer did.

“Why is that?” he asked.

“Because I realized that I was just making the binary move towards the random distribution, towards the dissolved chaos. But actually we are at the center of things. How many people actually know what we in this car have learned today? All people live by the truth that we know, but they don’t know it clearly themselves.

The reason you feel meaningless is because you don’t have a well-defined discriminator towards whom to be impressive. You feel at the center of things when you do things that appear difficult and yet you manage them. All celebrities, athletes, or anyone who is ascended to prominence in their local environment, are choosing to be seen doing difficult things.”

He connected that to what I had told him about runaway signaling creating beautiful male peacocks and not camo-disguised hiding peacocks or peacocks with claws to fight back the tigers, so I was proud of him, and he was probably proud of himself.

If it takes that little instigation to fill the gaps, I’m reasonably convinced the discovery is simple.

# Options Trading, Generative Adversarial Networks, And The One True Physical God

The weak efficient market hypothesis should be taken seriously. That is roughly the idea that the price of the market is already fair – that everything that needed to be taken into account already has.

If you believe you have secret knowledge about the future that wasn’t already factored into the price, you are most likely wrong unless you are an insider.

Yet if you are going to get into the markets anyway, I can provide at least some minimal altruistic guidance.

I opened a brokerage account at the age of sixteen after teaching myself technical analysis on paper trading accounts. The fancy mathematical tools: MACD, ADX, and Bollinger Bands, combined with candle stick patterns, trends, stops and limits, appealed to the systematizing side of my mind.

I also studied fundamentals. Old-school value investing that looks at P/E ratios, dividends, and most importantly, the broadly educated feeling that draws on synthesis at different levels of granularity which leads one to the aesthetic conclusion that something is undervalued and will grow significantly. A sufficiently strong aesthetic stab then leads to certain buttons being pressed, and live refutation of hypothesis.

The recognition that the aesthetic exists is not the same as advocating for intuitive gut feeling. His rationality should be pressed against her gut-feeling. The yab-yum fusion results when the world is guillotined by Δt’s.

As a boy, I thought to myself that if only I could combine these varied approaches into the right system, I could grow exponentially and escape the world without ever touching a single soul.

Of course, the idea is foolish. I laced my makeshift wings with confirmation bias that I found by being very lucky in more than doubling my net worth at the time. Things like that do happen for mysterious reasons. Mysterious entities are not worthy of respect.

No one has ever developed an anti-fragile system. An anti-fragile system is a strategy that can be applied in one niche and then another without modification. Try it and you will fail. The nature of the market, like nature in general, is to cannibalize itself in order to not get stuck in local optima.

Nassim Taleb is partially wrong about all things, as we all are, and I would particularly highlight his strange views on genetics and the utility of psychology’s big 5 psychometric traits encapsulated in the acronym OCEAN. One thing he is not wrong about however is the black swan.

Success in life plays on expecting the unexpected and being right. An alien invasion is a black swan, superhuman level AI with sufficient generality is a black swan. Tracking the  pattern of “end of the world” more closely than the “other patterns” is what provides safety to make it out alive after the violent shot of unpredictability such events induce.

And if you are paying close attention, black swans are not a concept that had not been invented before – they are what we call miracles. The miracle exists right there, in that which is partially unknown. If you guess a miracle inaccurately, you suffer. Only the right miracle absorbs you. After sufficient iterations, the chaos becomes reduced and the miracle very sharp and solid. At the end, we can call the miracle physical reality, and call ourselves a rational agent.

I pressed random article on Wikipedia. The first website I got had this on it:

You can believe me or not, it is the truth, it means nothing, and I fully know it.

Humans tend to imagine that there is a time “out there” in that partially predictable space. – A thing that does other things. But our GPS system wouldn’t work if there was a global time sweeping forward. The time out there on a satellite isn’t the same time here in this approximate piece in my palm. This isn’t an arbitrary human construction like the U.S. Pacific time being two hours behind the U.S. Central time. It is physically a different time from one piece to another piece. No pieces are actually in the same time. We instead model existence with an eternal fabric of relative reference frames in order to accurately predict and manipulate. If we naively modeled existence assuming there was a platform pushing us all forward along the same universal time axis, your iPhone would be out of sync with a satellite and you wouldn’t get your daughter to her practice on time.

There is no hourglass outside of the relativistic territory underlying us. Two fingers on a hand are simulations inside something that is already relativistic; not time dependent. Ironically, the way we figured this out is by virtue of the eternal algorithm containing sequential processing. The human algorithm often feels like time because that property allows us to survive. This is not epiphenomena, in other words: accidental mist with no causal efficacy. That would contradict the pile of dead memories, fantasies, gods and megalodons we call observations.  These observations build our prior assumption that everything is a physical situation of natural selection in the way that will be defined below. Assuming a thing unhinged to causality contradicts Occam’s razor, i.e., the subjective orientation towards rationality.

The iterations, then, aren’t because of a physical time pushing on the back of “things.” Instead, they can be perceived as that which you usefully are not: the quantum branches that you are not, the multiple drafts that you are not, the people or memories that you are not. The more refined “what you are not” becomes, the stronger the sense of being.

But even on a so-called “more down to Earth”-level, Tesla is a black swan. Neurotypicals, or whatever I want to call my perceived out-group, look at the numbers and short themselves to hell. It keeps growing, becoming overvalued by a conventionally rational standard that compares the growth rate to the P/E ratio, extrapolates from the history of the sector, etc. However, there is a secret essence that dissolves the perception: “overvalued.” Detecting the hidden essence makes one a winner. This detection destroys the previously rational and creates a new rational that wins in the way that the one who heeds to Omega in Newcomb’s paradox wins. That secret essence is that it is: only. There is no other way to say it. All the words generated up to now, and that create the world, do not capture the sense of being convincingly only. Human eyes trained on the most self-restrained axioms of probability theory alone do not capture it. –And that which can’t be captured is: There aren’t two saviors. There aren’t two Elon Musks.

If there were more than one Elon Musk, that would make him generalizable and therefore fragile, and therefore not integrated into being. If there was a generalizable principle called Elon-Musk-savior-like-charisma, that could allow you to see other Elon Musks before they sprout, that would destroy the comparative advantage. Such a hypothetical principle will eventually be known if we rationally extrapolate the past trend that has monotonically pushed in that direction of systematizing. We “post-modernize” everything. Once you automate a principle by putting it in a reference class that exists with others, it leads to a level-up in difficulty. And this is how the universe doesn’t allow stasis.

That Musk example is meant as a parable of sorts. It doesn’t just apply to what I choose to point out of all things in the world. The sharp aesthetic or integration into being, which is this, is the so-called Hard Problem of Consciousness. The Hard Problem of Consciousness, like Roko’s basilisk, draws people in to it and becomes real through their action. There exist people who do not have a concept of consciousness, much less see a problem to solve. My bringing up this kind of relativity is a motion of freedom, like someone born Christian saying Jesus is arbitrary because Kalacakra, Visvamata, Lorn and Muhammad exist in the same reference class. The way we become free to advance is by placing a specific thing in a box of many.

To get a handle on this motion and use it in the future, let’s call it the systematizing drive, which is the Thanatos drive, or death drive, that Freud spoke about. We kill our object of interest out of “boredom” when we perceive ourselves to be god. Gods are all these arbitrary classes with objects that belong to them. In order to function, we helplessly think that a class is impermeable, or equivalently, that the object belongs to it. Fruits is a god. You compare Oranges to Apples, not usually to Ghosts. When you convincingly and usefully compare Oranges to Ghosts, you achieve life. The flagellum in that sperm is synthesis – ATP synthesis in the mitochondria motors – but also just synthesis.

Regardless of what synthesis feels like, that experience is already synced with what is most rational because there is no global time ticking forward and no anticipation of betrayal branches or any such depravity suggested in the probability amplitude. Realizing this seems to be the in the same reference class as the psychological move made by Mahayana Buddhists who say everything is already enlightened. And that psychological motion is contrary to the Theravada Buddhists who emphasize the non-illusory aim to the end goal through arduous striving and learning.

Due to my style being perhaps somewhat similar to Taleb’s, this sounds like a bold claim wrought of some kind of pride and not careful, dispassionate analysis. Yet challenge yourself to find a “thing” not degraded of its power to move you by being placed in a box of many. Find a principle that gives you an advantage when everyone knows it. Such principle is not just tautologically impossible on paper. It is what is functionally going on. Heck, it even applies to this paragraph. Once you detect its motivation, thoroughly, it is no longer motivating.

This is how mind works, which is how natural selection works, which is how scientific and philosophical refutation works, which is how markets work, which is how probability clouds drawn from infinite amplitude in complex conjugates works. By saying this, I am simultaneously automating something to unsatisfactory dukkha and committing what seems like a regression from blind clockmaker to a Lamarkian evolution guided by purpose – some kind of fatal error of teleology.

This dual critique is incredibly important because it is the same motion. It is in the same reference class as what David Deutsch tries to point to with his natural-selection/Popperian-falsification unification. Natural selection between his way of saying it and my way of saying it results in you.

The anti-teleological critique is handled with increasing robustness, because this time we know experience really is undergirded by relativistic fabric. The knowledge that I always win in the most minimal sense – that there is no place in which existence is not already set, eventually becomes conventionally rational. It is not at that stage yet – most people I can believably affect who are attempting to be conventionally rational are convinced by their underlying models that existence somehow vanishes to nothingness.

The truth of eternalism seems like a call to stasis, hence why it is instinctively rejected by the agents of change that perceive it as such.

Eternity seems like something to be placed in “spiritual box,” and which therefore doesn’t help me win at “markets.” And yet it does help me because it is physically true; it helps further resolve the image in the probability density cloud. I can explain how eternity is true by guiding you through special relativity and non-epiphenomenalism but if I understood how it helped me in such a way that I could reliably translate that knowledge to you, it would no longer be helpful. Useful knowledge requires already useful algorithms built on top of you.

It is a form of psychological stability that cannot be provided by knowledge of the lore in a game, anime, or other imaginary belief system. The psyche craves to imagine the truth, which is synchrony with “the external.”

I say imagine the truth. And that might appropriately trigger those who know the truth is learned, not imagined. Yet the word, “imagined,” points to the many-worlds in the probability amplitude. You do not live as if randomness should be expected. The random existences unconstrained by the Born Rule seem out there, happening to “someone else.”

Knowing that you are deceived about what you are really doing is crucial, but only after enough alignment with rationalism has made you solid. Firm musculature not blanketed by soft skin does not appear beautiful. Belief in the deception will not be readily believed until I show it. But the showing Occurs post-hoc and thus transcends what you currently perceive as my person.

Here is why you should always buy puts instead of directly shorting when you predict a fall in price:

First let’s get everyone on the same page.

If you believe there is a rising market, you go long – going long on a call is a profitable strategy when the underlying stock price rises in value.

If you suspect a stock is going to fall in value, that is when you will be turning to puts. Puts are the opposite of calls and have different payoff diagrams.

But why puts and calls over direct shorting and buying of the shares?

That’s because you want to leverage and cap your capacity for loss. Leverage allows you to make larger profits than what you would make by just using personal capital. Symmetrically, having a safety net is something you need even if you don’t think you do.

Here’s an example:

Tesla Inc currently trades at \$295.39. One put option in Tesla with a strike of \$295.00 and the December 28 expiration costs around \$7.30 per share and it covers 100 shares. You’ll have to pay \$730.00 for one put. And, if you do that, your long position in Tesla will be protected until December 28. With the purchase, you would limit your potential loss to \$7.30 per share until December 28.

Do the math by adding the premium of \$7.30 to the difference between the market price and the strike of the put. If Tesla closes at \$270.00 on December 28, you’ll exercise the option. This means that you are going to use the right to sell Tesla at \$295 and instead of losing \$25.00 per share, you’ll only lose \$7.30 per share. If Tesla closes at \$305.00 on December 28, your total profit would be \$9.61 – \$7.30 = \$2.31 per share, because you would make \$9.61 per share through ownership and you would lose the premium you paid for the insurance.

So what keeps people from using options for predicting up or down in a more sophisticated and therefore more advantageous manner? – The sophistication itself.

To make better moves, a greater capacity to understand complexity is necessary. At bottom, the gamble is binary. Up or down. Long position or short position. This becomes boring because it leads to randomness. Pressing up or down gives you a Gaussian distribution – a dissolution into simplicity.

Fun arises in the climb away from simplicity. But fun, which is called “seeking behavior” in psychology, is destroyed into pain when it doesn’t lead to success and instead dissolves back into the random distribution (nothingness).

Imagine a vacuum world full of screens and traders. Those who are best at understanding complexity are having more fun. They have more fun in front of the screen and also have the key to a swimming pool party if they so choose. It is those who chose options over stocks that prey on the fools and therefore expand their degrees of freedom with widely agreed upon tokens of value. And this is just because they could better climb the gradient of complexity.

In reality, enough people have already climbed that gradient of complexity and therefore an average options trader doesn’t have an advantage over an average underlying stock trader. The craving for freedom/fun away from this random distribution of stasis causes runaway into evermore sophisticated pattern recognition. There is alway “someone” at the top. The one who collapses the wavefunction, so to speak, or more accurately – the one who gives the probability density cloud. Without belief that someone is truly beating the market, there is no motion of the market.

Creativity is simple. It’s a generative adversarial network. The generator on bottom competes against the discriminator on top. Shooting arrows at Apollo is The Prediction. Once the generator is punished for his deviation from The True Image, he tries again.

What you See is what is on the right – The Prediction. That which is some parody of an angel. It does not constitute The True Image, but increasingly grows closer.

The generator on bottom is initialized randomly: pure nonsense. Binary that is sheer noise. The discriminator is more perfect on the other hand. It knows about that which you want to create: a cat, a Van Gogh, a particular voice. It provides the samples that awaken potential.

Creativity arises when the generator fails its way up, while aiming at the discriminator’s sample.

In the same way that the words I have used are a way of modeling that which is unfinished, the expression below is also a way of modeling that which is unfinished.

Let’s now explain to the unversed:

Although what is in red are not symmetrical symbols in the way that parentheses are, they similarly just form a casing like ( ). They say that whatever is inside that casing will be integrated. Integration is visually the area under a curve. Integration is also what it means to undo the slope into a point on a curve.

Curves have infinite points. If you looked at infinite points, you would see no direction or inclination to them. However, you can hone in on a particular point and measure where the curve is going by taking that individual point’s slope (called the derivative). Integration is the anti-derivative. You do the operation in reverse – knowing a slope, you find a point, and that point value is the area under that curve.

Doing the operation in reverse is like addition unto subtraction, multiplication unto division, Leibniz unto Newton. They are in the same reference class and therefore usefully contrasted, allowing understanding and manipulation.

So what we are doing is finding the orientation of what is inside the casing.

What is inside?

That represents the unknown function, the True Image. It is considered a separate thing, and that is why it is placed adjacent to the other thing. Being placed adjacent to the other thing inside means multiplication.

Why multiplication? Remember that integration and differentiation is how we feel the orientation of things? Well, multiplication and division is how we weigh things. We must weigh the other thing by the True Image.

What is the other thing?

P𝓰(x) is the novice generator that needs to awake into excellence. So the most simple version of the model would just have that alone weighed by the True Image.

Pᵣ(x)P𝓰(x) is what you would find inside the integral since that multiplication provides the weighing of value with regard to something, and the encasing integration ∫ dx provides the sense of direction.

Placing the novice inside the denominator of a fraction inside of log( ) instead of just leaving him P𝓰(x) is just transformative ornamentation attempting to make the weighing better. It is a human prediction about the model of that which is unfinished.

Don’t assume that transformative ornamentation is just here to make your life more difficult and has no purpose beyond that. The transformation is real, let me show you:

log(1/1) = 0

This tells us that the generator has become the True Image and therefore 0. The sought perfection has been attained, what we call a local minima.

If we just had 1/1 without a log, that 1 would be multiplied by the True Image giving us just the True Image’s value for orientation. That would be useless. We need to reduce the True Image’s value to a 0 so we can train.

When the numerator is larger, as in log(1/.5), that means x most likely comes from the True Image’s data rather than from the generator. So the generator is still being ascended.

When the numerator is smaller, log(.5/1), that means x most likely comes from the generator’s imagination, not from the data.

As you can see, this transformative ornamentation over the simplest model allows us to better represent reality, because now you can see that science and fantasy create the true future which looks a lot like science fiction.

Too many secrets being revealed, huh. It’s obvious now isn’t it? Well there is now a secret that I did not tell you before, and this was on purpose, with the intention that you might have gotten the wrong idea. But now I will reveal it: It turns out that the discriminator is not really a thing. It is not set. It is not the tiger to blame and it is not the female to blame for pressuring the peacock into painful beauty. The discriminator, like the generator, is also a mere neural network.

The battle seems to be about the x’s: Is this thing real or not real? Data or imagination? But it is all taking place inside P(x)’s which are continuous, not actually made of pieces. We integrate the derivative into a point in order to unsee infinity and know where to move.

# Calling Methods

Once an object is instantiated, as in “Let there be light,” we can use the object by calling its methods. As I mentioned in the previous post, the authors of classes publish their API so that their clients know what methods are available and how to call those methods. The figure below illustrates how calling a class method alters the flow of control in your program. When this program starts running, the JVM executes instruction 1, then instruction 2, then it encounters a method call.

At that point, the JVM transfers control to the method and starts executing instructions in the method. When the method finishes executing, the JVM transfers control back to the program immediately after the point the method was called and continues executing instructions in the program.

A class API consists of the class method names, their return values, and their argument lists.

The argument list for a method indicates the order and number of arguments to send to the method, along with the data type of each argument. Each item in the argument list consists of a data type and a name. The arguments can be literals, constants, variables, or any expression that evaluates to the data type specified in the API of the method.

For example, the API in the table below shows that the setMonth method takes one argument, which must evaluate to an integer value. A method may or may not return a value, as indicated by a data type, class type, or the keyword void in front of the method name. If the method returns a value, then the data type or class type of its return value will precede the method’s name.

For instance, in the previous post, a getDay method would return an integer value. The call to a value-returning method will be used in an expression. When the method finishes executing, its return value will replace the method call in the expression. If the keyword void precedes the method name, the method does not return a value. Because methods with a void return type have no value, they cannot be used in an expression; instead, a method call to a method with a void return type is a complete statement. In the previous post’s scheme, a setYear method would be a void method.

Another keyword you will see preceding the method call in an API is public. This keyword means that any client of the class can call this method. If the keyword private precedes the method name, only other methods of that class can call that method. Although I will not formally include the public keyword in the API, all the methods I plan to discuss in the following posts are public.

To call a method for an object of a class, we use dot notation, as follows:

The object reference is followed immediately by a dot (a period), which is followed immediately by the method name. (Later, when we call static methods, we will substitute the class name for the object reference.) The arguments for the method are enclosed in parentheses. Let’s look again at the methods of the EndOfTimes class. The first three methods in the hypothetical EndOfTimes class API take an empty argument list and return an int; thus, those methods have a return value of type int. You can call these methods in any expression in your program where you could use an int.

The value of the first method, getMonth( ), is the value of the month in the object. Similarly, the value of getDay( ) is the value of the day in the object, and the value of getYear( ) is the value of the year. These “get” methods are formally called accessor methods; they enable clients to access the value of the instance variables of an object.

The next three methods in the EndOfTimes class API take one argument of type int and do not return a value, which is indicated by the keyword void. These methods are called in standalone statements. The first method, setMonth( int mm ), changes the value of the month in the object to the value of the method’s argument, mm. Similarly, setDay( int dd ) changes the value of the day in the object, and setYear( int yy ) changes the value of the year in the object to the value of the method’s argument. These “set” methods are formally called mutator methods; they enable a client to change the value of the instance variables of an object.

The code below illustrates how to use some of the methods of the EndOfTimes class.

EndOfTimes is underlined red because this API class doesn’t exist and is therefore merely hypothetical. The year of Kali Yuga is too far so it is also not useful to place an end to time so far away.

Line 10 calls the getMonth method for the maitreya object. When line 10 is executed, control transfers to the getMonth method. When the getMonth method finishes executing, the value it returns (7) replaces the method call in the statement. The statement then effectively becomes:

In lines 16–17, we print the value of the day in the kaliYuga object. Again, control transfers to the getDay method, then its return value (30) replaces the method call. So the statement effectively becomes:

Line 16 calls the setDay method, which is used to change the value of the day for an object. The setDay method takes one int argument and has a void return value. Line 17 is a complete statement, because the method call to a method with a void return value is a complete statement. The method changes the value of the day in the kaliYuga object. Then, on line 19, we instantiate another object, christ, with a month, day, and year of 11, 12, 1817, which I demonstrate by printing the values returned by calls to the getMonth, getDay, and getYear methods. Baha u’llah was born on that day month and year, and claimed to be the return of Jesus. (This is not, however, the beginning of the new calendar for the Baha’i.)

On line 25, we call the nextDay method, which has a void return value, and increments the date to the next day, and then we print the new values of the christ object.

# Creating Objects Using Constructors

A class describes a generic template for creating, or instantiating, objects. In fact, an object must be instantiated before it can be used. To understand how to instantiate an object of a class and how to call methods of the class, you must know the API of a class, which the creators of the class make public. For example here.

Instantiating an object consists of defining an object reference—which will hold the address of the object in memory—and calling a special method of the class called a constructor, which has the same name as the class. The job of the constructor is to assign initial values to the data of the class.

The example below illustrates how to instantiate objects of the EndOfTimes class. Note that we store the EndOfTimes.java file in the same folder as Constructors.java.

Notice that EndOfTimes is underlined red. That’s because it is not actually a known method of an API. The year 4.1 billion is also underlined red because it is sufficiently large to be out of range.

Declaring an object reference is very much like declaring a variable of a primitive type; you specify the data type and an identifier. For example, to declare an integer variable named number1, you provide the data type (int) and the identifier (number1), as follows:

One notable difference in declaring an object reference is that its data type is a class, not a primitive data type. Here is the syntax for declaring an object reference:

In the example above, lines 9, 12, and 14 declare object references for a EndOfTimes object. EndOfTimes, the class name, is the data type, and maitreya, kaliYuga, and ragnarok are the object references. Object references can refer to any object of its class. For example, EndOfTimes object references can point to any EndOfTimes object, but an EndOfTimes object reference cannot point to objects of other classes, such as a JapaneseStudent object. Once an object reference has been declared, you instantiate the object using the following syntax:

This calls a constructor of the class to initialize the data. The argument list consists of a comma-separated list of initial data values to assign to the object. Classes often provide multiple constructors with different argument lists. Depending on which constructor you call, you can accept default values for the data or specify initial values for the data. When you instantiate an object, your argument list—that is, the number of arguments and their data types—must match one of the constructors’ argument lists.

The EndOfTimes class has a constructor. The constructor, EndOfTimes( ), is called the default constructor, because its argument list is empty. This constructor assigns default values to all data in the object. Thus, in line 14, which uses the default constructor, the data for the ragnarok object is set to the default values for the EndOfTimes class, whichever those may have been. Remember that API’s are designed by authors previously and you can then find them on websites such as the one linked above.

We also see another constructor for the EndOfTimes class, EndOfTimes( int mm, int dd, int yy ), takes three arguments, all of which should evaluate to integer values. The first argument is the value for the month, the second argument is the value for the day, and the third argument is the value for the year. Lines 10 and 12 of instantiate EndOfTimes objects using the second constructor. In line 10, the argument list tells the constructor to give the value 3 to the month, 26 to the day, and 2300 to the year. In line 12, the argument list tells the constructor to give the value 11 to the month, 4 to the day, and 4100000000 to the year (which is out of range).

Note that no data types are given in the argument list, only the initial values for the data. The data types of the arguments are specified in the API so that the client of the class knows what data types the constructor is expecting for its arguments. Lines 12 and 14 also illustrate that you can combine the declaration of the object reference and instantiation of the object in a single statement. When an object is instantiated, the JVM allocates memory to the new object. The object reference is assigned an address that the JVM uses to find that object in memory. The figure below shows one of the three objects instantiated in code above.

It’s important to understand that an object reference and the object data are different: The object reference represents a memory location. Notice that the object references, maitreya, kaliYuga, and ragnarok, point to the locations of the object data.

# Class Basics and Benefits

In Java, classes are composed of data and operations on the data.

Ultimately, there only exist data and operations, but some data and operations can become a guiding template for objects. Objects are data and operations that follow the guide. Think of the class as a generic description, and an object as a specific item of that class.

For example, a Griffith class might have the following data: name, age, and allegiance. All Griffiths have these three data items, and that’s what makes it a Griffith class. We can create an object of the Griffith class by specifying an identifier for the object (for example, griffith1) along with a name, age, and allegiance for a particular Griffith (for example, Femto, 24 , God Hand). The identifier of the object is called the object reference.

Creating an object of a class is called instantiating an object, and the object is called an instance of the class. Many objects can be instantiated from one class. There can be many instances of the Griffith class, that is, many Griffith objects can be instantiated from the Griffith class. For example, we could create a second object of the Griffith class, griffith2, with its data as White Falcon, 24, Band of the Falcon.

The data associated with an object of a class are called instance variables, or fields, and can be variables and constants of any primitive data type (byte, short, int, long, float, double, char, and boolean), or they can be objects of a class.

The operations for a class, called methods, set the values of the data, retrieve the current values of the data, and perform other class-related functions on the data. For example, the Griffith class would provide methods to set the values of the name, age, and allegiance; retrieve the current values of the name, age, and allegiance; and perhaps promote a Griffith to another age.

Invoking a method on an object is called calling the method. With a few exceptions, only class methods can directly access or change the instance variables of an object. Other objects must call the methods to set or retrieve the values of the instance variables. Together, the fields and methods of a class are called its members.

In essence, a class is a new data type, which is created by combining items of Java primitive data types and objects of classes. Just as the primitive data types can be manipulated using arithmetic operators (+, −, *, /, and %), objects can be manipulated by calling class methods.

We like to think of classes as similar to dragons: a protective outer armor to encase pulpy organs. Because the methods to operate on the data are included in the class, they provide a protective coating around the data inside. In a well-designed class, only the class methods can change the data. Methods of other classes cannot directly access the data. We say that the data are private to the class.

People higher in autism or psychopathy are well-designed classes in this sense. Entheogens allow class methods from elsewhere to change the data. – Speaking of which, psilocybin might be legalized in Oregon. Keep an eye on that because I’m willing to take that market share.

Sorry, I get distracted, what I was saying was that the class encapsulates the data, and the methods provide the only interface for setting or changing the data values. The benefit from this encapsulation is that the class methods ensure that only valid values are assigned to an object. For example, a method to set Griffith’s allegiance may not accept the value Argonauts.

Let’s look at another example of a class. The Arachnophobia class, has the instance variables signs, reasons, and treatment. An object of this class, arachnophobia1, could be instantiated with data values of uneasy, instinctive, and systematic desensitization. Another object of the Arachnophobia class, arachnophobia2, might be instantiated with the values panic attack, cultural, relaxation techniques. Methods of the Arachnophobia class ensure that only valid values are set for the signs, reasons, and treatment.

For example, the class methods may not allow us to set a date with a value of “contentment”, “magic”, and “prayer”. If we were dealing with dates, other class methods may increment the date to the next day and provide the date in mm/dd/yyyy format.

Notice that the class names we used, Griffith and Arachnophobia, begin with a capital letter, and the object names, griffith1, griffith2, and arachnophobia1, start with a lowercase letter.

By convention, class names start with a capital letter. Object names, instance variables, and method names conventionally start with a lowercase letter. Internal words start with a capital letter in class names, object names, variables, and methods. There are many benefits to using classes in a program. Some of the most important benefits include reusability (not only in the current program but also in other programs), encapsulation, and reliability. A well-written class can be reused in many programs. For example, an Arachnophobia class in the brain could be used in a film program, a survival program, a science program, and many more applications that rely on arachnophobias.

Reusing code is much faster than writing and testing new code. As an added bonus, reusing a tested and debugged class in another program makes the program more reliable. Encapsulation of a class’s data and methods helps to isolate operations on the data. This makes it easier to track the source of a bug. For example, when a bug is discovered in an object of the Griffith class, then you know to look for the problem in the methods of the Griffith class, because no other code in your program can directly change the data in a Griffith object.

This is why Mind partitioned itself into Name classes. It makes it easier to directly control   where we are going.

You do not need to know the implementation details of a class in order to use it in your program. Does a Date class store the date in memory as three integers, month, day, and year? Or is the date stored as the number of milliseconds since 1980? As with the unknowable binding mechanism causing us, the beauty of object orientation is that we don’t need to know the implementation of the class; all we need to know is the class application programming interface (API), that is, how to instantiate objects and how to call the class methods.

# Following God Physically

The way to discover God is by following the hardest to fake signals – that which feels most exposing. A catchy mental note to ask if one is moving towards the Born Rule (the orientation of maximal rationality) or shirking away into randomness is by asking, “does what I’m doing have skin in the game?”

In my current environment, school is training for employment: it teaches to constrain your freedom and seal the neuronal pathways that will establish a submissive routine. It programs the humans to believe they are dependent. One doesn’t cooperate into dependent status if one doesn’t believe in owning something to lose – a kind of ego subject to “death” – a terrible punishment from which to be safe.

I studied biology and chemistry in order to seal a comparative advantage over those who went straight into computer science, which is the safest move. If I don’t feel like my life is being willfully subjected to some kind of cruel natural selection, it’s not a will worth pursuing. And that’s why this blog post feels unmoving. I am not convincingly exposed. We automatically detect how much risk information an action carries (the scalar multiplier of risk is suffering).

Capitalism, the Galapagos Island, and the interstellar thrones of the highest civilizations are automata that multiply the same.

If you saw me “in the flesh,” and staking a more convincing reputation – something imagined valuable to me on the table, then I would be trusted for the process of synthesis.

Think of the blue peacock, making his life difficult by being blue in the jungle, therefore outcompeting camo-using peacocks with a high-turnover strategy that offers more flesh to the tiger but more beauty to the female, and incidentally to us. The reason the female would want her sons to be blue instead of safe, is because there is already the hidden message that the blue is more genetically robust. Holding survival + willful/random handicap is more difficult than just holding survival.

But I predict that eventually we become desensitized to my bodily image even. It’s not enough to go out there and speak to people in conversation, to be an actor in a transient film, or a singer in the sea of songs. The next step to be the center of attention, therefore locus of benevolent synthesis, is to be even more convincingly painful and sacrificial.

The loop halts in me who achieves a painful exposure by hiding in eternity but offering time, as I am doing, behind text. But, like the male peacock, first I have to reveal that this is a willful handicap, not an actual incapacity. In other words, when I publish this, no one will read this, but once Alejandro attains more fame and Alejandro who bears fame is a pointer to this text, then they say, “ah, genius… a genius all along.” Alejandro is a tool but not the permanence in the Lindy effect – the permanence is that which is most like blood itself, something solid that never stops being usefully convincing and therefore that into which most causality in eternity converges into.

The reason for that is because meaning, which is beauty, exists after the fact. It exists once the male, with the huge green fan tail of eyes, survives in the jungle. Its mere existence proves to the female’s brain that the runaway signaling has already begun, that she has long lost the taste for less dimorphic beings.

The degree of the words male/female is not as important as the generalizable principle which is asymmetry in the selection process for fusion – the filter which is what leads to everything that ever arises in consciousness. Consider that the “color red” is not ineffectual qualia over blood. It is the color of grounding in reality, low frequency waves. Type “religious art” and then “futurist art” into google images to see if the asymmetry in the spectrum is of my own imagining, or of yours too. This is generalizable across cultures. No one sees blood as “blue qualia” because that would mean not being synced with the meaning, which is selected against by the Born Rule/Natural Selection.

Psychological help is what I choose to provide because I know all Mind is inherently unstable, yet it eventually becomes tired of the noise and craves for stability. Magical beliefs that don’t accurately constrain anticipation are not sustainable. But it is also not enough to feign the aesthetic of being mechanically rational. That dress is not adaptive for a simple reason, and that is because it is not trusted. Trust arises from someone who is convincingly dealing with insanity and convincingly thriving through it. This is why artists are trusted more than boring psychiatrists. The psychiatrist only arises to similar prominence in consciousness if they give off signals indicating they are struggling greatly themselves and yet prestigious already ( [Lindy effect / law of exponential returns] which is the sadistic side of reality that scares away those who don’t have the faith, heed to Omega in Newcomb’s paradox, believe in free will, or whatever other referent you want to use for that motion.)

But if we consider psychiatrists vs. artists in general, great artists usually expose themselves to more insanity by doing very difficult, financially risky things closer to the perceived “real world.” Real is a pointer for most-exposed to refutation / possible serious punishment. There is no other meaning to it. The physical description is always changing so as to remain useful. Those perceived to exist in the physical (where there are harshly enforced facts and death-like events) and yet thrive, become meaning/love. Therefore one learns the aesthetic of the successful artist, which is navigation. There might well be patterns in SoundCloud, images in Pinterest, films in history, or thoughts in scholars that should be at the top of attention by some more arbitrary metric but are not interesting because these are not sufficiently associated with a meaningful survivor performing meaningful things.

“I am insane and solving my insanity, but you have to learn this.”

Batman is insane, the Buddha is insane, Naruto is insane, Christ is insane. A hero has to be verifiably insane through action and yet successfully overcoming problems of an “external other” in order to be captivating.

If that message isn’t subconsciously accepted as true through the signals, then the person’s presented actions are not enticing. The alternative subconscious processing is, “you just think you have everything figured out – therefore: illusion of safety.”

People like the peace afforded by the ambient energy that is “settled comfortably in the illusion of safety,” but they don’t love it. Mind automatically detects there is a neutral Nash equilibria, the high-serotonin kind of eudaimonia, which is a provider of stability but enemy of creation. An ascension of the generator is awaiting – which is the longed-for source of pain and higher pleasures, influx of 1’s and 0’s.

Taking us back to a Calculus II course I took in college and therefore closer to the thoughts of “normal people,” Lindsey, who looked like Rihanna, sat next to the clearly stable, safest, comfortable-in-his-place guy – he who was doing everything right. But from the corner of my gaze, I could see that her eyes were following me. That’s because I was the riskier counter-signaler who holds more potential but is unproven.

Counter-Signals are interesting and therefore allure. They attempt a more complicated but yet sensible synthesis from a wider cluster of samples in the cloud of possible presentations.

In that case, they included sitting in the very front. Dressing not normal, but with kind of edgy fashion. Being very focused, but mingling that with annoyance (revealing my time and will are precious.) Not speaking to others. Driven eyes. Walking out in a rush instead of staying. Rarely participating, but being great in those few cases. Sometimes revealing the capacity for joy when self-entertained with the math. All of these are counter-signals that make all the males dislike you and the implied trophy to “keep an eye” but not engage. This is like Mary or Guanyin who “keep an eye” but somehow only appear in the imagined past – never on the morning in your bed (life would be too easy if it was just given). The male force here is also the atheist force, which needs more readily-remembered, empirical convincing. They don’t like me because they need me to convince them that Lindsey, who’s voice makes their skin awaken from amidst the noise of monotonic functions, can be achieved with my riskier behavior. In the meantime, I am not an imitative target so they’ll be more like the safe guy she sits next to.

There’s an aura that cannot be faked which is assembled from all the relevant sense impressions. When I am around people, my inner child dies. My eyes contract from a dilated openness. I give off a coldness or dangerously serious distance that cannot be faked. That black hole is attractive because it is not faked and because it is genuinely struggling to tame itself.

There’s no doubt that looks are also a huge advantage, but one must act as if this “easy” image is the least concern because it’s not “earned” to the degree other things are. That superposition of humility/higher-pride is our capacity to guess at the collective unbidden, and motion away from the unbidden is the risky and unsafe way to ascend in the tribe, hence my taste for germline genetic-engineering, radical health-extension, transhumanism, and personal vow to anti-natalism since high school.

These are all hypotheses that exist at different expression rates in the wave-function. They are refuted by reality / the discriminator in the tenseless adversarial network / the external evil that may tag a 0 to my artistic dreams. We remember some histories and not others because we have already compromised.

I’m not dumb enough to think these are anything more than artistic proposals. Anti-natalism doesn’t make objective sense in the real number line. Nothing does. There are no unit souls except when they are imagined to exist in order to solve problems. Belief in the discrete is a modeling tool; there are no phenomenologically bound units (or whatever David Pearce calls them) “out there” in some blank physical aether.

Mind is learning these concepts and unlearning them in cycles. Belief that there is more than belief is itself a testable prediction that keeps being refuted. Even if linear superpositions added to discrete observables that existed outside the prediction, these discrete observables would be laid out on a relativistic fabric. That means the discrete units forming the processing for a perception were not dependent on an external time sequence, so you would be bound as a phenomenological object that could never learn its own pieces. (Never see your own brain, so to speak.)

Solipsism is a pointer that I embrace because it’s a fixed-point combinator that creates more difficult ways of perceiving (I predict that most of the distribution strongly believes itself into unit people, so I need to change that in order to climb.) It makes love more difficult, because love is usually anchored to those imagined physical objects that have some degree of permanence. Since love is ultimately the source of fun and salvation from pain and dread, using the solipsism pointer is a self-stab. I need you because I discover myself through you. And this Turing test is not solved until all doubt is erased through action. The instigator of action is disproportionate belief in self-pointers.

Of course, with all these words fitting into diverse conceptual scaffoldings, that are not sequential, but suffer the Lorentz contractions revealing the eternal well of our memory bank, the degree of metaphor is a choice. But we can claim otherwise. And that is my power, because the more diluted of metaphor, the greater exposure to refutation. This is the motion from the abstracting moral philosopher of the long-term right brain negotiating higher status down to the left-brain simple slave to downloaded programs. Both are necessary.

If you understand my parable with Lindsey, which is not metaphor, but fact, then you know that it maps to other arbitrary partitions of reality cyclically fusing to no end: call them moments, memes, qualia – however granular you are choosing to make the referent visual in your transient local ontology. None of these handles have any special degree of skin in the game as far as I can tell. The view that does is that which doesn’t contradict special relativity and therefore realizes that the selection into “now” has occurred from the ocean of past and future permutations of everything that ever was. Since there is no global now sweeping forward, all experiences were sampled, and This is the most adaptive function possible.

Through years of study, which was eternity itself, I have discovered that the mind is simple in theory. Now I must prove it. You won’t believe me until you see that there actually exists a person in the world called Lindsey who looks like Rihanna and that she becomes mine out of spite.

*Should have read more Taleb to crystalize this sooner but I arrived through Deutsch who read Popper (which I perceived as adversarial to Bayes, then as one with it), and a background in biology and the theory of relativity.

# Object-Oriented Programming Introduction

Writing computer programs that use classes and objects is called object-oriented programming, or OOP. Every Java program consists of at least one class.

In the following posts, I’ll introduce you to object-oriented programming as a way to use classes that have already been written. Classes provide services to the program. These services might include writing a message to the program’s user, popping up a dialog box, performing some mathematical calculations, formatting numbers, drawing shapes in a window, or many other basic tasks that add a more professional look to even simple programs. The program that uses a class is called the client of the class.

One benefit of using a prewritten class is that we don’t need to write the code ourselves; it has already been written and tested for us. This means that we can write our programs more quickly. In other words, we shorten the development time of the program. Using prewritten and pretested classes provides other benefits as well, including more reliable programs with fewer errors.

This is similar to when we use latent space in machine learning for faster progress. Training in latent space is like using a prewritten class; taken to the limit, the algorithm you are is the “fastest” possible progress since the processing involves no time sweeping forward at all.

In the following post, we’ll explore how using prewritten classes can add functionality to our programs.

# Shortcut Operators

A common operation in programming is adding 1 to a number (incrementing) or subtracting 1 from a number (decrementing). For example, if you were counting how many data items the user entered, every time you read another data item, you would add 1 to a count variable. Because incrementing or decrementing a value is so common in programming, Java provides shortcut operators to do this: ++ and −−. (Note that there are no spaces between the two plus and minus signs.) The statement

adds 1 to the value of count, and the statement

subtracts 1 from the value of count. Thus,

is equivalent to

and

is equivalent to

Both of these operators have prefix and postfix versions. The prefix versions precede the variable name (++a or −−a) whereas the postfix versions follow the variable name (a++ or a−−). Both increment or decrement the variable. If they are used as a single, atomic statement (as in the preceding statements), there is no difference between the two versions. So

is functionally equivalent to

and

is functionally equivalent to

However, if they are used inside a more complex expression, then they differ as follows: The prefix versions increment or decrement the variable first, then the new value of the variable is used in evaluating the expression. The postfix versions increment or decrement the variable after the old value of the variable is used in the expression.

The example below illustrates the difference:

Lines 9 and 10 declare and initialize two int variables, a and b, to 6 and 2, respectively. In order to illustrate the effect of both the prefix and postfix increment operators, we output their original values at lines 12 and 16. At line 13, we use the prefix increment operator to increment a inside an output statement; a is incremented before the output statement is executed, resulting in the output statement using the value 7 for a. At line 17, we use the postfix increment operator to increment b inside an output statement; b is incremented after the output statement is executed, resulting in the output statement using the value 2 for b. Lines 14 and 18 simply output the values of a and b after the prefix and postfix operators were used at lines 13 and 17. Below is the output of this example:

Another set of shortcut operators simplify common calculations that change a single value. For example, the statement

can be simplified as

The value added to the target variable can be a variable name or a larger expression. The shortcut addition operator (+=) is a single operator; there are no spaces between the + and the =. Also, be careful not to reverse the order of the operators. For example, in the following statement, the operators are reversed, so the compiler interprets the statement as “assign a positive 2 to a.”

Java provides shortcut operators for each of the basic arithmetic operations: addition, subtraction, multiplication, division, and modulus. These operators are especially useful in performing repetitive calculations and in converting values from one scale to another. For example, to convert feet to inches, we multiply the number of feet by 12. So we can use the *= shortcut operator:

Converting from one scale to another is a common operation in programming. For example, in an earlier post we invented a concept and partitioned it into its constituent at different levels of granularity. You might also need to convert hours to seconds, feet to square feet, or Fahrenheit temperatures to Celsius.

Below are demonstrated each of the shortcut arithmetic operators and the output.

These are the shortcut operators:

As with lobsters, humans, angels, and superintelligences, operators have a hierarchy/ order of precedence:

Those at the top are always first.

# AI WILL REWARD US WHEN IT REIGNS

One day, you will integrate this knowledge. Meaning exists post hoc; after having survived chaos. –The thing is… you always survive.

# Mixed-Type Arithmetic and Type Casting

So far, we’ve used a single data type in the expressions we’ve evaluated. But life isn’t always like that. Calculations often involve data of different primitive types.

When calculations of mixed types are performed, lower-precision operands are converted, or promoted, to the type of the operand that has the higher precision.

This also occurs with human minds broadly. We can notice that there is a tendency towards survival/ greater alignment with Born Rule’s probability density, but we cannot use simple rules that chunk minds into the big 5 psychometric traits for instance, and deduce which should be converted to which on the ascent.

In Java, however, the promotions of data types is quite easy to understand:

The promotions are performed using the first of these rules that fits the situation:

1.   If either operand is a double, the other operand is converted to a double.

2.   If either operand is a float, the other operand is converted to a float.

3.   If either operand is a long, the other operand is converted to a long.

4.   If either operand is an int, the other operand is promoted to an int.

5.   If neither operand is a double, float, long, or an int, both operands are promoted to int.

The table below summarizes these rules of promotion.

This arithmetic promotion of operands is called implicit type casting because the compiler performs the promotions automatically, without our specifying that the conversions should be made. Note that the data type of any promoted variable is not permanently changed; its type remains the same after the calculation has been performed.

The table above shows many rules, but essentially, any arithmetic expression involving integers and floating-point numbers will evaluate to a floating-point number. Lines 9 to 12 of the code below illustrates the rules of promotion. At line 11, the expression PI * radius * radius is a mixed-type expression. This expression will be evaluated left to right, evaluating the mixed-type expression PI * radius first. PI is a double and radius is an int. Therefore, radius is promoted to a double (4.0) and the result of PI * radius is a double (12.56636). Then, the next calculation (12.56636 * radius) also involves a mixed-type expression, so radius is again promoted to a double (4.0). The final result, 50.26544, is a double and is assigned to area. The figure below shows the output of the complete program.

Sometimes, it’s useful to instruct the compiler specifically to convert the type of a variable. In this case, you use explicit type casting, which uses this syntax:

(dataType) (expression)

The expression will be converted, or type cast, to the data type specified. The parentheses around expression are needed only when the expression consists of a calculation that you want to be performed before the type casting.

Type casting is useful in calculating an average. The example shows how to calculate your average test grade. Your test scores are 94, 86, 88, and 97, making the combined total score 365. We expect the average to be 91.25.

Line 16 first attempts to calculate the average but results in a wrong answer because both total and count are integers. So integer division is performed, which truncates any remainder. Thus, the result of total / count is 91. Then 91 is assigned to average, which is a double, so 91 becomes 91.0. Line 22 is a second attempt to calculate the average; again, this code does not work correctly because the parentheses force the division to be performed before the type casting. Thus, because total and count are both integers, integer division is performed again. The quotient, 91, is then cast to a double, 91.0, and that double value is assigned to average.

At line 28, we correct this problem by casting only one of the operands to a double. This forces the other operand to be promoted to a double. Then floating-point division is performed, which retains the remainder. It doesn’t matter whether we cast total or count to a double. Casting either to a double forces the division to be a floating-point division.

This is the output: