Different time constants for charging and discharging of a circuit with a constant current source and a capacitor

Question: Consider a circuit that only has a constant current source and a capacitor. The voltage across a capacitor is proportional to the integral of the current I, times time. Since the current is constant it may be taken outside the integral. Based on this, the voltage across the capacitor will continue to increase as time goes by. Now let's say I turn the source on for X seconds and then turn it off. Would the time constant for the charging phase, and the time constant for the discharging phase be the same? I'm not sure if the input resistance of the source has any effect on the time constant. Thank you for any advice!
Comment: By "Turn off" do you mean shorting or disconnecting? (zero current or infinite). In either case the time will be infinite (or equal X sec) or zero. There is no meaning of time constant in these circumstances.
Answer: Here's the circuit I think you're describing:

simulate this circuit – Schematic created using CircuitLab
There's no time constant in this situation. The current source makes the capacitor voltage rise linearly. Time constants only appear when there's exponential decay.
When the current source is disconnected from the capacitor, there's no way for the capacitor to discharge. You can't just connect both ends to ground since the voltage across a capacitor is not allowed to change instantaneously in circuit theory.
Sources don't have input resistance since they have no inputs. They do have output resistance. If you include an output resistance with the current source, that will get you an exponential decay with a time constant, and the resistance will affect the time constant.
In general, it is possible to have different time constants for charging and discharging if you switch other components in or out of the circuit.


Kerberos - obtaining the krbtgt's secret in order to perform Golden Ticket attack

Question: As far as I know, in order to create a Golden Ticket, the attacker needs to obtain the krbtgt's password's hash, which is not a trivial task. My question is: is it possible to find the krbtgt's password by getting a legitimate TGT (encrypted with the krbtgt's password's hash) from the Authentication Server and cracking it, just like in a classic Kerberoasting attack?
Answer: Theoretically? Sure. It's just a brute force attack.
Practically? No, probably not. It's a brute force attack against a key derived from a randomly generated password that ends up being a hundred plus characters long in the easy case, or a randomly generated key that's 16-32 bytes long.
Comment: Thank You! All of the sources I came across did not mention that method (even in theoretical way), so I started to think that I am missing something important in the whole Kerberos mechanism.


Ubuntu hostname on lan config

Question: My host computer is Windows 7 64.  I have VirtualBox with an Ubuntu 10.04 Server x64 running as guest.  My Ubuntu Guest has an ip of 192.168.1.104.  I have openssh installed on the guest.  I can ssh into ubuntu from Windows. On my host Windows OS, I can type 192.168.1.104 into the browser, and get your standard It works! apache message. My ubuntu guest hostname is "ubuntuserver01"  When I type in "ubuntuserver01" into the browser address bar on my windows host os, it wont connect to the server on the guest.  Is this just a problem with my /etc/hostname and /etc/hosts files (and what do I need to change?) or am I missing something else?
Answer: This is because when you type "ubuntuserver01" you are asking the DNS to look for a TLD with that name, try appending ".local" (only works if you router actually does this sort of mapping).
In other words, if you want that to work you need to add a mapping on your router. Or, this isn't recommended for a simple tasks, change your DNS settings on Windows to point to another server that knows this mapping. The "other" DNS would be one you own.
The mapping would be something similar to this:

"ubuntuserver01" -> "192.168.1.104"

Please also note that when and if you do create your own DNS server, you still need to make sure the all the TLD's and other common mappings are in your new configurations along with this new one. Failing to do so will block your Windows machine to be able to resolve any website and will basically be blocked off from the internet.
Comment: I added:   192.168.1.104     ubuntuserver01.local to my hosts file on windows. Now if I type in ubuntuserver01.local into the address bar on windows, I get a connection time out instead of a server not found
Comment: Actually, I take that back.  I had a mistype.  Thanks for your help!

Ubuntu hostname on lan config


It is night and a wizard cast fireball or sunburst in a well. Should the flash be visible from outside?

Question: It is night and a wizard cast fireball or sunburst in a well. Should the flash be visible from someone far and outside of the well or, because it is a magical effect, it should be visible only directly watching it? Those spells emit a self contained effect that don't gradually diminish its intensity going far from the point of origin. Then the effect suddenly stop at the written radius. One person can see those spells but are they observable if not directly watched?
Comment: What does *directly watching* the magical effect have to do with perceiving the magical effect? I mean, *fireball* creates fairly large spread of fire. Is this question asking if bystanders that are not within a *fireball* spread can still visually perceive the spread? (I can see an argument for a *fireball* spread leaving the area surrounding it utterly *unharmed*, but what's the argument in favor of the spread being *imperceptible*, direct observation or no? Shadows are cast whether or not you're watching the light, after all.)
Comment: That is the point. Shadows are indeed cast when you are not watching the light. But is the magical flash from the fireball more intense than usual light? Because, as you said, the area around a fireball is utterly unharmed and so I can think that the magical flash around a fireball doesn't happen and you can only see the usual light intensity. If it were not like this the people near a fireball would be slightly dazzled but this not happens.
Answer: Even if you assume the light from those spells travels like normal light, no one outside the well would see it since that's how light works. They might see a circle of light on the clouds, or if it was misty or foggy they would see the column of light -- like car headlights. Garden spot-lights take advantage of that. The thing they're aimed at is just lit up and you can't see the light source at all.
Try it yourself by wrapping a flashlight with some cardboard in a room with the lights off. All you will see is the circle of light on the wall. But you'll also see a tiny sliver of light on the inside rim of your cardboard. People are taller than wells, but terrain goes up and down and wells aren't just built on low spots -- maybe someone would/could see that tiny flash of a pixel. A fireball also makes a "low roar" and unlike light, sound goes around corners, but if there are any rustling leaves or water or just wind I doubt you'd hear it from any distance.
Comment: Actually, wells **are** built on low spots whenever possible. Ground waters are pretty level so low spot means less digging. There are exceptions, of course, like a castle well that needs to be in a castle no matter the digging, or places where ground waters are flowing, but these are relatively rare
Comment: @Molot After trying the flashlight and looking up garden lights, I felt I had to look up well placement. Turns out old-time wells were dug high enough enough to avoid sewage, and even higher if the water table allows, since water is easier to carry downhill. Turns out there's isn't just a simple flat water table down there. Who knew?
Comment: @OwenReynolds: Ah, that explains [the classic nursery rhyme](https://en.wikipedia.org/wiki/Jack_and_Jill) that begins "Jack and Jill went up the hill /
To fetch a pail of water;"
Comment: @OwenReynolds anyone involved in construction knows- water tables are weird and unintuitive. I've seen a 6m cliff where the water table at the top was 600mm down but at the bottom it was 18m down. Geologists and geotechnical engineers might understand them but not the rest of us,
Answer: This works just like any normal light source
There are no general rules that define how light or sound created by area effect spells are perceptible outside of the area of the spell, neither under spellcasting, nor under Vision and Light. Thus, we must assume that light or sound created by a spell is perceptible as any other, normal light or sound, unless told otherwise in the spell description.
For example, a light spell only creates light in an area of 40 feet around its origin, just light a torch. The light of a torch  would be perceptble from far away at night if there is nothing in the way, and so would be the light of the light spell.
It is the same sitation here. There is nothing special about the light a fireball or a sunburst gives off outside of its area of effect. Neither spell states that the light is limited to the area of effect. For example, Fireball just says:

A fireball spell is an explosion of flame that detonates with a low roar [...] The explosion creates almost no pressure.

So the light would be visible like that of any other fire or explosion at the bottom of a well. Maybe, what is confusing you is the language about pressure, that aims to make it clear that there are no indirect harmful effects outside of the area of effect. It is  the special or harmful effects of the spell are limited to the area of effect. For example, Sunburst states

All creatures in the globe are blinded and take 6d6 points of damage. A creature to which sunlight is harmful or unnatural takes double damage. A successful Reflex save negates the blindness and reduces the damage by half.

These effects are limited to the area of effect ("in the globe"). A creature observing the light from a distance would not suffer damage or blindness, but it still could see the light.
If you have any light source at the bottom of a well, then the light will not be directly perceptible unless you either look into the well so you can see the source, or there are objects lit by the light that scatter it so you can perceive it from sideways.
Such objects could be outside the well itself, such as light fog, a roof above the well or similar. If you have a higher vantage point, you also will be able to see the inside of the well's wall being lit, and because the walls will scatter the light that hits it in all kinds of directions, you may be able to faintly see the light of the opening from sideways if you do not have a lower position than the opening.
Answer: I will go for yes.
It is much the same as the question "will I be able to see a laser pointer's beam"? It comes down to intensity. The laser pointer is invisible if weak; if strong, the light that gets scattered on dust particles is enough to make the beam visible form sideways.
The well is not as reflective as a laser pointer's mirror chamber, but you could argue the power of the fireball is enough to create some light. I'm not very proficient in dnd, but I think a fireball would even not be contained fully in the well.
Comment: Older Editions of D&D had rules about fireballs expanding to fill their full volume in constrained spaces. 3e and in its wake Pathfinder and later editions of D&D did away with that concept. The area of a fireball spell is always at most as large as its spell area now.


Landscape home server

Question: I have installed Landscape to manage my home computers. I have almost all the computers registered in Landscape, but I am wondering if I should also configure my own Landscape server to be managed by Landscape itself.
Answer: Yes, having Landscape manage itself works just fine!

Landscape home server


How much of my dexterity modifier can I add when wearing scale mail?

Question: In the 5th edition of Dungeons & Dragons scale mail armor has an AC of 14 + Dexterity bonus (max 2). Does this mean that I can only add 2 from my Dexterity modifier even if it is higher?
Comment: Hi there, and welcome to RPG.SE! Take the [tour]; it's a useful introduction to how we do things around here. In particular, we generally look for expert questions and answers that will stand the test of time. In order to improve the quality of this question, I'd recommend getting more specific about what research you've done on your own and where you're getting stuck.
Answer: That is exactly what it means.

If you wear medium
  armor, you add your Dexterity modifier, to a maximum
  of +2, to the base number from your armor type to
  determine your Armor Class.

PHB p.144
Answer: yes, if it says max dex bonus is +2 that means you can only add 2 extra ac from your dex, it's meant to imply the armor slows you by it being so heavy, so you cant dodge and move as easy


Should Class Structure Mirror DB Structure?

Question: Sorry if this is noobish, but I'm new to development and am teaching myself.
Let's say I've got 2 tables
BioData
Name (string)
Birthdate (datetime)
BloodType (int)
BloodTypes
BloodTypeId (int)
BloodTypeName (string)
When I pull a record, i'll use a join, so that I pull the BloodTypeName and not just ID.
Now, should my class structure mirror these tables, or am I safe to build a "Person" class with
public class Person {
  string Name;
  DateTime Birthdate;
  string BloodType;
}

If I do build class as indicated above, it seems I would have to do some funkiness when it comes to inserting records into by DB because I want to show BloodTypeName to the user, but I have to insert the relevant integer into the db.
Any insight on best practices would be appreciated.
Answer: No, it should definitely not mirror the database structure, if you have any good reason not to.
Sometimes the data classes mirror the database exactly, but that's not because they have to be the same, it's just because there is no reason to make them different. Making the classes mirror the database makes for a simpler data layer, but as soon as there is a reason to model the classes differently, you should consider if mirroring the database makes it harder to use the classes.
In this case it's clearly less efficient if you have to get the blood type name in a separate operation. You might want a blood type class in addition to the person class (for example if you want to populate a dropdown with all possible blood types), but when you fetch the data for the person object you should also fetch the blood type name.
Alternatively, you can fetch both the id and name of the blood type along with the data for the person, and create a blood type object to store in the person object:
public class BloodType {
  int Id;
  string Name;
}

public class Person {
  string Name;
  DateTime Birthdate;
  BloodType BloodType;
}

Comment: So it seems in this case, mirroring the db structure is more effective.
Comment: @andrewheins: That depends on how you are going to use the classes. If there is no reason at all to have a separate blood type class, you shouldn't create one just because the database looks that way.
Answer: I would seperate between displaying classes and data classes.
Data classes have to have any and all information present in the database to be able to change it. Now, if you want to display specific information to the user, you can write displaying classes, which just have the specific information needed. Then you simply map them - either yourself or by using a library, like automapper, I use this myself and it is quite handy, and takes a lot of workload of your shoulders.
Answer: I am assuming you are using a RDBMS system for your Database and you will use a OOP methodology for your class structure. If you stick with the core principles of those 2 methodologies you will be fine.
There is no need to mix these approaches. So => do not mirror those structures. You are fine building a Person class that way.
Answer: Hay andrew..
Yes it should mirror the DB structure,
If you still learning the thing you could start reading about LINQ Tech, which almost do the most of the work you are asking about, Hope the helped,
Regards..


Doesn't the work $W = \int F \, dx$ count only the work done by the outermost point of a spring?

Question: When we use the integral to calculate the work done by the spring force, then according to my interpretation, we are only calculating the work done by the outermost point on the spring. Why don't we sum (integrate) the work done by all the points?
Am I missing something? Help me out please.
Comment: Can you explain what you mean by the "outermost point"?
Comment: When we are integrating kxdx, we are calculating the workdone on displacement dx of the point (the point which is in the natural length position, i.e the point we begin applying force in)with force kx (x varies from 0 to x for each dx).This means we are calculating the total work by spring force of the outermost point only. But all the points in the spring are displaced. Why don't we add all the workdones by them.
Comment: Now I think I understand what you are getting at, and will submit an answer.
Comment: This question may help: https://physics.stackexchange.com/q/226279/
Comment: No offense but im asking regarding a different question.
Answer: Suppose that there is a spring fixed at one end and a force $F$ is applied to the spring.
The important thing is that force $F$ can be thought of as the "tension" in the spring and is the same throughout the spring.
Now consider the whole spring as three equal lengths.

Each length is subjected to a force $F$ at each end as shown in the diagram.
The work done on spring 1 by the forces stretching it by a small amount $\delta x$ is $F\,\delta x$.
The work done on spring 2 by the forces stretching it by $\delta x$ is $F\,2\delta x - F\,\delta x = F\,\delta x$.
The work done on spring 3 by the forces stretching it by $\delta x$ is $F\,3\delta x - F\,2\delta x = F\,\delta x$.
So the total work done in stretching the three springs is $F\,\delta x +F\,\delta x+F\,\delta x = F\,3\delta x = F\Delta x$ where $\Delta x (=3\delta x)$ is the total extension of the whole spring.
The whole spring can be cut up into as many segments as you like and then the work done extending the spring can be written as $\displaystyle \int_0^{x_{\rm final}} F\,dx$ where $x_{\rm final}$ is the final extension of the whole spring.
Comment: That's a good way to explain it without describing the spring constant. Upvote from me.
Comment: Why would part 2 strech by 2dx and part 3 strech by 3dx???
Comment: @SchwarzKugelblitz Look at elemental spring **2**.  The left end moves $\delta x$ to the right and the right end moves $2\delta x$ to the right so spring 2 is stretched by $2\delta x -\delta x = \delta x$.
Comment: How does the right side move 2dx?
Comment: @SchwarzKugelblitz Because each elemental spring is stretched by $\delta x$.
Comment: Ok,so that is the mother condition,even if that means that each individual part would strech by unequal amounts individually
Answer:
When we are integrating $(-kx)dx$, we are calculating the work done on displacement $dx$ off the point which is in the natural length position, (i.e. the point we begin applying force in) with force $kx$ ($x$ varies from $0$ to $x$ for each $dx$). This means we are calculating the total work by the spring force of the outermost point only. But all the points in the spring are displaced. Why don't we add all the work done by them?

The formula $\int(-kx)dx$ has within it the spring constant $k$, which has units of N/m. This is, of course, a linear approximation for small displacements.  The infinitesimal displacement $dx$, multiplied by the spring constant, will result in an infinitesimal amount of Work, and integration/summing of all those infinitesimals will yield a total amount of work being done over the total displacement from $0$ to $x$.
In your question, it appears you have assumed that because only the position of the end of the spring is being considered in the integration, that the rest of the spring is being ignored/not considered by the integration?
But, in fact, the spring constant $k$ includes/implicitly incorporates the force contributed by every increment of the entire spring.  Every increment of the spring must be stretched with every displacement of the spring's end.
Obviously, the spring constant $k$ will not be as large if the spring consisted of only an infinitesimally small increment of spring at the end of the spring. In other words, the spring constant has the value $k$ because of the total contribution of all the increments of force that must be overcome with each $dx$ of displacement of the end of the spring.
In other words, the concept/actuality of the spring constant $k$ includes the force applied against displacement of all the increments of the spring.
Thus, when integrating the force multiplied times each increment of displacement, the integration naturally/unavoidably includes the total force applied to displace all the spring's constituent inter-atomic bonds. Thus, the Work calculated for each increment of spring-end displacement implicitly includes the force needed to displace all of the interatomic bonds in the entire spring.  And subsequently, integration of all those increments of Work yields the total work done by displacing the spring against the force exerted by all the bonds within the spring.
Comment: So what you are saying is that the kx force itself is such ,that it includes the net force due to the displacement of each point on the spring. Thus when we integrate the force multiplied by increment dx, we are actually finding the workdone by all the points together contributing to total displacement of dx and the corresponding force is the net force they are applying. So when we start integrating from the displacement of 0 to x, we are simultaneously adding the small (total) works by all the points, as the force and dx we are considering are itself directly due to all the points?
Comment: @NightKruger Yes, that is exactly what is happening. Very good summary!
Answer:
Why don't we sum (integrate) the work done by all the points?

In essence we are doing just that. When we take the integral of $(kx)dx$ between zero (the relaxed position of the end of the spring) to $x$, the stretched position, we are macroscopically summing up the work done on the microscopic level to pull the molecules apart at each point along the length of the spring in opposition to the electrostatic forces between them.
Envision the spring being comprised of molecules connected together by microscopic springs between them. The spring constant, $k$, is the macroscopic parameter equivalent to the microscopic spring constant. The integral of $(kx)dx$ sums up all the work being done on the microscopic level in stretching the microscopic springs.

But then are summing work done on each point only for distance dx

What I mean is the sum of all work at the molecular level equals the total work at the macroscopic level, and the sum of all the intermolecular displacements, $dx_i$, add up to the final displacement, $x$ as @Farcher showed pictorially.  Or
$$\sum_{i=0}^{n}k_{i}dx_{i}=\frac{kx^2}{2}$$
Where $\sum dx_{i}$ = $x$.
Hope this helps.
Comment: But then are summing work done on each point only for distance dx.
Comment: @NightKruger Although I see you already accepted another answer, I updated my answer to respond to your comment. Hope it helps.
Comment: You all are equally responsible for my crystal clear understanding now. Thomas Lee Abshier ND made me understand theoretically. Farcher made it pictorial and You my good sir with the basic idea. I accepted Thomas's because he explained the little point I was missing clearly.
Comment: @NightKruger And that's exactly what you should do. As they say on this site, acceptance of an answer does not necessarily mean it is the best answer nor that the other answers are necessarily wrong. It means it is the answer that worked best for the person.
Comment: Hmm , this may come off as a pedantic comment, but I think you should replace $ dx_i$ with $ \Delta x_i$ because as per my understanding $\Delta x $ only becomes $x$ in the limit
Answer: The restoring force doesn't depend on the relaxed length of the spring or number of particles in it. It just depends on how far it is stretched or compressed with respect to the mean position and the spring constant.
When finding the work done (potential energy stored) we just need the force which we must apply to stop the spring from relaxing, at a certain distance and hence we just need the force at that point and the small displacement $dx$ over which it acts. Finally we integrate it all to get the total work done.
Answer: Normally in physics problems the spring is considered to be an ideal spring, with negligible mass and negligible internal energy dissipation. So although the various parts of the spring do move as it is compressed and expanded, if you to work out the $W=Fd$ work associated with all of those various individual parts of the spring, you would realize that the force $F$ associated with moving each of those parts is zero, so no work is done on those parts. You only have to concern yourself with the work done on whatever the ideal spring is pushing.
If you were to ever encounter a physics problem in which a compressed spring is, for example, embedded in some very thick medium so that there is a force associated with the movement of every element of the spring itself as it is released, then one would have to do as you suggested and figure out the $W=Fd$ work associated with every element of the spring and add them all up to get the total work.
Comment: But then that too sounds unnatural. If we consider work by all the points of the spring, then that would equal infinite!
Comment: @NightKruger - No, an infinite summation over infinitesimally small parts does not in general result in an infinite value as you will learn when you take calculus.
Comment: Yes I know that but the net work done on each point is of course not infinitesimal.
Comment: @NightKruger - You would have to work out the forces on each of the small elements of the spring and then take the limit as the elements get infinitesimally small. Again, this sort of procedure is all covered in calculus courses.
Answer: The other answers are all good, but I love this question too much to pass it up:
Let's break our spring with constant $k$ into $n$ little springs with spring constant $nk$ (shown here in ASCII):
|~$nk$~|~$nk$~|$...$|~$nk$~|~$nk$~|~$nk$~|
You can verify that the total spring constant is indeed $k$:
$$\frac 1 {\frac 1{ nk} +\ldots+\frac 1{nk} }= \frac 1 {\frac n {nk}}=k$$
since series springs are added harmonically. The surprising result is that the spring segments have a larger spring constant than the total spring.
When the total spring is stretched by $x$, each segment stretches by $x/n$.
Note that the tension in each segment is:
$$ T = (nk)(x/n) = kx $$
as it must be. Moreover, each segment has done work:
$$\Delta W = \frac 1 2 (nk)\big(\frac x n\big)^2 = \frac 1 2 \frac {kx^2} n$$
so obviously:
$$W = n\times\Delta W = \frac 1 2 kx^2 $$
In the limit $n\rightarrow \infty$ you can see that the energy is uniformly distributed along the length of the spring.
Comment: But isn't the work supposed to be 1/2 of what you mentioned?
Comment: @NightKruger not anymore.
Comment: +1 - I'm puzzled about the downvote! This is a good understanding of how springs operate!. If you cut the spring in half, you double the spring constant. The grand constant is the integral of the little contributions of each coil.
Comment: @BillN well I had dropped a factor of 2 for while, but it's there now.
Comment: Wow! Missing a factor of two certainly isn't worth a downvote, IMO. That's easily handled in a comment. Downvotes should be used to signal off-topic answers or poor physics, not some numerical factor that's easily missed. Oh, well ...
Answer: We're calculating the work done by the spring on some external point which isn't part of the spring. When you calculate the work done on some part of the spring, you're calculating how this contributes to the total kinetic energy of the spring itself.
Answer: The short answer to the question in the title is, "Yes, but the work done by that part of the spring on what?". In particular, if the integral is positive, that means energy was transferred 'to' an object, negative means 'from.' What you're asking is the same as asking, "Where did that energy come from before it got to the end of the spring?" As you correctly intuited, that energy gets stored all along the entire spring, but it is in a more advanced class on elastic media you'll learn how to handle that.
In the mean time, if you want to think about it on your own, explore the topic of using multiple springs to build a single "spring." For example, "If I connect two springs with constant $k$ end to end, what is the constant $k_{\mathrm{effective}}$ of the combination?" or the same question if I connect two springs side by side.


How do I make a bomb sight accurately?

Question: On the Bombsight Wikipedia page, I get that equation. I do not understand it very well. How would I go about writing that in C#? The drag doesn't matter in my project. It's not a flight sim. I know that the angle of the camera/sight is a non linear function of the speed and altitude of the aircraft. Any pointers would be greatly appreciated.
Was this the correct stack to post this question in, or was the physics stack a better option?
Comment: I've posted a translation as requested, however I want to restate that without context, it's not clear if this helpful to your larger goal. The formulas on Wikipedia represent the physics of reality. If your project is modelling those aspects of reality, it make sense to consider them, but if your project doesn't, then they won't make sense. If your drag is zero, then these formulas reduce to zero & there's no point in calculating them. It might be more helpful to directly state the problem you are trying to solve with these formulas.
Comment: As stated in the article, those formulas are for computing the vertical and horizontal components of the drag. Why are you converting drag calculations to C# if you're not taking drag into account?
Comment: @Pikalek I thought that only certain parts of the equation were dealing with drag. Not the whole thing. Thank you for clearing that up. Would you have an idea of where I can find a C# equation for that or how I could write the equation myself?
Comment: @Pikalek sorry for such a late reply. I'm trying to write a script that angles a camera based on velocity and altitude to make a device that makes dropping payloads easier. Like a bomb sight. The only problem is that I don't know what equation to use with the altitude and velocity values so I can get an accurate angle value. And no. There will be no drag in my project.
Comment: In that case you should edit your question to include information about what you *are* modelling in your game. Is the terrain flat or does it have varied elevation? Does it curve like the earth? Like drag, there's a lot of factors that *could* come into play, but we need to know more about the situation. It might also help to know, what happens right now if you simply sight straight down from the plane? Even if that doesn't produce the desired result, it gives a starting point.
Answer: The formulas given for vertical & horizontal drag are:
\$
d_v = CAρv_v\sqrt{v^2_v+v^2_h} \\
d_h = CAρv_h\sqrt{v^2_v+v^2_h}
\$
where:

\$v_v\$ is the vertical component of the velocity
\$v_h\$ is the horizontal component of the velocity
\$C\$ is the coefficient of drag
\$A\$ is the cross-sectional area (of the bomb)
\$ρ\$ is the air density

Converting that to code, would give you something like this:
double speed = Math.sqrt(velocityVert * velocityVert  + velocityHrzt * velocityHrzt);
double dragVert = dragCoeff * area * airDensity * velocityVert * speed;
double dragHrzt = dragCoeff * area * airDensity * velocityHrzt * speed;

If your code base is already using vectors, you can replace the drag & velocity variables with vectors components.

How do I make a bomb sight accurately?


how to buy and send an itunes card as a gift?

Question: How do I gift an iTunes card to my friend in Ghana? I do not want one for myself. I have never heard or used one.
Answer: You can either buy one in a commercial center and ship it or send one directly by mail.
Concerning the second option, all you have to do is to scroll to the bottom of the Apps category of your iPhone App Store application and tap Send a Gift.
Answer:
Go to your local store
Look for an iTunes Gift Card
Purchase it
Ship it
Wait for a thank you letter

Source: Common Sense

Or you can follow this tutorial to send e-gifts
For more information: https://www.apple.com/shop/gift-cards


Importing GPG Key

Question: I am trying to import a GPG key to verify a download. The Key ID is 4203454C. Let me know if you need any more information. What is the process for GPG when you are trying to import a key by ID or by fingerprint?
Answer: To import the key use gpg2 --recv-keys and then KeyID or Better yet the longer more unique key fingerprint.
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 4203454C

gpg: requesting key 4203454C from hkp server pool.sks-keyservers.net
gpg: key 4203454C: public key "Michael Büsch (Git tag signing key)    <firstname.lastname@example.com>" imported

Warning KeyIDs can have collisions so an attacker might be able to generate another key with a duplicate KeyID.  The fingerprint is longer and much more resistant to collisions.
KeyID:                                       4203454C
Fingerprint: 757FAB7CED1814AE15B4836E5FB027474203454C

P.S. This works the same with gpg as well as the newer gpg2
Answer: It sounds like you're trying to lookup the key from a directory service or key server. You should follow the instructions for the software you're using to manage keys.
For example, for Kleopatra on Windows, you would do Ctrl + Shift + I to bring up the Certificate Lookup dialog, prepend "0x" to your key, and search for it.
There are other ways to do it - some keyservers let you search directly using a web interface. You can then copy + paste the key into a local certificate file to be imported - the steps depend on what you're using for key management.
Comment: this problem has since become irrelevant to me - but i am still interested in the how it works - i am using linux

Importing GPG Key


My team has to build an app that requires a Facebook auth to enter a sweepstakes. At what stage should the authorization happen?

Question: Would it be better to require this authorization when the user first lands, or let them play the app first and only prompt them once they try to enter the sweepstakes?
Comment: Don't bother them until the very last moment when you absolutely have to...
Answer: I'm not sure I understand your question, but this seems slightly similar to the $300 Million Dollar Button issue to me:

The designers fixed the problem simply. They took away the Register
  button. In its place, they put a Continue button with a simple
  message: "You do not need to create an account to make purchases on
  our site. Simply click Continue to proceed to checkout. To make your
  future purchases even faster, you can create an account during
  checkout."
The results: The number of customers purchasing went up by 45%. The
  extra purchases resulted in an extra $15 million the first month. For
  the first year, the site saw an additional $300,000,000.

Basically, don't get in the way of the user experience until/unless it is absolutely necessary.
Comment: This is a different problem, the $300M was an ecommerce website where people can buy multiple things and spend time choosing which item to buy, in this question, the user just needs to enter the sweepstake. End of it, there is no choice.
Comment: True, but I think the general idea of not bothering the user unless it is necessary stands. The two choices are, A) stop users from using the app until they sign up, or B) Let them use the app, and if they choose to enter the sweepstakes, let them do so. Similar to A) Stop users from buying products until they sign up or B) Let users buy things, and if they choose to sign up, let them.
Answer: If the app does something besides the sweepstakes, it might make sense to require authorization at the moment they want to enter sweepstakes. This way your users will first make a connection (a bond) with your website and then authorizing your app with facebook will be perceived as a less of a barrier ('I know something about the app, therefore I trust it more').
Another option is to let your users enter the sweepstakes, but ask for authorization to see the results (at the very last step). This way you might get even more users authorizing: they already did what they wanted to do (entered sweepstakes) and results are there (or a user thinks they are), so the only little thing left to see the results is authorize with Facebook (which is free and requires little effort). It is psychologically much easier to continue an action you already started (or nearly finished) even if there are slight obstacles like authorization, than to start a new action that requires going through the obstacles first.
It is also important to describe to your users what happens after facebook authorization, so they won't expect anything that is not going to happen. Don't request any permissions that are not necessary, because it might lower the amount of people who actually go through the authorization process. For example, if your app isn't going to post to the timeline, don't ask for permissions to post.


What is the real age of Roy Batty in the film?

Question: For example: his hair is grey but, what I get from the whole movie, is that he is actually much younger than he appears to be. Does he have the same sickness as J.F. Sebastian?
Comment: I suppose it's subjective but his hair is white not gray and [it's a style](https://www.google.com/search?q=future+white+hair&tbm=isch). As some other examples [Storm from X-Men](https://www.google.com/search?tbm=isch&q=storm+x-men). It's not meant to indicate age. It's meant to indicate "different", "future", "not human", etc...
Comment: Thematically, yes. Dramatically, no.
Comment: hi @AndresF. - sure, "replicant" is a better word than "robot" for the type of beings in the film. Good one. The point is: the question has been fully explained.  In no sense at all does Batty have "old guy" hair.  He just has hip bleached white hair - like, you know, Justin Bieber or whoever  :)
Comment: Don't forget, he's a **robot, not a human**.  They only exist for four years, then stop functioning.  They are "made" a certain way and that's how they look for the whole four years.
Comment: @Fattie A nitpick: replicants are not robots. They are organic and alive, and nobody (certainly not their creators, like Tyrell) dispute this. But yes, Roy Batty's hair is stylistically bleached white, and does not indicate age.
Answer: Roy Batty was an artificial genetically-engineered being (as explained in the opening text), and these artificial beings (replicants) had been engineered to have a four year lifespan in order to prevent them from having time to develop too many of their own "emotional responses". He was approaching the end of that life (as were his companions), which is why he had come to Earth to talk to Tyrell. And given that we actually see him die without any apparent injury at the end of the film, we can presume he was just slightly under four years old when we first saw him. From the transcript here:

Deckard: [funny look]. [pause] What's this?
Bryant: Nexus 6. Roy Batty. Incept date 2016. Combat model. Optimum self-sufficiency. Probably the leader. This is Zhora. She's trained for an off-world kick-murder squad. Talk about beauty and the beast, she's both. The fourth skin job is Pris. A basic pleasure model. The standard item for military clubs in the outer colonies. They were designed to copy human beings in every way except their emotions. The designers reckoned that after a few years they might develop their own emotional responses. You know, hate, love, fear, anger, envy. So they built in a fail-safe device.
Deckard: Which is what?
Bryant: Four year life span.

The fact that Batty came to Earth to try to have the Tyrell Corporation extend his life span was indicated by his dialogue with Tyrell:

Tyrell: I'm surprised you didn't come here sooner.
Roy: It's not an easy thing to meet your maker.
Tyrell: And what can he do for you?
Roy: Can the maker repair what he makes.
Tyrell: Would you like to be modified?
Roy: Stay here. -- I had in mind something a little more radical.
Tyrell: What-- What seems to be the problem?
Roy: Death.
Tyrell: Death. Well, I'm afraid that's a little out of my jurisdiction, you--
Roy: I want more life, fucker.

@Mr Lister points out that his "incept date" (when he was created) was actually given in the movie as 8 January 2016, as seen in an image from this article:

The opening text indicated the film was set in November 2019 so he would have been about 3 years 10 months old.
On the other hand, J.F. Sebastian was a human who had a fictional disease called "Methuselah's syndrome" that caused him to age prematurely. They put the actor in subtle wrinkly makeup to indicate this, which the actor playing Roy Batty didn't have, so however they engineered the replicants to have four-year life spans, it presumably wasn't by giving them Methuselah's syndrome. From the transcript:

Pris: Thanks. -- How old are you?
Sebastian: Twenty-five.
Pris: What's your problem?
Sebastian: Methuselah's syndrome.
Pris: What's that?
Sebastian: My glands. They grow old too fast.
Pris: Is that why you're still on earth?
Sebastian: Yeah, I couldn't pass the medical. Anyway, I kind of like it here.

You can see the wrinkling around the eyes in this shot (click to enlarge):
Comment: I was fortunate enough to work with "J.F. Sebastian" (Mr Bill Sanderson) on a film shoot - he's really wonderful and an amazing actor.
Answer: According to IMDB, Blade Runner is set in 2019, and Roy Batty's bio says his incept date was 8 January 2016. So... the answer is three.
About his hair colour, that's just the way he was designed. Maybe his appearance was based on a real person (just like his implanted memories), but that's just a guess.


How safe are Tor users?

Question: Given that Silk Road was just shut down, an article was published stating that:

Tor Can't Always Keep You Safe; Just Ask Silk Road ... careful traffic monitoring and a little math you can figure out who connects to what on Tor. - Reference

Another article - nearly a month older, claims something similar:

Not Even Tor Is Safe From The NSA's Prying Eyes ... The problem boils down to this – around 90% of Tor users are still using older software which can be hacked. The good news is that the latest version of Tor, version 2.4, isn't believed to be 'crackable' by the NSA, as it uses something called elliptical curve Diffie-Hellman ciphers that are thought to be beyond its capabilities at the moment. - Reference

Additionally, another states:

Tor still helps here: you can target individuals with browser exploits, but if you attack too many users, somebody's going to notice. So even if the NSA aims to surveil everyone, everywhere, they have to be a lot more selective about which Tor users they spy on. - Reference

Are the articles referenced above true in their claims?

What I can gather from this is that safety boils down to the habits of a user themselves. Are they using https, what information are they sharing online, what associations are being made.. etc. Related.

Assuming all safety precautions are taken into consideration by the
user, how safe are Tor users - regarding anonymity?
Does Tor still present a threat to the NSA?
Comment: Maybe also check out http://tor.stackexchange.com/q/298/58.
Answer: "Does Tor still present a threat to the NSA?"
I believe that Tor was never threat to the NSA. There are several layers of 'protection' about Tor, thus several ways to attack users.

The first layer is: software code. NSA software developers can misuse open code to find holes and bugs in the code. We can surely make the presumption that the NSA doesn't have any problems to employ the best programmers to do the task. Inside of this first layer are also developers of Tor software. They don't hide; they educate the FBI, and they don't hide that they are financed by government entities, but say that they are independent in their work, no matter who finances them. I would add (layer 2): if Microsoft reported bugs to the NSA before they made patch/update, why do you think Tor developers didn't do the same? Remember the story about the Freedom Hosting server, and the fast Tor browser bundle update after the system administrator was arrested. FBI hacked the Firefox browser (or they got bug information from Tor developers) and snitched all users of the Freedom Hosting server. It means even users who just use anonymous tormail (that's not against the law).
Beside software, Firefox bugs are layer number 2.
The third layer is: servers, so-called Tor nodes. Even if software and Firefox are perfect, Tor nodes can spy on users. Besides intruding spies in such organizations who operate Tor nodes, stronger servers gather more traffic and it helps the FBI analyze traffic. Make a website to sell drugs/guns and collect thousands of users, and you will get a lot of traffic. So they will catch you fast.

4) The fourth layer is the PC. Microsoft, updates, antivirus software, all of them gather information from your personal computer and send it to different servers/companies. There are antivirus software that gather your links in the browser and send it for analysis to the producing company. Stupid example: When I want to visit movie servers, many sites are blocked as dangerous by Sophos antivirus software, so, corporations collaborate between themselves, and they can get information that I visit this or that website, together with my Mac and IP address. They can do the same when I use Tor software. So, if they want, they can hunt people on the basis of websites we visit.
Besides this, your PC can even have an installed keylogger or some more complicated spying software produced for the NSA, and the NSA makes a deal with antivirus companies to avoid detection by antivirus software.
I am not a professional, but I think users can protect themselves from developers and NSA with installing more and more private bridges and connect to them directly, to avoid public bridges and Tor nodes, But many people don't have money for that and they must rely on developers of the Tor network (who publicly cooperate with the US government).
So, many Tor users are exposed, if they use a website or they administer a website which is hunted by the NSA. And, yes, they can be arrested if the NSA really wants to arrest them. It depends on how much you come to their attention, and how important it is for them to hunt you.
Do you think people employed in data centers will refuse cooperation with the NSA? NSA can spy on every Tor node, with physical access to the server operating as a Tor node. When they attach a device for forensics to the server, or they install what they want in the server, they can spy without asking anything of the system administrator or owner of the server. And who knows how many nodes are even inside of U.S. Servers are the cheapest there, and many people will buy a server in the U.S. and many use Amazon S3 instances/servers to make Tor relays (Amazon, PayPal, and Visa/Mastercard. All of them are the right hand of NSA; just remember who sabotaged WikiLeaks).
Answer: That's a tough one.  Anyway, here goes my personal take on this story:
We don't have any extra sources --- all we can do is read The Guardian's article or the one published by the Washington Post, like everybody else.
Even though we have no way to be certain whether the documents referenced in the article are, indeed, genuine, I still highly recommend you read the articles and their referenced documents for yourself.
Assuming they are genuine and not a marvelous piece of misinformation, it seems that Tor does provide anonymity.  The Guardian quoted from one of the presentations: We will never be able to de-anonymize all Tor users all the time.  Another document labels Tor as "the King of high-secure, low-latency Internet Anonymity", with "no contenders for the throne in waiting".  Warm, fuzzy feeling all around. :)
It's also interesting to see that the best attacks mentioned in the presentations seem to attack the Browser behind Tor, and not Tor directly.  And that using the Tor Browser Bundle seems to provide better anonymity than using your own combination of browser with just a bare Tor client.
Comment: The short answer is that they're a lot safer than those who don't use Tor :)
Comment: See posts to the Tor blog with the "nsa" tag: https://blog.torproject.org/category/tags/nsa.
Answer: I defer to Peter Palfrader's aka weasel's excellent answer to the main question, "How safe are Tor users?".
Reading the closing sub-question, "Does Tor still present a threat to the NSA?", I'm wondering whether OP meant to say "Does the NSA still present a threat to Tor users?". The answer for that question is "of course".
Regarding Tor as a threat to the NSA, it's arguable that everything is a threat to the NSA ;) If we take "King of high-secure, low-latency Internet anonymity" at face value, it's arguable that the NSA sees Tor as a credible threat. That's because the NSA apparently sees its mission as intercepting and querying all global communication, on all channels.
There's something ironic about this. I get from Bamford's books that Navy intelligence was initially the major contributor to the NSA, and that the Air Force played catchup through at least the early 1960s. And of course, it was the Navy that initially funded Tor development.
Anyway, perhaps the NSA is rather ambivalent about Tor. But there are others who might comment knowledgeably on that point ;)
Comment: The NSA's dual mission was originally to protect "our" codes and break "their" (foreign) codes. Now that everyone uses the same "codes"...
Comment: FYI, see [A psychological history of the NSA](http://www.dailydot.com/politics/nsa-korea-vietnam-snowden-history/) by Joe Kloc (2013-10-18) featuring quotes from Glenn Greenwald's interview with Edward Snowden ([video](http://www.youtube.com/watch?v=kaRvzQ887HM) and [transcript](http://www.policymic.com/articles/47355/edward-snowden-interview-transcript-full-text-read-the-guardian-s-entire-interview-with-the-man-who-leaked-prism)). Joe Kloc: "To Snowden, the lesson was simple: Somewhere in its six-decade history, the agency had spun out of control. The question is, how did it all go wrong?".
Answer: To add to what's been said, particularly parts of bobrock's answer, remember that anyone can run a Tor exit node. After traffic has been decrypted on the exit node (as the last stage of onion routing), the data to be forwarded can be seen in the clear (assuming there's no more encryption besides Tor). The NSA can set up a large number of exit nodes, and catch a lot of people, but never all of them, because it is impossible for anyone to control the entire Tor network. I've been wondering lately how good a solution it is to simply use a secure VPN from a provider you know can never give up logs to anyone.
As far as commandeering software to spy on end users, I think open source is a reasonable deterrent to that. The NSA may be able to hire great programmers to review code and find 0-day exploits, but that happens all the time anyway among hackers. Most private information that would be sent by anti-virus software and windows could be blocked by something like PeerGuardian, and if you wanted to invest the time and effort, you could try running Snort and developing your own rules for it.

How safe are Tor users?


Built difference amplifier "tail" vs. SPICE models

Question: I am working on a difference amplifier example lab 5L.1 from Art Of Electronics Hands on Lab Course (I am not a student). I simulated three types of "tail" circuits using SPICE. Then I built the three types of "tail" circuits using MMPQ3904 array for the Q1 and Q2 pair and discretes 2N3904 for the mirror and sink circuits. I see basically the same clean output in physical circuits for ALL 3 scenarios (no common mode noise on the output). However, in SPICE, as I assume is more correct, I see the "long tail" circuit with common mode signal on top of the output. The sink and mirror are clean in SPICE. I thought the physical implementation of the "long tail" would show at least some noise as well. Is that a correct assumption?
Comment: Reading your writing, it appears that you are confusing the idea of noise with the idea of common mode rejection and interpreting your LTspice results on the basis of that confusion. Worse, you haven't even prepared a proper circuit for illustrating common mode rejection (or noise analysis.) So that's also a problem. So (1) you need to prepare better schematics for analysis; and (2) you need some help understanding the long tailed pair, better; and (3) you probably need some thoughts about what you are actually building and testing, too. Can you pick just one thing you'd like explained first?
Comment: Sorry all, for using wrong terms. I meant the output vo2 distortion due to CM input given by V5 source. CM signal  is V5 = 1KHz, 1V. with 10 mSec delay; diff. signal is V6 = 100Hz, 0.2V created with center -tapped transformer in the built ckt. In SPICE v02 looks clean for 10mSec before V5 was added. After 10mSec there is 1KHz riding on the top of the amplified 100Hz  output. Is that correct? I was expecting to see the same in my built circuit, since the "long tail" CMMR is worse then  that of the sink and mirror.
Comment: Please, let me know what is the correct setup to show CMMR? What i have i got from the AoE book.
Comment: Does the AofE use 27 Ohm resistors at both bases in the lab course? Also, are you aware of the problems related to the Early Effect exacerbated by tying one collector directly to the positive rail? Also, you will have significant CM variation of your output voltage because of \$R_3\$'s current sink variation directly due to the CM changes. And you will have consequent variation of the voltage gain, as well.
Comment: The AofE example uses emitter degeneration resistors so that you get a predictable gain despite the fact that your two BJTs are discrete and likely have some differences in behavior. I'd want to drop about twice the voltage across the emitter resistors, though, so I'd double their values to 180 or 220. I'd also add a collector resistor of equal value where you have none. In building one discretely. Then, I think you'd get similar results from something you build to what LTspice provides in simulation. Much closer, at least.
Comment: Finally, if you want to see your output voltage vary far less with CM changes, you'll need to replace \$R_3\$ with a better current sink circuit. A two BJT circuit described [here](https://electronics.stackexchange.com/a/481317/38098) would be a LOT BETTER.
Comment: well, they show 27ohm for the setup with floating generator for diff. signals. So, i think, i have it correct in SPICE. Now, in the built ckt, my transformer has 2 secondaries, in which i grounded one side of each. And then ran CM signal via 27ohm. Maybe that was wrong.  Did not look at Early effect, but i did question why one collector was not connected to the supply via a resistor. So, is SPICE output correct with that setup? I just received a true center tapped xformer and will try that w/o 27 ohm resistors.
Comment: Thanks, I'll try modifying the ckt. I did use the current mirror and sink ckts, but my goal was to see how "bad" just using the R3 is and how it matches SPICE.
Comment: Okay. Well, I think one of the better ways to learn things is to first work things out "in theory" and "on paper." No spice program. No building. Just theory only. Then, make quantitative predictions. Then go put it into spice and see how close you were. If that doesn't work out, improve your theory knowledge and repeat. If it works out good, then go build it and see. Do you have any theory-predicted estimates, at all?
Comment: Ok, so let's assume "long tail" ckt.  CM input signal at 1KHz @ 1V. My diff. gain signal is 100 HZ @ .2V. CM gain is about 0.5. Diff Gain is about 40. So, in theory i should expect to see sum of output of 40*.2V = 8V @ 100Hz and CM signal of 0.5*1V= 0.5V@1KHz. That is, I expect to see 8V sine wave at 100HZ with 1KHz riding on top of it. Is that correct?
Comment: I've added an answer of sorts. At least, it should jerk your mind around a little. It's not an answer because I don't think you've got a clear question, just yet. Read on and perhaps you'll see why I think so. Of course, I can be wrong. So who knows? Perhaps you'll square me around to things.
Answer: Starting Point
Here's the basic idea, with some added parasitics worth a moment's thought:

simulate this circuit – Schematic created using CircuitLab
Above, I added the other collector resistor. The reason I did is because of \$r_{o_{_1}}\$ (Early Effect parasitic.) Without the added voltage drop across \$R_{C_{_1}}\$ there's a larger voltage drop across \$r_{o_{_1}}\$ and this leads to an unexpected increase in \$Q_1\$'s collector current that isn't matched in \$Q_2\$ under the same circumstances. I'm not saying you cannot operate the circuit well (reasonably so) without \$R_{C_{_1}}\$. It will work fine without it. It's just that if you are nitpicking tiny details, the differences will get in your way and confound your analysis. It's better if you simply remove that effect at the outset so that you won't waste time digging through some mysterious rabbit data-hole.
I've also added parasitics \$r_{e_{_1}}\$ and \$r_{e_{_2}}\$. These are actually pretty important for the purposes of quantifying the expected voltage gain (and to a smaller degree for your purposes, understanding temperature stability.) I'll talk more about this voltage gain issue, shortly.
Finally, I added the relatively unimportant (mostly) base bulk impedances \$r_{b\,'_{_1}}\$ and \$r_{b\,'_{_2}}\$. So long as the base current isn't too significant (and it won't be so long as you keep the voltage difference between A and B below a few tens of millivolts) the drop across these won't amount to much. But you may need to be aware of them, at times. So I added them. The values for small signal BJTs will be about the value I show -- perhaps to twice that much.
(I didn't add the bulk Ohmic collector and emitter resistances. Even in small signal BJTs they are usually under a few tenths of an Ohm.)
Response of VOUT to CM Changes
Let's assume away all the parasitics and just focus on the most important detail. This is the fact that if you lift both A and B by the same voltage (we are assuming an ideal voltage source directly applied to both bases) then the voltage across \$R_{E_{_3}}\$ increases by exactly the same amount (okay, slightly less for a variety of reasons, but one of them being that an increased collector current implies a larger voltage difference between the base and emitter of a BJT.) This means that the shared sink current increases and, assuming it divides equally to each BJT, causes of change of half that current variation in \$R_{C_{_2}}\$. That's most certainly going to cause the voltage at B to decline. So, right away, we know there's a problem using a resistor as a current sink.
How much? Well, assuming \$V_A=V_B\$, then \$\Delta I_{R_{E_{_3}}}=\frac{\Delta V_\text{CM}}{R_3}\$ and therefore \$\Delta I_{R_{C_{_2}}}=\frac12 \frac{\Delta V_\text{CM}}{R_3}\$ so then \$\Delta V_{\text{OUT}_\text{CM}}=-\frac12 \Delta V_\text{CM}\cdot \frac{R_{C_{_2}}}{R_{E_{_3}}}\$. With both resistors the same, as in your circuit, this works out to half of the common mode change. So if you change it by one volt, I'd expect a change at the output of half a volt in the opposite direction of the common mode change.
Now this would not be such a problem if you replaced \$R_{E_{_3}}\$ with something that acted a lot more like a current sink.
This doesn't mean you cannot use a resistor. It only means that if you do use a resistor, you need to be able to calculate some kind of estimate about the effect of common mode changes upon your output so that when you analyze the output you do see, with respect to changes you make in the common mode voltage, you at least will better understand the observations.
Residuals -- A Diversion
There's an important point to bring up here that has nothing to do with circuits but everything to do with understanding quantitative measurements. This is the concept of residuals.
When you make quantitative observations ("measurements") of some process variable (voltage, current, temperature, mass, your happiness at the moment on a scale of 1 to 10, or whatever), there will be theoretical considerations, which together with the specifics of some circumstance, can be applied in a rigorous way to develop mathematical formulae that you can use to generate numbers -- quantities -- that we imagine "predict" those observations.
The difference between the predicted values and the observed values are one of the following sources:

Known applicable theories that were neglected when developing the mathematical formulae
Unknown applicable theories that need to be further investigated to improve current theories
Random events (anything where we don't hope to develop newer theories to explain)
Unknown and unknowable quantum entanglements

In our large scale statistically-emergent-phenomena world, we never really worry about #4. And #3 is chalked up as "noise" that comes in a few different but common flavors (until/unless someone comes up with a predictive theory at which point it's not noise anymore.)
So as you peel back the layers, one at a time, you increasingly know more about various effects, which operate at varying levels of importance and/or in differing circumstances. And you can improve upon the quantitative predictions given any particular circumstance. So things will match up better.
What remains, after all known appropriate-to-circumstances theories have been comprehensively applied, is called the residuals. There may be new theories to be found in that unexplained residual data. Or the residuals may pass a series of statistical tests to determine if that data fits one or more of the types of random Poisson events that can integrate into more commonly understood things such as the ever-famous Gaussian distribution.
You should consider your physical experiments in this way. Start with some basic and very simplified theory about how things work. Take measurements and compare them with your earlier, more prosaic ideas and look at the residuals. Then, if you know some more theory worth applying, apply it and see what residuals remain. Repeat until your own knowledge is exhausted. Then write something here, as you did, to see if anyone can add additional ideas that help further explain your residuals.
Voltage Gain -- A Diversion
Assuming \$R_{E_{_1}}=R_{E_{_2}}\$ and that your signal's voltage amplitude is small (say, \$\le 1\:\text{mV}_\text{PP}\$) and the signal source impedance is negligibly low:

You should expect to see a voltage gain at the output that is \$A_v=\frac12 \frac{R_{C_{_2}}}{R_{E_{_2}}}=50\$
#1 will be wrong because it neglected \$r_{e_{_2}}\$, so we now compute \$r_{e_{_2}}=\frac{V_T}{I_{E_{_2}}}\approx 37\:\Omega\$ and then re-estimate \$A_v=\frac12 \frac{R_{C_{_2}}}{R_{E_{_2}}+r_{e_{_2}}}\approx 36\$
#2 will be wrong because it neglected the varying gain and current in \$R_{E_{_3}}\$ which varies with signal, neglected the ohmic resistance in the emitter, and so on

But now, at least we have a sense of the expected voltage gain. It will probably slightly less than predicted in #2. But not so far from it that we should be bothered. Yet there will be unexplained residuals and we can pursue those as deeply as we wish, as there ARE plenty of existing (unexplored here) theorIES remaining to be applied, if you've a mind for it.
But now that you can do something about computing a gain and now that you have something with which to estimate the effect of a common mode voltage upon your output, as well, you should be able to do something about theoretically predicting an output given your combined input signal.
Summary
Now, the problem with experimentation is exactly how you choose to generate the input signal to A and B. I have signal generators here on the shelf. But they have \$50\:\Omega\$ outputs (well, that's one choice they offer -- the others are worse for these purposes.) I also have bench power supplies with very low output impedances, capable of many amps. But are you using a bench supply that's capable of automatically moving sinusoidally? Or are you just using another signal generator for that common mode voltage purpose? Your own LTspice schematic suggests two signal generators to me.
When you do things "physically" on your workbench, are using two signal generators? If so, are their ground floating? (I doubt it.) My signal generators have one side of their \$50\:\Omega\$ output tied directly to the Earth-ground pin of the mains plug. If I were using two of them, one side of both signals would be tied together simply because they are both plugged into mains outlets when operating. So if you are using two similar signal generators, then you probably will NOT have floating outputs. And that's important to know, if so. You can't just go connecting stuff up without knowing, in detail, all of the implications of those connections you are making.
So now you need to explain, in detail, how you are wiring up your physical testing. I very much doubt it is anything like what you did with your LTspice schematic, even in principle. This is why I was complaining in comments about your schematic.
So I'll leave things here, for now. You need to be very detailed about what tools you have on hand and how you are arranging them in your physical setup. With sufficient details about those tools, it's possible to recommend a reasoned hookup to perform some tests as well as some idea about what you should expect to observe. (Or else, simply explain the differences you say that you see between the physical implementation and the LTspice simulation.) For now, I must beg off until more information arrives from you. But at least, you have an idea about possible difficulties between what's in your head, what's in LTspice that you write up, and what's on your workbench when you are stuffing parts together to see what happens.
Comment: Thank you very much for presenting analytical, practical and philosophical view on the analysis and implementation approach. I was blown away by your approach.  I will sketch my setup and let you know. I do, by the way, use two grounded 50 ohm  function generators and use a center taped transformer to create differential signal.  I'd like to apply what you described and  will report the setup and results later.
Comment: I have HP 8116A and Wavetek 271 generators with 50ohm outputs. I switched to using center-tapped xformer like in AoE.  At 1st i wanted to see the signals w/o the amplifier. Please, see the diagram in the original question (can i add pictures to comments?). Does it look ready to be connected to the amplifier circuit?
Comment: @vgeng Place two separate 10k resistors, each connected on one end to ground, with the other ends to TP1 and TP3 (unconnected to long tailed pair) and see if you still see the same signal amplitudes at those test points. That's about the loading the transistors will present. Separately, under no circumstances do you want your differential signal to exceed about 10 mV peak, or 20 mV peak to peak. As you increase towards 100 mV peak you are moving the BJTs towards saturation and that's a problem. Is your transformer "heavy iron" so it handles that low frequency well?
Comment: Finally! Just like in SPICE (sorry i had to peek at it) ,in the built circuit I see the bad signal with "long tail" and nice clean one with mirror and sink circuits. As you recommended i reduced  diff. signal amplitude to 10mV (input to xformer 100mV). I got the gain of 36.3, so very close to predicted 36.  Is the reason the diff gain must be <= 10mV, because we want Vc >= Ve + 0.2V? I have to review that. I cannot gather from the xformer spec if it is heavy iron, but i could see good signal at 1 KHZ w/o attenuation. Thanks for your help.
Comment: @vgeng Good to hear!!! The reason for the small signal is that as a general rule if there is too much difference between the BJT bases then one of them will saturate. However, this is more true when you are NOT using an emitter degeneration resistor and your gain is a lot higher (as it will be with bipolar opamps.) Your case has emitter degeneration so you can feel free to increase the signal a bit. Your observed gain will decline somewhat and, just before saturation/clipping, it will be maybe 30 or even less. But without those emitter resistors the saturation problem is serious.
Answer:
I thought the physical implementation of the "long tail" would show at
least some noise as well. Is that a correct assumption?

There will always be noise on any analogue output because noise is always everywhere (above absolute zero) but, the CM gain is significantly less than 1 so why would you expect to see noise if you don't have much noise on the inputs?
Answer: You can do a noise simulation run in LTspice to show you the spectral density of the simulated noise.
Transient analysis does not include internal noise (flicker, shot and thermal noise) of the components.


Does having objects behind other objects slow render times down in Cycles?

Question: When creating an object, like an A/C unit in my case, there are a lot of objects that are only partially visible because of the view or because they are behind other objects, and some are not visible at all because they might be on the back of the unit. Do all those objects, even the ones that aren't directly visible, get rendered when rendering in Cycles? Just trying to think of ways to improve render speeds. Thanks!
Answer: The short answer to your question is Yes, all of the other objects in your scene contribute to the final image and are computed by Cycles.
In a little bit more detail, Cycles is a ray-tracing render engine. This means that it simulates light rays bouncing around your scene. Just like in real life, these rays can bounce multiple times, which means they can go around corners, refract through glass, and influence the scene regardless of whether or not they are in direct view of the camera. For example, look at this simple scene:

Even though the red sphere is out of the camera's view, it still influences the scene, tinting everything red. It even spreads beyond the direct line-of-sight of the sphere, by bouncing off the walls.
So, how does Cycles render everything? It starts by creating a BVH Tree. BVH stands for Bounding Volume Hierarchy. The BVH Tree contains all of the objects in the scene, including particles and hair, and allows Cycles to make a quicker determination of whether or not a ray has intersected with a mesh.
Cycles classifies its rays in multiple ways. One of these classifications is Direct vs Indirect. Direct rays happen when an object is lit by a lamp or object that is in its direct line of sight. Because of this, Direct rays are only the first bounce of a ray. All other bounces are indirect rays. This indirect lighting is (most of the time) going to be the largest contribution of objects out of the camera view to your scene.
Knowing all this, what is the best way to decrease render times? There isn't one easy answer, but here are a few suggestions.

Decrease Max Bounces:

This limits the number of times a ray can bounce before it is killed. Decreasing these can minimize the amount of time spent calculating rays in parts of the scene not visible to the camera. This can make your scene darker, though, since it decreases the influence of indirect lighting sources.
Use AO Bounces (in the Scene panel):

Similar to decreasing Max Bounces, this also limits how many bounces a ray can have before it dies. Instead of just killing the ray, though, this does an Ambient Occlusion calculation first. This can have the effect of lightening the scene, since AO passes are usually brighter than normal rendering.
Use Camera Cull:

This is the most drastic of the options here. It will actually exclude objects outside of the camera view from the BVH Tree. When using this, you have to be careful not to get weird flickers from objects coming in and out of the camera margin. After enabling it in the Scene settings, you have to individually enable culling for each object in the Object settings:

If you want a little more control, you can manually animate the renderability of an object by hovering over the camera icon and pressing I:
Comment: Thank you! That makes sense. You've given me more useful information in a couple paragraphs than watching hours of YouTube videos on similar topics. I genuinely appreciate your help explaining this to me and giving me those tips to speed it up. Thanks again.
Answer: All the surfaces that are reachable with a light ray shot from the camera are taken into consideration when rendering. Even if the objects are not directly visible, they might contribute to the overall computation of indirect lighting, reflections, etc.
Comment: Soo, slower or not? His title question differs from the question's question.
Comment: @Leander The answer's answer answers "*Do all those objects, even the ones that aren't directly visible, get rendered when rendering in Cycles?*". I would presume that the more objects and things that are to be rendered the more resources (and maybe time) is needed.


Send and receive from Socket in Android Java

Question: Hi All  I have a small question.

I have server client application Where the client will be sending data asynchronously.
The server will receive message and parse.
If server receives a wrong data it will send and error message to the client.

Now my Problem is in client I will be sending data continuously with out caring about acknowledgement example:

Suppose I am sending some 1000 messages from client. The client sends all the data in the socket.

If error occurs server will also put error message in the socket.

But either one can happen: send data from client or send message from the server.
What is the best way to handle the case?

If any error occurs and client receives the error message from the server then the client has to resend the data.  One way is to send the data and wait for acknowledgement. I don't want client to wait for servers ack because chances of error are very less. Can any one tell me some good solution to this?
Comment: I wouldn't count on a slim chance of error, especially when it comes to mobile devices.
Answer: Have the error message include the 'index' the client should restart sending at.


Force AutoFill Save Password dialog programmatically

Question: I setup Password AutoFill in my iOS 14 app. The app uses multiple tabs. Associated Domains are also set up. All works as expected.
I have a Test button below the user/password TextFields, which the user can press to test just entered credentials. Now, the Save Password dialog shows only when I change to another tab.
Is there any possibility to programmatically force the Save Password dialog to appear on the same tab where the user/password TextFields are located? I would like to present it to the user right after the Test button is pressed and credentials are verified to be correct.
Answer: Remove the textfields with content type .username and .password from the view hierarchy and the save dialog will appear.


How do I get rid of the mirroring option icon when I don't have an apple TV (but continue seeing other mirroring options when available)?

Question: I just upgraded to Sierra from Mavericks and since I did, the mirroring options icon is always in the menu bar.  When I click on it, it says in grey: "AirPlay: Looking for AppleTV" then after a few seconds it will change to "AirPlay: Off".  I went to display preferences and the part that says AirPlay Display only has Off in the dropdown (which it is set to).  I want that icon to go away, but I want it to appear if I plug in an HDMI cable or something so I don't want to uncheck the box.
Will my Mac look for an AppleTV now and forever?
Answer: If you don't want to connect to AppleTVs at all, you can disable the service that is constantly looking for AppleTVs:

Disable macOS' System Integrity Protection (SIP):

Reboot your Mac and hold Command-R as soon as possible. Let go when you see the Apple logo. In the menu bar at the top go to Utilities > Terminal
Now we will disable macOS' SIP, disable AirPlay and re-enable SIP again so your Mac stays safe. Enter these commands
csrutil disable

sudo chmod 000 /System/Library/CoreServices/AirPlayUIAgent.app/Contents/MacOS/AirPlayUIAgent

csrutil disable

Click the Apple logo in the upper left and select "Restart"

Your Mac won't display the AirPlay Mirroring icon if an AppleTV is near you.
Let me know how this worked out for you.
edit:
To undo the changes use this command
sudo chmod 755 /System/Library/CoreServices/AirPlayUIAgent.app/Contents/MacOS/AirPlayUIAgent

Comment: Ok, thank you.  I'll give that a try later.  This seems like a bug but I don't know how long it's been around since I just upgraded from Mavericks.  Is this a common issue do you think?
Comment: As far as I understand this is the intended behavior in macOS Sierra. Even when I'm not connected to a network this icon is visible on my MacBook.


Would uninstalling Play Store and Play Services delete user data on phone?

Question: If I uninstall Google Play Store and Play Services will that delete files such as texts, pictures and more. My issue at hand is this error continuously appearing on my phone: "Google Play Services has stopped".
Answer: No, it would not delete your files.
You should always keep a backup of your data anyway. The error you are seeing is because these services are defined as system services and there could be some of the other background services which are are trying to access it.
Answer: Google Play store and Google Play services are system apps which require root permissions to be removed.
If you have root permissions, yes you can remove Play Store and Play Services completely and doing so will remove your google account from the device and might break other Google propreitary apps on system, if any. And no, it will not delete any texts, pictures, videos, or any files on sdcard. And if your device is on lolipop, removing Google Chrome might remove WebView and break Messaging app (it fails to open complaining about WebView). But messages are not deleted, once you restore Chrome they are back.
And if your device doesn't have root permissions, you cannot completely remove Play store and Play services as they are system apps. All You can do is to remove google account from device and uninstall updates for them. Be aware that if you don't remove Google account and uninstall updates for them, they still get autoupdated on their own. And no, uninstalling updates for play store and play services will not delete any texts, pictures, videos, or any files on sdcard. It should be safe.


What is a perfect motherboard for my budget build I3 8100 + GTX 1050 TI 4 GB?

Question: I find on Google about the motherboard for I3 8100 + GTX 1060 but it keep saying about Asus - Prime Z370-P ATX LGA1151 Motherboard, which is a near high-end motherboard at $120 for Intel Core I7 which is for my budget build, it is unacceptable. So any alternative solutions for this motherboard ?
Comment: Do you have any plans to upgrade to an unlocked CPU in the future?
Comment: I don't want to overclock
Answer: I would recommend,
[MSI H110M Gaming][1][1]: https://m.newegg.com/products/N82E16813130918
Since you are on a budget and the fact that your only using a 1050 ti this motherboard should just do the job, it only comes in at around $60.
Comment: Well sorry for giving advice, maybe I shouldn't have even commented.
Comment: It not what i asking for
Comment: You suck! How can you recommend something like that! It not for Coffe Lake! This motherboard don't compatible with this motherboard! All Coffe Lake chips don't compatible with older gen of motherboard!
Comment: It only compatible with the 300 series motherboard! I will downvote you if i can
Comment: Im kidding im just overreacting yesterday! Advice and learning is good dude! I just have bad thing to thinking so it make me overreacting! Im apperaciate what you has done!
Answer: Whatever's cheapest here.
Currently that's an MSI B360M PRO-VD for $55.99.
Since your CPU doesn't support overclocking, unless you have plans to upgrade to an unlocked chip, getting a Z series board is unnecessary for overclocking. As such, no motherboard will offer a performance boost, assuming it supports your RAM speed, which–based on the tier of the rest of the system–I'm assuming isn't particularly high, and is likely supported by all motherboards.
From there I've basically just selected for price. You may be losing some I/O, and most of the cheaper boards only support 2 RAM modules (not a huge deal since your system only supports dual channel anyways, unless you have plans to upgrade your RAM), but it shouldn't really matter too much.
I've additionally chosen to eliminate Biostar and Gigabyte–not because their products are bad, but because of their relatively poor customer support.


Encryption key token

Question: How to securely store an encryption key in USB drive? Here is my idea. I would like to write a program (let's say PC) and it will store data to a database encrypted at the record level or field level, not in the file level. And also I want to keep the encryption key out of the computer. It is simply keeping the key in the USB device. So physically, the key will be secure. Is there any USB device in the market? What I found are mostly security tokens.
Answer: I'm having a little trouble following you, but here are my initial thoughts: Storing on Flash media has a slightly higher risk due to memory/erase issues. That said, it sounds like you want to secure a container on the usb device rather than use something like an IronKey or Data Traveler. I assume the objection would be with leaving the drive unlocked once mounted since this increases the ability for the key to be compromised?
At the software level, there are two option I would recommend.

Truecrypt: Use Truecryt in traveler mode and store your private keys in a encrypted container you can mount and unmount as you please. You still run the risk of having the stored key exposed unsecured for a given period of time.
Use KeePass or similar. KeePass is a password database, but if you are using the 2.0 branch or a community versions which support attachments, you can use it to store each of your private keys with one database which you take with you on your usb drive. You can then access and cut and paste your keys as necessary. The advantage here is that keepass will timeout and lock up if you configure it to do so. The disadvantage is that you are no longer dealing with a file that is just "sitting there" ready to use. You either need to extract it or cut and paste when its needed.

If you are asking something different let us know and I will adjust my response accordingly.
Update
Based on your comments, I'm not sure if you could get a single devices - maybe you can combine a phone/sms based OTP solution with some sort of physical token / smart card.
Update 2
This post seems similar, I checked through the comments and they are talking about a lot of different options for secure token/card hardware, figured I would just link instead of re-posting so you can determine which options are most useful for you.
Comment: Thanks for your response. Actually I don't want to store keys on the encrypted USB Devices. But I want some kind of USB device similar to the security tokens like Yubikey (with less storage: storing only a few keys). But Yubikey or other RSA keys are just for OTP. The device I want would provide keys + OTP. Desktop programs, API or plugin would access the keys on it for encryption and decryption process.
Comment: That device could only be accessed by special programs with security for key manipulations and setup. Most of the time it will be lock down. I think it would be like HSM (Hardware Security Module) but less expensive device.
Comment: I'm not aware of any cheap or open source supporting devices which are both OTP and serve as a "smart card" type physical token.
Comment: How about "Smart Card" type physical token? Do you know some of it? I don't mean cheap but affordable for general users.
Comment: I'll take a look at the link on your update2. Thanks

Encryption key token


Is it possible to resurrect extinct insect species and other arthropods?

Question: As we all know, animals are going extinct all the time and that includes arthropods. Many scientist say that we could bring extinct species (like black rhinos, tigers etc.) back to life. I was wondering though: can the same thing happen for insects and other arthropods (like beetles, mantises, spiders)? If not, are there any other ways in which we can bring back recently extinct animals?
Comment: @AlexP There is a story, possibly apocryphal, of the distinguished British biologist, J.B.S. Haldane, who found himself in the company of a group of theologians. On being asked what one could conclude as to the nature of the Creator from a study of his creation, Haldane is said to have answered, "An inordinate fondness for beetles."
Comment: Arthropods are by far the most diverse phylum of animals; it's as if God dedicated 90% of His available time creating countless species of arthropods, and then rushed through all the other phyla in the remaining 10%. The loss of one species of mammals decreses biodiversity 10,000 times more than the loss of a species of beetle.
Comment: To my knowledge, black rhinos and tigers aren't extinct, at least not yet.  Maybe you meant endangered?
Comment: @Neil Several subspecies of the Rhinos and of Tigers have in fact gone extinction in the last couple of decades.
Comment: Please clarify how this is a question about worldbuilding, as opposed to a question concerning revitalization practices as we currently understand them.
Answer: Cloning at this time is a complicated process but it consists of two possible methods, One is true cloning, and the other Genetic Engineering,
True Cloning
Again complicated but basically consists of removing the cell nucleus from an egg from a similar or same species, then removing the nucleus from a parent cell of the subject, and then inserting it into the egg, and intimating it in a surrogate parent.
South Korea all wanting to attempt to bring back the Woolly Mammoth using this method, but they haven't yet found an intact Cell to harvest. but if they find one they can place it inside an elephant egg and have the elephant carry the fetus to term. you need a similar species to carry it to term to avoid a lot of complications, there's still several but that's basically what they do.
That same South Korean team have been cloning rich people's dogs with this method...
So the question is could this be done for an insect... insects lay their eggs, they don't carry the offspring, so that might effect how many risks and complications could occur, but some of the complications arise due to incompatible parents. so perhaps insects would be easier.
However they would need a store of healthy cells with which to harvest, and a batch of eggs to inseminate.
Genetic Engineering
This is the second method that is being looked at for the Woolly Mammoth, scientists have been trying to activate genes in elephants to "make" one more like a Mammoth, they have been comparing it to partial segments of Mammoth DNA taken from frozen bodies. they hope to get an elephants DNA as close as possible in a lab before they attempt Embryo implantation. so its all theoretical for now.
Either of these options are current technology (or at least close to it) in the future I imagine it would be a similar process to Method one, but using an engineered cell from Method 2.
Answer: If anything, it should be easier for us to clone insects. I feel that there are two factors deciding our ability to clone organisms:

Ability to find live gametes or other reproductive cells (for non-sexual reproduction). Mammoths and other big mammals do not have many reproductive cells and not as many fossils as there more insects at any time.
Mammals are hard to clone because they have live births. Therefore, we have to ensure compatibility of the eggs of extinct creatures in bodies of current organisms.

There are legal concerns for the cloning insects though, as they tend to escape and destroy the environment, but from a scientific point of view, it is less hard than cloning mammals.
Comment: Why is this even the answer even thought it does not answer the question?


What is the difference between optimal and optimum?

Question: My question is exactly as the title says. Someone used "optimum" in an email to me and in my response I used "optimal," so I began wondering what the difference between them is.
Comment: I don't think this is general reference.
Answer: I'd like to add the following lines as an addendum to other answers.
In some areas of mathematics, an optimal value is essentially a local optimum; i.e. it's an optimum value in its neighborhood. For example:

In parallel, the same applies to maximal and minimal values. In other words, a maximal value is essentially a local maximum; a minimal value is essentially a local minimum. For example:
Comment: I came here to say the same. I have an engineering degree, and local/global optimal/optimum is definitely how these words from a technical term in books and lectures. I'd say this is the correct answer.
Answer: The adjective forms of optimal and optimum are synonymous:

optimal, adjective: most desirable or satisfactory : OPTIMUM [optimal concentration of a drug]
optimum, adjective: 1. most favorable or most conducive to a given end especially under fixed conditions [question is one of
  combining these various techniques to optimum advantage]; 2.
  greatest or best possible under a restriction expressed or implied [an
  optimum return on capital]

However, optimum also has a noun form:

optimum, noun: 1. the amount or degree of something that is most favorable to some end; especially : the most favorable condition
  (as of temperature, light, moisture, food) for the growth and
  reproduction of an organism; 2 a : greatest degree (as of growth,
  activity, or effectiveness) attained under implied or specified
  conditions [this pest reaches its optimum further south]; b : a
  period of warmer and drier climate than that of the present [he
  post-Wisconsin optimum of the northern hemisphere is considered to
  have occurred between 6000 B.C. and 3000 B.C]

[All from Merriam-Webster Unabridged]
Answer: My usual reference on such matters, 'The Cambridge Guide to English Usage', sees no difference in meaning, but concludes that optimal is the more formal of the two. Optimal seems to be less common in American English than in British English.
Comment: Maybe it's just my engineering background, but I'm an American and optimal seems quite common to me. As others have suggested, my experience is that common usage is for optimal when an adjective is desired and optimum when a noun is desired. Although optimum can also be used as an adjective, I find that this is an infrequent usage.
Comment: @BenHocking: Maybe, but my comment about frequency is based on corpus evidence.
Answer: One aspect of optimal versus optimum that previous answerers have not addressed is the shifting balance of popularity between the two words. According to Merriam-Webster's Eleventh Collegiate Dictionary (2003), the noun optimum has a first occurrence date of 1879 and at some point also began to appear as an adjective, whereas the adjective optimal has a first occurrence date of 1890—just 11 years after optimum debuted.
As noted in Gnawme's answer, Merriam-Webster says that optimum as an adjective is identical in meaning to optimal. But there has been a considerable shift in frequency of written use between optimum and optimal over the past century. Consider the Ngram chart for optimal (blue line) versus optimum (red line) for the period 1880–2005:

As noted above, optimum can be either a noun or an adjective, whereas optimal is strictly an adjective. But despite competing in only one dimension against a two-dimensional word, optimal shot past optimum in frequency of usage in the early 1970s and, as of 2005, was nearly three times as frequent in the Google Books database as optimum.
Of course, one possible explanation for the very different trajectories of optimal and optimum in the preceding Ngram chart is that (1) optimum and optimal never really competed head-to-head much, because optimum has always appeared primarily as a noun, but (2) in recent decades, the fashion in writing has turned away from using the noun form (optimum) in favor of what was always the preferred adjective form (optimal).
To test this hypothesis, I created a series of ten Ngram charts consisting of phrases in which both optimal and optimum necessarily appear as adjectives: optimal conditions/optimum conditions, optimal design/optimum design, optimal effort/optimum effort, optimal level/optimum level, optimal performance/optimum performance, optimal result/optimum result, optimal size/optimum size, optimal temperature/optimum temperature, optimal time/optimum time, and optimal value/optimum value—all for the period 1880–2005. Here are the results of those paired comparisons.
For "optimal conditions" (blue line) versus "optimum conditions" (red line):

For "optimal design" (blue line) versus "optimum design" (red line):

For "optimal effort" (blue line) versus "optimum effort" (red line):

For "optimal level" (blue line) versus "optimum level" (red line):

For "optimal performance" (blue line) versus "optimum performance" (red line):

For "optimal result" (blue line) versus "optimum result" (red line):

For "optimal size" (blue line) versus "optimum size" (red line):

For "optimal temperature" (blue line) versus "optimum temperature" (red line):

For "optimal time" (blue line) versus "optimum time" (red line):

For "optimal value" (blue line) versus "optimum value" (red line):

Of the ten pairs I tested, Ngram found only one instance in which—as of 2005—the preferred adjective form was optimum (optimum temperature). For seven of the nine pairs in which optimal has become the preferred adjective form, the point at which the optimal form passed the optimum form in frequency was between 1975 and 1985; in the other two, the crossover occurred in the early 1990s.

Conclusions
From these tests I conclude that, in most contexts, popular usage now prefers optimal to optimum as an adjective by a significant margin—although prior to 1970, the reverse seems to have been true. In Google Books matches for the two adjectives, I don't see any obvious difference in the formality of the writing where the two forms appear, notwithstanding the view expressed in The Cambridge Guide to English Usage cited in Barrie England's answer. Nor do I see any particularly striking difference in preference for one term over the other in U.S. usage and in UK usage—as, for example, in the results for "optimal level" (blue line) versus "optimum level" (red line) in the corpus British English:

and in the corpus American English:

In short, the biggest difference between optimal and optimum as an adjective today may be that in the past 50 years optimal has become considerably more common than optimum in published English writing and seems poised to increase its advantage in popularity going forward.
Answer: I'm pretty sure in the discrete math course I took that optimal was used for arguments (or domain) and optimum was used for value (or range).   An optimal solution produces an optimum value. For example: last week the optimal day for rain for the petunia garden was Tuesday.  7mm of rain fell on Tuesday which was close to the optimum rainfall for petunias of around 5mm per day.
I haven't been able to find a mathematical definition of optimal and optimum to refer to but the most common phrase I've found for "optimal" on a web search is "optimal solution" which is consistent with my definition.
Comment: Hi Kahurangikea, welcome to English Language & Usage. You might not know that this site is a bit different from other Q&A sites: opinions and personal recollections are generally discouraged. An answer is expected to be authoritative, detailed, and explain why it is correct - preferably by quoting a reference or linking to a source. For help writing a good answer, see [Answer]. For more information about how EL&U works, I can highly recommend taking the **[Tour]**. :-)


In a contract what is the clearest way to state which country's currency is being used? Why is there so much variation to these terms?

Question: I noticed in written contracts there are various ways to state which currency is to be used for money. What is the difference between 'legal tender' and 'lawful money'? Is it more clear just to say 'US Dollars' or 'Canadian Dollars'. I guess some countries don't use the word dollar for example Swiss franc or British sterling. Is there a particularly clear way to say 'all references to money are references to the official money of country X'?
Answer: You just say "all payments are in Swiss France" or "all payments are in Thai Baht" or "all payments are in Euro" (they are all interchangeable) or "all payments are in Australian Dollars". You wouldn't say "Dollars" because that doesn't make clear which currency you mean if different countries are involved.
"Legal tender" means the particular banknotes that one needs to accept for payment of a debt. For example, a 50 US dollar note is not legal tender in the UK. A German 100,000 Mark note from 1923 is not legal tender anywhere today (but some guy managed to convince people at a US bank to exchange one for dollars). More than one pound in pennies is not legal tender in the UK.
I would have no idea what is meant by "lawful money".
Summary: Specify exactly the currency that you are talking about.
Comment: Thanks for the answer. The part I find most interesting is "all payments are in ...". Does this cover all references to money being exchanged? I've seen it phrased "all references to 'dollars', 'USD' or '$' are references to United States Dollars" but I guess this way is more clear and encompassing.