What is the name of a U.S. Supreme Court decision holding that government cannot conspire with private companies to censor protected speech?

Question: There was a supreme court decision that said that the government can't conspire with private companies to censor. Can anyone tell me the name of the case?
Comment: Would this be a **US** Supreme Court decision?> Remember that Law.SE is world-wide, and many countries have a "Supreme Court"
Comment: Welcome to the site. When asking questions about a specific jurisdiction (country, state, etc) please always add the corresponding tag to your question.
Comment: @Rick I presume you are referring to the Supreme Court of the United Kingdom.
Comment: I have not found such a case. Do you have any idea **when** it might have occurred? Do you recall anything about the particular circumstances?
Comment: I've not found anything from neither the Supreme Courts of England and Wales nor India.
Comment: @phoog Yep, my bad. But in my defence I only searched for E&W judgements which is my default setting.
Comment: This is reminiscent of the argument that social media companies are serving as de facto government actors when the government suggests they limit health disinformation and the companies limit health disinformation.
Answer: I'm not convinced that there is a U.S. Supreme Court case with such a clear holding. For example:

May a private entity running a public access channel ban speakers
based on the content of their speech—something a government entity
running the same channels could not do?
Yes, the Supreme Court held in
a 5-4 opinion in Manhattan Community Access Corporation v. Halleck (2019).
Why? Because the First Amendment doesn't apply to private entities in
this instance.

You may be looking for one of the cases discussed in Halleck which notes (in the official syllabus) that:

"A private entity may qualify as a state actor .  . . when the entity
exercises "powers traditionally exclusively reserved to the State."
Jackson v. Metropolitan Edison Co., 419 U. S. 345, 352 [1974]. The Court has
stressed that "very few" functions fall into that category. Flagg
Bros., Inc. v. Brooks, 436 U. S. 149, 158 [1978].

Per the official syllabus in the link above, Jackson held that:

The convergence between the actions of a state and a heavily regulated
private utility company do not rise to the level of state action if
the utility company has a partial monopoly in providing electrical
service and uses a procedure that the state utilities commission finds
to be appropriate under state law in terminating service to customers.

As the linked material explains:

A private entity performing a public function can be classified as a
state actor, but merely being regulated and overseen by the state does
not equate to performing a public function if the company is managed
by private actors. In this decision, the Court placed limits on the
public function doctrine, which otherwise could have grown into a
massive exception permitting the inference of state action.

Thus, heavy state regulation of a private entity still doesn't constitute state action which can violate a constitutional right, in this case, even though if the state has had greater control over the nominally private entity (e.g. appointing its board of directors), the private entity's actions would be state action.
Per the official syllabus in the link above, the primary holding of Flagg Bros. was that:

A warehouseman's proposed sale of goods entrusted to him for storage,
as permitted by [New York State's Uniform Commercial Code] § 7-210, is
not "state action," and since the allegations of the complaint failed
to establish that any violation of respondents' Fourteenth Amendment
rights was committed by either the storage company or the State of New
York, the District Court properly concluded that no claim for relief
was stated by respondents under 42 U.S.C. § 1983.

In reaching this conclusion, the U.S. Supreme Court reasoned that:

The challenged statute does not delegate to the storage company an
exclusive prerogative of the sovereign. Other remedies for the
settlement of disputes between debtors and creditors (which is not
traditionally a public function) remain available to the parties.
Though respondents contend that the State authorized and encouraged
the storage company's action by enacting [the statute], a State's mere
acquiescence in a private action does not convert such action into
that of the State.

In other words, enactment of a state statute authorizing private action is not state action that can violate a constitutional right.
Answer: I figured it out myself. It was Bantam Books, Inc. v. Sullivan, 372 U.S. 58 (1963)
Comment: [...] I see no "conspiracy" between the commission, or the police, and any private party, nor did the opinion mention any such It might be said that the police and the Commission conspired, although the Court did not use that word. But the "cooperation" of the book distributor, in removing listed works from sale, was extorted under threat of legal action, and what explicitly held not to be voluntary.  This was a case of prior restraint enforced by threats rather than legal proceedings, not of any public/private "conspiracy" or even "cooperation".
Comment: The holding in *Bantam Books* was that a Rhode Island state government created and appointed commission that issued warnings to private companies that media was obscene, but could not enforce obscenity punishments itself and instead referred cases of non-compliance with warnings to local police to prosecute under state obscenity statutes, violated the First Amendment. It did not hold that "government can't conspire with private companies to censor," since both the commission and the police are governmental actors acting under color of state law; it held that the Commission was a state actor.
Comment: What part of that case constitutes a private company conspiring with the government to censor?
Comment: The case held that the effect of the commission's actions was to create a system of prior restraint and state licensing, with no due process protections whatsoever, not even a hearing before the commission, no declared standards as to what might be considered "objectionable" and no designated method of appeal. The Court found that works not obscene under the then-current *Roth* standard were listed as "objectionable". It found that the result ofd listing was to totally suppress the works, so that adults as well as youths could not buy them This violates *Near v Minnesota* nd other cases.[...]
Comment: A separate but linked Q&A on this case might be a good idea.


DIY Cleaning Solution for Quartz

Question: I have a water/castile soap/lemon essential oil mix I use for cleaning. We've recently moved and have quartz countertops at our new place. I'm having trouble finding information on what is/isn't safe for quartz countertops. Is the above mixture safe for them if wiped off with a damp cloth?
Answer: Quartz is a man-made product of natural stone components in a resin binder.   It is almost as heat resistant as granite (but the resin can be damaged) but is significant more stain resistant than granite.  It is not porous and does not have to be sealed as natural stones do.
That said, you should wipe up spills quickly with regular detergent and take reasonable care.  You're going to have to find out the actual manufacturer of your countertops to get an specific care recommendation, but there is no lack of generic sources on the internet.
https://www.bobvila.com/articles/how-to-clean-quartz-countertops/
Answer: Castile soap/lemon essential oil no doubt is effective and (may be) appropriate for human skin, but it has no place in cleaning a counter. Use very dilute dish washing detergent in warm water optionally followed by a clean wet rag.

DIY Cleaning Solution for Quartz


What is a general way to trick programs into thinking they're not being piped?

Question: Many CLI programs produce different output when they print to the console as opposed to being piped to another program. For example, exa will print a list of files with color highlighting. But exa | less will not have colors.
I am aware that often these programs have arguments to force one kind of input or the other, so the workaround is to learn those arguments and use them when piping. This isn't a general solution because of several problems:

You have to learn the arguments of every single command, or you have to keep getting distracted from your workflow to read a manpage when you're just trying to pipe some stuff.
Not all programs provide such arguments.
Having to keep inserting the arguments into a long chain of pipes is annoying. Sometimes the whole chain takes a long time to run, so by the time you've seen the incorrect output and realized you forgot to add --color or whatever again, you've already wasted minutes of time.

Clearly the design of the program was that it would detect that it is being piped and guess that a different output is appropriate, which is fine and correct behavior in many cases. In many other cases the program's guess is wrong. Instead of having to learn the unique interface of each program and override the guess, it seems like it would be more efficient if you could simply pre-empt the guessing by not telling the program it is being piped in the first place.
Is this possible? What is a universal method of piping the output of a program, while making the program think it is printing to the console and produce the same output that it would have without the pipe?

If the answer depends on the shell, I am interested in the following shells:

bash since it is the de facto standard
zsh since it is a common bash-compatible upgrade
fish since it is an example of attempting to improve on bash without compatibility

Based on https://askubuntu.com/a/482826 it seems like the problem is that isatty is false when the program is piped. So the solution could be somehow piping the command with isatty still being true. I don't see how I could actually accomplish this, though.
Comment: https://superuser.com/q/1603249/432690
Answer: Not sure if this is a good solution, but based on https://stackoverflow.com/questions/4233808/piping-data-to-linux-program-which-expects-a-tty-terminal it seems like unbuffer accomplishes this.
unbuffer exa | less will show colors.


Prove that $\sum_{i=2}^n \binom{n}{i} \binom{i}{2} = 2^{(n - 3)} \cdot n(n - 1)$

Question: When attempting to solve an asymptotic complexity problem, i got this summation
$$\sum_{i=2}^n \binom{n}{i} \binom{i}{2}$$
Wolfram Alpha states that it equals to
$$2^{(n - 3)} \cdot n(n - 1)$$
But I can't find how, and Wolfram is unable to produce the step-by-step solution.
Comment: It has been asked here already also (looks bit differently and there is an typo in title but its the same)  https://math.stackexchange.com/questions/1627311/showing-sum-k-2n-binomk2-binomnk-binomn2-2n-without-in.
Comment: Sorry for not finding that one before asking. Thx for the tip.
Answer: Consider
$$(1+x)^n=\sum_{i=0}^n\binom{n}ix^i.$$
Differentiate twice:
$$n(n-1)(1+x)^{n-2}=\sum_{i=2}^n\binom{n}ii(i-1)x^i.$$
Now set $x=1$.
Comment: Is differentiating twice meaning to find $f''(x)$ if $f(x) = (1 + x)^n?$ Basically finding the second derivative? I'm just trying to get used to the terminology
Answer: This has nice combinatorical solution. Ask yourself on how many ways we can choose a set of pepople and then among them president and vice president.
Answer: $$\sum_{i=2}^n\binom ni\binom i2=\sum_{i=2}^n\binom n2\binom{n-2}{i-2}=\binom n2\sum_{i=2}^n\binom{n-2}{i-2}=\binom n2\sum_{j=0}^{n-2}\binom{n-2}j=\binom n22^{n-2}=n(n-1)2^{n-3}$$
Answer: Your expression is the value $f(1)$ of
$$f(x):=\sum_{i=2}^n \binom{n}{i} \dfrac{i(i-1)}{2}x^{i}=\dfrac12 x^2\underbrace{\sum_{i=0}^{n} \binom{n}{i} \dfrac{i(i-1)}{2}x^{i-2}}_{g(x)}$$
But $g(x)$ can be given another expression because it is the second derivative of $(1+x)^{n}$, i.e., $g(x)=(n)(n-1)(1+x)^{n-2}$.
It suffices now to set $x=1$ to obtain your result.


Does hitting green on stroke 1 also count as fairway hit?

Question: When or if I hit the green on par 4 on my first stroke, does that count as fairway hit aswell or do I simply just remove that hole from my stat card (regarding fairwayhits)?
Comment: Well if you hit the green, I'd assume you would have hit a fairway to get there.  Or are you talking, if you hit the green on your first shot of a par 4?  At that point, I Believe, it's simply a green in regulation, and no fairway is counted, basically as if the fairway never existed.
Comment: @New-To-It Yes, I'm talking about hitting the green on the first shot on a pair 4. You have any source on that? I been googling and searching and I found a lot of different answers. For example, how do they handle it on the PGA tour?
Answer: Statistics are not always based on the rules of the game, so any answer you get really depends on the interpretation of the individual keeping the statistic or the system used to measure the statistic.
The PGA Tour counts hitting the green from your tee-shot as a Fairway hit. Reference the bottom of the table on the below link you will see:

The percentage of time a shot comes to rest on the fairway or the green.

Hit Fairway Statistics PGA Tour 2017
However, the Chart Golf Stats website claims it counts as a 'no-score':

Note: on par 3 holes, where you are meant to hit the green with your tee shot, you do not record fairways hit, instead recording no-score.

Similarly, My Scorecard also states that hitting the green from the tee does not count as a fairway hit...

This statistic refers to the number of times during the round your drive landed in the fairway (the fairway, not the light rough). It is similar to the greens in regulation, except that the maximum number per round is less than 18. This is due to the fact that you are supposed to drive the green on a par 3, and as a result we don't count those holes for the fairways statistic.

EDIT:
My interpretation of the statistic sites is that, on a Par 4, hitting the green WILL count, while on a Par 3 it won't count. However, the statistic is not relevant on a Par 3 as you are not intended to hit the fairway at all, therefore hitting the fairway on a Par 3 is actually a bad thing and should be considered a negative statistic.
In short, hitting the green on a Par 4 should count as a fairway hit and a green in regulation.
My advice is to follow the local rules. If your golf club has a statistic system they follow then ask them, if they don't then choose a system and follow their rules.
Comment: I was primarly intrested in the PGA Tour way of handling the statistic and since you anser it perfectly will I will accept your answer. :)
Comment: Neither Chart Golf Stats nor My Scorecard mentions driving the green on a par 4, which is what this question is about.
Comment: This is true. My interpretation of the statistic sites is that, on a Par 4, hitting the green WILL count while on a Par 3 it wont but the statistic is not relevant on a Par 3 as you are not intended to hit the fairway at all, therefore hitting the fairway on a Par 3 is actually a bad thing and should be considered a negative statistic.
I will update my answer to include this assumption.


Manwha in which the female lead dies and comes back after being stabbed

Question: I'm searching for a manhwa in which the female lead (FL) dies and comes back after being stabbed. She has red eyes and her hair looks kinda purple/blue. She has a blonde/ginger sister that is obsessed with family reputation; I think the sister's name is Viat. If I remember correctly, the FL absorbs some sort of red magical stone power and pretends to be clueless to the family, while gathering information. I forgot the name, so if any of you could help I would be very grateful. :)
Comment: Yes! This is it! Thank you, i mistook the eye/hair colors but you still helped me, thank you so much :)
Comment: If the answer below is correct, please consider marking it as [accepted](https://scifi.stackexchange.com/help/accepted-answer), which you can do by clicking on the check mark beneath the voting buttons.
Answer: I believe this is I'm the Master of this Life.
From Anime-Planet:

The guardian stone of the family appeared to me. To me, the illegitimate child, not my half-sister who is the enemy. Since then, the treatment of me has changed. It really felt like that I'm part of their family. However, as I died, I realized that it was all an illusion at the hands of my fiancée. That everything he did for me was a scheme by my half-sister to take the guardian stone. [Don't you want to take revenge on those who thoroughly deceived and killed you?] I decided to accept the devilishly sweet offer. This time, I will definitely get the guardian stone and become the head of the household. I will give you back as much or more than what you suffered. Until then, no one will believe. But... The image of him trying to save me, his eyes running in despair, couldn't be erased from my mind. The fiance I loved is looking at me as I am dying, but why are you running to me with those eyes, who you thought was her sister's person.

The female lead, Helna, is stabbed to death in the first chapter, and then wakes up in the past as her younger self. She has purple eyes and blue hair. She has a half-sister with reddish blonde hair, whose name is alternately spelled Viatte or Viat in different chapters. There's also a red magic stone involved in the story.


Two iTunes accounts on one iPad

Question: I have two iTunes accounts. One for company usage second - for personal needs. Both of these accounts are with separate credit card numbers (company cc an personal one). I would like to have applications that was bought on these accounts to be on one device (iPad/iPhone). Is it possible to manage in this way?
Answer: Yes, You will be prompted to input the correct username and password for each new entry, Should be no problem at all :)
Just remember to log out with your personal/company account when buying new software and login with the correct account for the CC
Answer: well unfortunately its not an easy thing, it requires you to sign off and sign in your different accounts each time! and its a headache. my recommendation is, prioritize the one you use most, and try to stick to that one, sense updates can be made from both accounts but installing new apps and purchases require password from the latest used account!
(if you are using iTunes match with either account, then throw in your towel)
good luck!

Two iTunes accounts on one iPad


Using both fixed effects and random effects in r metafor package

Question: Hi there :) I am trying to run a meta analysis using rma.uni in the metafor package in r but cannot work out how to add both fixed effects (eg bird migration status) and random effects (eg species, habitat type etc.) in the same model, is this possible to do this or would I need to use a different package? Thank you!
Answer: The rma.uni() function doesn't allow you to add random effects (beyond the estimate-level random effects that are automatically added). You should look into the rma.mv() function, which provides full control over the random effects that can added. See here for the documentation of the function:
https://wviechtb.github.io/metafor/reference/rma.mv.html
and the links therein for examples.


When updating a subkey's expiration date, do old backups of my private master key become invalid?

Question: In GnuPG I have a master key that doesn't expire, with separate subkeys with one year expiration time for encryption, authentication, and signing. If I update the expiration dates of my subkeys, will I need to make new backup copies of my private master key?
Answer: The expiration date of subkeys is stored in a special kind of signature issued by the primary master key on the subkey. With other words, if you change the expiration date, no private keys are changed at all. If you can restore the public key later (for example, fetching it from the key server network), you're fine.
Comment: Thanks! I read somewhere that private keys also contain full copies of public keys (and subkeys). Would there be conflicts if I tried to import my backup private key into a keyring where I already held the updated versions of my public subkeys? I tried doing it and it did not complain.
Comment: The private keys have the public key information attached, that's right. But the settings packets have a creation timestamp attached, so the newer ones (from key servers, ...) will overrule the old ones from the backup. Anyway, as long as you have the private primary key, you could easily extend the expiration period again.
Comment: Makes sense, thanks. For completeness's sake, does the same apply to editing/adding/removing UIDs, photo IDs, signatures, etc?
Comment: Everything included in the public key is available this way. Obviously, you still need the private keys for private key operations (the private primary key for key management, the private encryption subkeys for decryption of encrypted messages, signing subkeys are only required for signatures and can be recreated arbitrarily).


Why can I boot Xubuntu 12.04 from usb on one computer but not the other?

Question: When I boot Xubuntu from a flash drive on the old Dell computer mentioned in the about me screen it works fine, but when I try to boot it on another computer (the computer I'm typing this text on) it says "boot errror" and I have to manually shut it down. When I take out the flash drive, it boots windows xp fine. Please help! By the way, I haven't tried booting any other OSes from usb on this computer.
Comment: I've never had a computer refuse to run Ubuntu **except for one with an unsupported video card.** That's where I'd start looking. If you could post the video in this machine, or even the manufacturer and model, there are lots of people who can help you.
Comment: The computer that would run it is the one in the description of my profile and the one that wouldn't run it is a Dell Inspiron 530 with a 2.4 GHz Intel core 2 quad, 3 GB of RAM, and windows xp
Answer: OK, this isn't my idea, but here's what I've found via Google:
Dell Inspiron 530 and 545 Ubuntu 13.04 Live DVD won't Run
Having spent all morning solving this problem, I thought I'd share the solution in case it helps someone else out there...
Problem:
Inspiron 530 and 545 PCs won't boot Ubuntu 13.04 live DVD. Boot error message shows. DVD works fine on other PCs
Attempted Solution:
Use USB image. USB stick works on other PCs, not on the Dells
Actual Solution:
1) Burn plop boatloader onto a CD http://www.plop.at/en/bootmanager/index.html
2) Make USB image of 13.04
3) Run plop from CD
4) Choose USB and boot into 13.04


Do I Have Too Many Characters?

Question: I have been working on a story for the past several months. Basically, it is about a group of orphaned girls whose parents were all part of a secret organization unbeknownst to them. I know, I know, sounds pretty boring and stuff, but I'm fixing it up, okay? I haven't actually started writing it, but one thing has been really nagging me. Do I have too many characters?
There are 13 girls (well, one of them dies so...), a friend, their three caretakers, the evil lady, and the leader of the organization. They are the main/important characters (19 of them). Then there are the organization members and the evil people (idk how many of them yet). They are all like background people. Is it too much? This is all in like the first book. Yes, all the orphans play important roles, and yes, I've grown emotionally attached to all of them. I suppose I could introduce some orphans later on, but I really don't want to. Rick Riordan and J.K. Rowling got away with it alongside several other authors, but I don't know how memorable and distinct my characters are.
Comment: What point of view are you using? Do all of those 19+ characters have POV chapters?
Comment: You say "a story."I'm assuming you mean a novel. You also say you've been working on it for several months, which is no time at all for a novel. As you write the novel, you may find yourself up against numerous problems that emerge from using this many "main" characters (if that's what they are). Until you start unfolding the story, you can't determine if the difficulties are so great as to make writing the envisioned story impossible. It may be that you have the genius to pull it off, so that the rule-of-thumb advice of reducing the characters doesn't apply.
Comment: Two things - maybe having all girls would be difficult to read. And make sure their names aren't similar because that could also get confusing.
Answer: As with many things in writing there's no hard and fast rule on this - it is going to hinge on factors such as how big the book is, and even your intended audience.
Without reading your book it's hard to give a definitive answer as to whether you have too many - although my gut reaction is that 19 main characters is a lot. But the flipside is are they all really "main" characters?
You mentioned J.K. Rowling as an example as someone who had previous had a large number of characters - and you're correct in that the cast of characters for the Harry Potter series was extensive, but there were really only three "main" characters. As important as the roles were played by the other students, parents, teachers etc. were in the story. They were essentially supporting characters and if we look at what you've listed as "main":

their three caretakers

Sound like supporting characters to me.

the evil lady

Presumably the antagonist? Not a conventional main character IMO - as benficial to a story as well fleshed-out villain maybe they still are primarily there to drive the conflict and story for the main characters. Think of them as being a freebie in your main character count.

the leader of the organization

Supporting character.
So what does this leave us with?

13 girls (well, one of them dies so...), a friend

Hmm.. it's still alot. You're asking the reader to not only keep track of all fourteen but also, presumably to care about all fourteen. That's a big ask - and if you're determined that these fourteen share equal billing as main characters you're going to have to give them all worthwhile character arcs, individually - because if more than one of them has essentially the same arc then they are essentially telling the same story. And that makes them kind of pointless.

I suppose I could introduce some orphans later on, but I really don't want to.

Could you introduce them all at the start and then shift focus between subsets of them as you tell further stories in the same world? There's nothing wrong with a character having a minor role in an initial book and being subsequently promoted to be a main character in a subsequent one.

all the orphans play important roles

While I don't doubt this, as mentioned earlier, playing an important role does not always mean that they are a main character. So think about what their roles are and how much of the story they actually need to be around for in order to fulfill that role.
Sticking with Harry Potter since I presume you're familiar with it Hagrid plays an important role in the first book, introducing Harry (and thus the audience) to the key concepts of the wizarding world and providing the main characters with information that is key to their success in the main events of the book. But he's not a main character, he's not along with them for their adventures. He pops up, moves the plot forward where required and then drops out again, and this is all perfectly normal.

I've grown emotionally attached to all of them.

I'm a big believer that having some level of emotional investment in your characters is a good thing - after all how can an author expect a reader to care about a character if they don't?
But you have to be careful not to let that investment become simple sentimentality, because then it risks getting in the way of the story being the best it can be. Don't be afraid to change characters, merge them or even cut them entirely. Sometimes you can have an absolutely awesome character but if they don't fit in the story they can make it worse, don't worry they aren't gone - one day you might find you've got the story that's perfect for them and you can pull them off the metaphorical bench.
Comment: Sorry, I was a really tired when I first asked the question. I just realized how stupid some parts sound. So, you're right. I meant the orphan girls appear in the book most often, but most of them are indeed supporting characters. Only about five of them are actually main characters. Thank you!

Do I Have Too Many Characters?


installation of vmadditions.iso on virtual pc 2007

Question: i could not install the additions from the iso file there seems to be a problem in mounting the file from the console.if you start the virtual machine and use the action tab to install or update the vitual machine additions it captures the iso file but then nothing happens. if you look under the cd tab the iso file shows as captured but you can do noting with it. i am using windows 7 pro 64 bit
Answer: Try mounting the ISO image on the host OS using something like Daemon Tools then copying the files off the image, or extracting the files from the ISO image with WinRar
You could then copy the files through the network to the guest if that's working, or through some form of shared folder system - not sure what VPC has.


Difference between the Rectangular "Window" Function and the Rectangle Function

Question: I'm getting ahead in my differential equations textbook (Fundamentals of Differential Equations by Nagle et. al) and in the chapter of Laplace Transforms it states that the rectangular window function $\Pi_{a,b}\left(t\right)$ is given by
\begin{align}
\Pi_{a,b}\left(t\right):=u\left(t-a\right)-u\left(t-b\right)=\begin{cases}
0, & t<a, \\
1, & a<t<b, \\
0, & b <t.
\end{cases}
\end{align}
However, in another textbook I'm reading about Fourier Transforms (which I ATM know very little about, just the basics since I just got it, Fourier Transforms: an introduction for Engineers by Gray et. al.) they've stated that the rectangle function, a variation of the box function, considered by Bracewell (in The Fourier Transform and its applications, 1965) is given by
\begin{align}\Pi\left(t\right)=
\begin{cases}
1, & \left|t\right|<\frac{1}{2}, \\
\frac{1}{2}, & \left|t\right|=\frac{1}{2}, \\
0, & \text{otherwise}.
\end{cases}
\end{align}
Why are they so different yet have such similar names?
Answer: With Fourier transforms and sampled band-limited signals the concept of a Dirac delta function and the Dirac comb sometimes comes up. They are zero everywhere else but at certain points. The integral over each of such special point equals one. Sometimes you need to multiply a Dirac comb by a rectangular function. If either of the edges coincides with a Dirac delta, then it matters what the value of the rectangular function is exactly at the edge. The multiplication results in scaling of the Dirac delta (and its integral) by that value. Setting the edge values to $\frac{1}{2}$ may give the most meaningful result, see: Whittaker-Shannon ($\operatorname{sinc}$) interpolation for a finite number of samples.
Where the rectangle ends is a matter of convention. It is better to define the rectangle function for the reader if you ever happen to use it.
Answer: Other than the value of $1/2$ on the edges, they're not different, just different notation. I don't know the motivation for the $1/2$'s, since it's still discontinuous, but they presumably explain why in the text. If we use the second notation, then the first definition (ignoring the $1/2$'s) is just
$$
\Pi \left( { t - (a+b)/2) } \over { a-b }     \right).
$$


Combining surfaces in 3D when using ClipPlanes

Question: Background: I work in the upper half-space interpreted as the model of the hyperbolic space. I want to draw a number of hyperbolic polygons (for simplicity, triangles) having vertices on the boundary. In practice, this means two types of shapes:

(a) triangle with all three vertices in the $xy$ plane, which is part of a sphere such that its center is in the $xy$ plane and it passes through these three vertices (for simplicity, they are always given in the counterclockwise order), which is bounded by the three vertical planes passing through each pair of vertices (triangle);
(b) triangle with two vertices in the $xy$ plane and one vertex at the infinity, which is a vertical rectangle (sic) of some fixed height with two specified vertices (for simplicity, having both $x$ and $y$ coordinates different from each other) with a half-disk cut from it (the center of the disk is the midpoint between the vertices, and the circle bounding the disk passes through them) (triangleInf).

I am only interested in the case when the projections of all triangles of type (a) onto the $xy$ plane do not intersect each other and together tessellate a certain connected polygon on the plane, and the projections of the triangles of type (b) are the sides of that polygon (which is not the case for the example below).
I implemented the functions which construct these shapes as shown below. One function uses Graphics3D[Sphere[...], ClipPlanes -> ...] and the other uses ContourPlot3D[..., RegionFunction -> ...], but this difference doesn't seem to be relevant to the question. Also, I believe I can implement triangleInf using only Polygon by discretizing the boundary. But implementing triangle without ClipPlanes seems much more tricky.
So I made this:
height = 1.5;
triangleInf[{v1_, v2_}] :=
  Module[{u1 = {Sequence @@ v1, 0}, u2 = {Sequence @@ v2, 0}, c, r2, xx = First /@ {v1, v2}, yy = Last /@ {v1, v2}},
   c = (u1 + u2)/2; r2 = SquaredEuclideanDistance[u1, c];
   ContourPlot3D[({x, y} - v2).Cross[v1 - v2] == 0, {x, Min@xx, Max@xx}, {y, Min@yy, Max@yy}, {z, 0, height},
    RegionFunction -> (SquaredEuclideanDistance[{#1, #2, #3}, c] > r2 &), RegionBoundaryStyle -> None, Mesh -> None, BoxRatios -> Automatic]
   ];
planes[{v1_, v2_, v3_}] := Append[InfinitePlane /@ {{v1, v2, v2 + {0, 0, 1}}, {v2, v3, v3 + {0, 0, 1}}, {v3, v1, v1 + {0, 0, 1}}}, InfinitePlane[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}]];
triangle[vertices_] := Module[{cx, cy, r},
   {{cx, cy}, r} = List @@ CircleThrough[vertices];
   Graphics3D[Sphere[{cx, cy, 0}, r],
    ClipPlanes -> planes[{Sequence @@ #, 0} & /@ vertices]]
   ];
tf = triangle[{{0, 0}, {1, 1}, {1, 0}}]
tf2 = triangle[{{0, 0}, {1, 0}, {1, -1}}]
ti = triangleInf[{{1/2, 1/2}, {-1, -1}}]
Show[tf, tf2, ti, Axes -> True, AxesLabel -> {"x", "y", "z"},
 PlotRange -> {{-1, 1}, {-1, 1}, {0, 2}}]

Each function on its own does what I want. However I want all these shapes to be shown together. And when I combine them using Show, the ClipPlanes option seems to be inherited from the first graphics3d object, and I don't know how to prevent it.
How do I combine multiple plots which use ClipPlanes?
Or, possibly I can work around this issue by implementing triangle without ClipPlanes?
Answer: Put the ClipPlanes before the object Sphere.
{ClipPlanes -> planes[{Sequence @@ #, 0} & /@ vertices],
 Sphere[{cx, cy, 0}, r]}

That is
Clear[triangle];
triangle[vertices_] :=
  Module[{cx, cy, r}, {{cx, cy}, r} =
    List @@ CircleThrough[vertices];
   Graphics3D[{ClipPlanes -> planes[{Sequence @@ #, 0} & /@ vertices],
      Sphere[{cx, cy, 0}, r]}]];
tf = triangle[{{0, 0}, {1, 1}, {1, 0}}];
tf2 = triangle[{{0, 0}, {1, 0}, {1, -1}}];
ti = triangleInf[{{1/2, 1/2}, {-1, -1}}];
result =
  Show[tf, tf2, ti, Axes -> True, AxesLabel -> {"x", "y", "z"},
   PlotRange -> {{-1, 1}, {-1, 1}, {0, 2}}]

Compare with the tf,tf2,ti and the final result.

GraphicsGrid[{{tf, tf2}, {ti, result}}]


Unit of measure for $t$ in Exponential Growth Formula

Question: In the exponential growth formula, $N = N(0)e^{kt}$, I know that $t$ is for time, but what is the unit of measure?  Years?  Months?  Days?  Hours?
Comment: Inside the exponential, that should be dimensionless.  So if you want $t$ to be in sec, then $k$ should be in 1/sec.
Comment: Depends on the problem, but generally $t$ is dimensionless in the general formula: $N = N_0e^{kt}$.
Answer: $$\frac{dN}{dt} = kN$$
That is, the rate of the growth of the population is directly proportional to the number at that instant.
The units of k will determine the units for t.
When solved for N,
$$\frac{dN}{N} = k.dt$$
$$\int_{N_0}^N\frac{dN}{N} = \int_0^t k.dt$$
$$\ln \frac{N}{N_0} = kt$$
$$N = N_0.e^{kt}$$


Panel Bar deleted in Linux Mint Gloria

Question: I'm new with linux and by accident I deleted my panel, because it was kinda messed up, and I thought if I deleted it, I would get later another option to put it back, well no! And now I have no access to anything more than I had as a shortcut on my desktop which is dolphin firefox, and the trash. Is there any way to restore the bar without reinstalling the whole OS? I'm sure there's gotta be...Thank you!
Answer: I assume you're using KDE by the Dolphin reference, so you can:

Press Alt + F2 to open the Run Application dialog
Enter dcop kicker kicker restart and run it

If you're referring to gnome-panel however, you can restore it like so:

Press Alt + F2 to open the Run Application dialog
Select the terminal from the list and run it
In terminal enter these 3 commands (each followed by Enter)

gconftool-2 --shutdown
rm -rf ~/.gconf/apps/panel
pkill gnome-panel
Comment: Press Alt+f2 and open terminal then type reboot.
Comment: Thank you guys! for you prompt answer! but it's still not working! And in the case that I had to reboot, how could I do that? coz...I got no 'start' bar, if I may...
Answer: You can try this, it works for ubuntu, should be the same for any gnome install. Press alt+F2 to open the run bar and the type in terminal to open gnome-terminal. You can then type in each of these commands.
gconftool-2 --shutdown
rm -rf ~/.gconf/apps/panel
pkill gnome-panel

Comment: Thank you guys! for you prompt answer! but it's still not working! And in the case that I had to reboot, how could I do that? coz...I got no 'start' bar, if I may...
Comment: You can reboot buy typing the following in the terminal

    shutdown -r now

You could try just running

    gnome-panel &

Which should start up a panel, I don't run gnome anymore, but I believe you could also try running gnome-control-center or gnome-system-settings and see if you can get to a panel configuration screen from there
Comment: Thank you! But I'm afraid something's missing. I'm runnign KDE, it says in the booting menu. When I try 'gnome-panel &' it's like it's not even accepting the command, coz... it's just stays the same (the terminal I mean) it won't even go away like with the other commands you said in you first comment. Any idea why?
Comment: hey! when I tried to add a widget form the gnome symbol on the upper right corner and wanted to add the kget panel applet, I got an error saying 'could not find requested component: kgetpanelbar' so that probably has something to do with not being able to restore the panel bar! Don't you think?
Comment: I apologize - I missed that you are running KDE. If you right click the desktop, do you get an option menu to appear? In my menu I have the option to Add Panel ?

Panel Bar deleted in Linux Mint Gloria


Issue with Power Apps and Attachments

Question: Question for everyone. I'm new to Power Apps and want to verify an attachment has been uploaded but I'm not able to grab the name or count the rows in the attachment control. I have attempted to use the onAddFile option with a formula that assigns the name to a variable and attempted to use the CountRows function and assign that number to a variable. Any help would be appreciated.
Answer: You can both get names of the attachment and the number of attachments with these formulas:
Here you set a variable that counts the attachments. My attachment field is the datacardvalue28, that might differ in your form. You can then use that variable to validate that there is in fact some documents uploaded.
Set(varNumAttachments, CountRows(DataCardValue28.Attachments));

This formula take each file name and put them into a collection you can use verify filetype, names etc. are up to standard in your scenario.
ForAll(DataCardValue28.Attachments,Collect(col_Attachments,{fileName: Name}));

Hope it works :)

Issue with Power Apps and Attachments


Fields finitely generated as $\mathbb Z$-algebras are finite?

Question: Suppose $k$ is a field that is finitely generated as a ${\mathbb Z}$-algebra.  (That is, $k$ is a quotient of ${\mathbb Z}[X_1,\dots,X_n]$ for some $n$). Does it follow that $k$ is finite?
Comment: A quick glance at [another post](http://math.stackexchange.com/questions/56916/what-do-prime-ideals-in-kx-y-look-like) makes me think you should be able to first show that $K$ is of prime characteristic. Perhaps once that's established, you can determine the degree of $K$ over its prime subfield is finite?
Answer: Yes!
Consider the morphism
$f:\mathbb Z\to k$ and the ideal $\mathfrak m=f^{-1}(0)\subset \mathbb Z$.
Since $\mathbb Z$ is a Jacobson ring and $(0)\subset k$ is maximal,   $\mathfrak m$ is maximal too and we obtain a morphism $\bar f:\mathbb F_p\to k$.
Since $k$ is finitely generated over $\mathbb F_p$ and is a field, it is actually a finite extension ("Zariski's version of the Nullstellensatz") and thus  $k$ is (set-theoretically!) finite.
Edit
Considering the  comments below , I had better state explicitly the theorem I have used.
Theorem
 Let $f:A\to B$ be a finitely generated $A$-algebra.
If $A$ is a Jacobson ring, , then $B$ is also Jacobson and for every maximal ideal $\mathfrak m\subset B$ the ideal $f^{-1}(\mathfrak m)\subset A$ is also maximal.
New Edit
Here is a proof in the style of algebraic geometry, due to Akaki Tikaradze.
If $k$ has characteristic $p$ we conclude as above, using  Zariski.
If $\operatorname{char}k=0$, the morphism $f:\mathbb Z\to k \:$ is injective, so $A$ has no $\mathbb Z$-torsion and is thus $\mathbb Z$-flat.
But then $\operatorname{Spec}(k)\to\operatorname{Spec}(\mathbb Z)$ is open (flat+finite presentation $\implies$ open), i.e. $(0)\in\operatorname{Spec}(\mathbb Z)$ is open. Contradiction.
(This proof is absurdly sophisticated but it will probably appeal to scheme-theory addicts.
Take it as some kind of joke...)
Comment: Georges:  My apologies....I thought this made perfect sense this morning but now I suddenly don't see it anymore.  ${\mathbb Q}$ is also a Jacobson ring, but the inverse image of (0) under the map ${\mathbb Z}\rightarrow {\mathbb Q}$ is not a maximal ideal.  What additional property are you using?
Comment: Dear Will, I'm using that $k$ is finitely generated over $\mathbb Z$ (and that $\mathbb Z $ is Jacobson).This is crucial as your counterexample correctly shows. An online reference is De Jong and collaborators' *Stack Project*, [Chapter 7: *Commutative Algebra*, Proposition 32.18 ](http://www.math.columbia.edu/algebraic_geometry/stacks-git/algebra.pdf)
Comment: Another reference is the generalization of the nullstellensatz stated here: http://en.wikipedia.org/wiki/Nullstellensatz .
Comment: Georges:  Yes, as I said, I understood this the first time, but somehow when I reread it late at night I lost track of the main point.  I remember why it made sense now!  Thanks for being patient with me.
Comment: PS:  You wrote "Since "k" is a Jacobson ring" but  I think you meant "Since ${\mathbb Z}$ is a Jacobson ring"; I think you need this to apply the Nullstellensatz.
Comment: Dear Will, I have written an edit which, I hope, will definitively clarify these matters.
Answer: In case you are interested, here is a proof which also uses Zariski's lemma but no difficult theorems about Jacobson rings.
Write $R$ for the image of the unique ring homomorphism $\mathbb{Z} \to k$, so that $k$ is a finitely generated $R$-algebra and hence a finite extension of the fraction field of $R$ by Zariski's lemma. Thus it suffices to show that $R = \mathbb{F}_p$, which is to say $k$ has positive characteristic. If $R = \mathbb{Z}$, meaning $k$ has characteristic zero, then $k$ is a number field which is a finitely generated ring. But this is impossible: if we write $k = \mathbb{Z}[\alpha_1,\dots,\alpha_r]$, then one can choose $n \in \mathbb{Z}$ so that all the denominators of coefficients in the minimal polynomials over $\mathbb{Q}$ of $\alpha_1,\dots,\alpha_r$ divide $n$. This implies that $k$ is integral over $\mathbb{Z}[1/n]$. Then $\mathbb{Z}[1/n]$ must be a field, which is absurd.
Answer: This is a mild generalization of Justin Campbell's answer, and the proof is almost the same as that of Proposition 7.8 in Atiyah and MacDonald's Introduction to Commutative Algebra. (This proposition is sometimes called the Artin-Tate Lemma.) The notation has been designed to make the analogy as clear as possible.

Let $A\subset B\subset C$ be a tower of domains such that $B$ is the field of fractions of $A$, and $C$ is a field which is finitely generated as an $A$-algebra. Then (a) $C$ is a finite extension of $B$, and (b) $B$ is a finitely generated $A$-algebra.

As (a) results immediately from Zariski's Lemma, it suffices to prove (b). The following statement is ironically stronger and easier to prove than (b):

Assume that $C=A[x_1,\dots,x_m]$; that $y_1,\dots,y_n$ is a $B$-basis of $C$ with $y_1=1$; and that we have $$x_i=\sum_jb_{ij}y_j,\quad y_iy_j=\sum_kb_{ijk}y_k$$ with $b_{ij}$, $b_{ijk}$ in $B$. Then the $A$-algebra $B$ is generated by the $b_{ij}$ and the $b_{ijk}$.

The proof is straightforward, and left to the reader.
Answer: When I read the proofs suggested in the answers half a year ago, I had the problem that I did not understand them because of a lack of algebra-knowledge. That's why I would like to share a (quite detailed) proof of the theorem which I finally understood:
I will use Zariski's Lemma: Let $\mathbb{K}$ be a field and $A$ be a finitely generated $\mathbb{K}$-algebra. If $A$ is a field, then it is a finite degree extension of $\mathbb{K}$.
Now the proof: There exist elements $a_1,...,a_n$ such that $R \cong \mathbb{Z} [a_1,...,a_n]$. In order to simplify our notation we may assume that $R = \mathbb{Z} [a_1,...,a_n]$. Why? - If $\phi \colon R \to \mathbb{Z} [a_1,...,a_n]$ is the isomorphism (that means $\phi(\frak{m}) \subseteq \mathbb{Z} [a_1,...,a_n]$ is a maximal ideal) and $\pi \colon \mathbb{Z} [a_1,...,a_n] \to \mathbb{Z} [a_1,...,a_n]/(\phi(\frak{m}))$ denotes the canonical projection, then $\pi \circ \phi \colon R \to \mathbb{Z} [a_1,...,a_n]/(\phi(\frak{m}))$ is a surjective ring homomorphism with $\ker(\pi \circ \phi) = \frak{m}$. Hence the fundamental homomorphism theorem tells us that $R/\frak{m} \cong \mathbb{Z} [a_1,...,a_n]/(\phi(\frak{m}))$. So the ring of the left side is a finite field iff the ring on the right side is a finite field.
Let $i$ be the only possible ring homomorphism $i \colon \mathbb{Z} \to R/ \frak{m}$ and let $S := i( \mathbb{Z}) = \{z + m \mid z \in \mathbb{Z} \}$. Note that "$S$" is a ring. Since $\mathbb{Z}[a_1,...,a_n] = \{ f(a_1,...,a_n) \mid f \in \mathbb{Z}[x_1,...,x_n] \}$, it is easy to see that $R/\frak{m} = \mathbb{Z}[a_1,...,a_n] / \frak{m} =$ $S[\bar a_1, ..., \bar a_n]$, where $\bar a_i = a_i + \frak{m}$, is a finitely generated $S$-algebra, hence a finite degree extension of the quotient field of $S$ (according to Zariski's lemma).
Let's assume that $i$ is injective $\Longleftrightarrow \mathbb{Z} = S$.
Thus $R/ \frak{m}$ is a finite degree extension of $\mathbb{Q}$. From this we conclude that the elements $\bar a_1,..., \bar a_n$ with $R/ \mathfrak{m} = \mathbb{Z}[\bar a_1,..., \bar a_n]$ are algebraic over $\mathbb{Q}$ which means that they are zeros of certain monic polynomials with coefficients in $\mathbb{Q}$. Now let $k$ be the product of the denominators of the coefficients of the minimal polynomials of the $\bar a_i$ over $\mathbb{Q}$. As a consequence, the coefficients of the minimal polynomials can be considered as elements of $\mathbb{Z}[ \frac{1}{k}]$, hence the $\bar a_i$ are integral over $\mathbb{Z}[ \frac{1}{k}]$ and so the whole $R/ \mathfrak{m}$ is integral over $\mathbb{Z}[ \frac{1}{k}]$.
Let $a \in \mathbb{Z}[ \frac{1}{k}], a \neq 0$ arbitrary, thus $a \in \mathbb{Q} \subseteq R/ \frak{m}$. Since $R/ \frak{m}$ is (a field and) integral over $\mathbb{Z}[ \frac{1}{k}]$, there exist $m \in \mathbb{N}, c_0,...,c_{m-1} \in \mathbb{Z}[ \frac{1}{k}]$ such that
$$a^{-m} + c_{m-1} a^{-(m-1)}+\cdots+c_0 = 0,$$ and thus
$$a^{-1}=-(c_{n-1}+\cdots+c_0 a^{m-1}) \in \mathbb{Z}[ \frac{1}{k}].$$
Hence $\mathbb{Z}[ \frac{1}{k}]$ is a field, but that's a contradiction, since any prime number $q$, which does not divide $k$, cannot be invertible in $\mathbb{Z}[ \frac{1}{k}]$, because there is no element like $\frac{1}{q}$. So $i$ cannot be injective.
Thus there exists a $p \in \mathbb{N}$ prime such that $S = \mathbb{Z}/ p \mathbb{Z}$, hence $S$ is a finite field. From above we conclude that $R/ \frak{m}$ is a finite degree extension of a finite field, thus a finite field. $\Box$


Why is this ring semisimple?

Question: Let $R$ be a simple ring (i.e. a ring with no nontrivial two-sided ideals) which contains a left ideal which is simple as a left $R$-module. How can I prove that $R$ is semisimple?
Comment: @Geoff Robinson Not every simple ring is semisimple, the ones that are seki-simple, are necessarily, by Artin-Wedderburn, isomorphic to a matrix ring over a division ring.
Answer: You can look at the sum of all simple submodules (i.e. all simple left ideals) isomorphic to that given simple submodule of $_RR$... this turns out to be a (two-sided) ideal of $R$, irrespective of what kind of ring $R$ is. However, if $R$ is simple you don't have a choice. Then $_RR$ is a sum of simple submodules (i.e. simple left ideals), thus a direct (why?) sum of simple left ideals, thus a finite (why?) direct sum of simple left ideals all isomorphic to the simple left ideal you started with .
You have a division ring at hand, the endomorphisms of that simple left submodule you started with. You finish off by saying $R$ is the ring of endomorphisms of $_RR$ (acting from the right) and this ring is also a matrix ring because of the previously mentioned direct sum decomposition of $_RR$ into a finite number of simple left ideals all isomorphic to the first one. This finishes the proof, and shows that all (left) artinian simple rings are matrix rings over some division ring.
This is very well explained in Lam's book A First Course in Noncommutative Rings.
Comment: I didn 't undestand what is $_RR$, could you explain it, please?
Comment: It's how you call the canonical left $R$-module structure on $R$. In other words, $_RR$ is the left $R$ module on the abelian group $M=(R,+)$ where for all $r\in R, m\in M,~r.m=r\times m$. Here "$.$" defines the left $R$-module structure on $M$, and "$\times$" is the ring product of $R$.
Comment: Let's see if I understood: let $I$ be the simple left ideal. Define $J:=\sum_{I_i\cong I} I_i$ (where the sum is over the left ideals isomorphic to $I$). Then $J=R$ and so $R=I_1\oplus\cdots\oplus I_n$ where $I_j\cong I$. This is enough to say that $R$ is semisimple, right? I don't understand your discussion in the second paragraph.
Comment: That's it. You then say some thing like $\mathrm{End}(_RR)\simeq R^{op}$ where for any $x\in R$, you define the endomorphism $\rho_x$ of the left $R$ module $_RR$ by $\rho_x(r):=r\times x$. Thus $R^{op}\simeq \mathrm{End}_R(R)\simeq \mathrm{End}_R(\oplus^n I)\simeq\mathrm{Mat}_n(\mathrm{End}_R(I))$. but the ring of endomorphisms of $I$ is a division ring by Schur's lemma nd you're done.
Comment: What I'm not understanding is this: the discussion in your second paragraph (the fact that $R^{op}\cong\mathrm{Mat}_n(\mathrm{End}_R(I))$) is extra or I need it? because it seems to me that the exercise is solved once we note that $R=I_1\oplus\cdots\oplus I_n$ with the $I_j$'s simple.
Comment: You are right! You are already done at this point. Semisimplicity can be read off the left ideal-structure. What follows just tells you the ring structure, which is useful extra information this time about the ring-structure.
Answer: As Olivier nicely explains, the key fact here is as follows:
Lemma: For a minimal left ideal $U$ of a ring $R$, let $B_U$ be the left ideal generated by all left ideals $I$ of $R$ which are isomorphic to $U$ as left $R$-modules.  Then $B_U$ is a two-sided ideal of $R$.
A proof of this can be found in $\S 2.3$ of my noncommutative algebra notes.
Later on in $\S 2.4$ this lemma is used to prove a result which, in particular, answers your question.
Theorem: For a simple ring $R$, the following are equivalent:
(i) $R$ is left Artinian.
(ii) $R$ has a minimal left ideal.
(iii) $R$ is left semismple.
(iv) For some $n \in \mathbb{Z}^+$, $R$ is isomorphic to the ring of $n \times n$ matrices over a division ring.
Note that a ring satisfies condition (iv) iff its opposite ring does, so all of the instances of "left" in conditions (i) through (iii) can be replaced by "right".
Let me also add that these conditions are nonvacuous: a simple ring need not be left Artinian.  (Further, there are simple rings which are left Noetherian but not left Artinian and also simple rings which are not left Noetherian.)  Some examples are given (following Lam) in $\S 1.10$.  Thus -- confusingly for the unwary! -- a simple ring need not be semisimple.
Comment: Could you maybe take a look at one of my recent questions (if you haven't already) about the interactions between ring theory and Lie algebra theory? It is kind of vague but some guiding principle behind the similarities of both theories would help me a lot!
Answer: Given a left $R$-module $M$, let $\text{soc}(M)$ be the sum of all simple submodules of $M$ (if $M$ has no simple submodule, then of course $\text{soc}(M) = 0$). The submodule $\text{soc}(M)$ is called the socle of $M$. Note that $M$ is semisimple if and only if $\text{soc}(M) = M$.
Lemma: Let $\varphi:M \rightarrow N$ be an $R$-module homomorphism. Then $\varphi(\text{soc}(M)) \subseteq \text{soc}(N)$.
Proof: Use Schur's lemma.
Consider $S = \text{soc}(_R R)$. By construction $S$ is a left ideal. I claim that $S$ is actually a two-sided ideal: Indeed for every $r \in R$ right multiplication by $r$ is an endomorphism of $_R R$; hence by the Lemma above $Sr \subseteq S$.
By hypothesis $S \neq 0$. But $R$ is a simple ring, thus $S=R$, i.e. $R$ is semisimple.

Why is this ring semisimple?


Large deviation theory exercise

Question: I would appreciate some hints on this problem: a die is thrown ten times, use large deviation function of a Bernoulli distribution to give an estimate of the probability that the sum is 27. First it seems to me this is not a sequence of Bernoulli variables and second assuming it is how to scale the mean to be between 0 and 1?
Comment: Is that a verbatim statement of the question?
Answer: I think I got it: an estimation can be thought as replacing the sum of 10 independent variables by a single Bernoulli variable and scale appropriately the approximation given by the large deviation  function.
Comment: For this to be an answer, you'd have to explain how this works. It's not immediately clear that it does.

Large deviation theory exercise


Is there a way to keep the versatile bonus while mounted, like a feat or anything?

Question: I have a player who wants to wield a Warhammer in one hand while mounted, and is trying to keep the d10 for dice? Is there a feat or bonus that does it? If not would it be a problem balance wise if I let him do it?
Comment: What exactly are they trying to use their other hand for? The rules don't require them to use their hands to control their mount.
Comment: Is there a reason the player can't or won't use a lance?
Answer: Mounted combat lets you use versatile
There is no feat (that I know of) that lets you use the increased damage you get from wielding a versatile weapon with both hands while you wield it with one hand.
However, this should not be an issue for your player: the rules for controlling a mount (p. 198 PHB) do not say that it needs one of your hands, so it does not. (Just think of jousting knights with lance and shield, for a narrative justification). So your player can wield the weapon with both hands while mounted, and get the higher damage.
There also is a Mounted Combatant feat. While it does not do what you ask for, it provides various other bonuses for a mounted combatant like advantage on melee attacks against unmounted creatures smaller than your mount.
From a balance perspective, a feat that would allow this would be weak. Effectively, upgrading from d8 to d10 is worth slightly more than 1 point of expected damage (the little more is from doubling the dice on critical hits). Just taking an ASI to increase your strength likewise will increase your damage by 1, but also will increase your to hit by +1, which is worth about as much damage again, do this for all melee and thrown weapons, and increase strength ability checks like grappling, climbing, swimming, forcing open doors by +1, improve (rare) strength saving throws by 1, and improve your carrying capacity. So such a feat would be weaker than half of what a feat should be. I at least would make it a half-feat and also let it increase Strength by 1, and that would not be unbalanced.
Just letting them do it while mounted would also probably not break anything in a major way. It would be weaker than letting them start with a magical +1 weapon (which again would add to both attack and damage, and has the added bonus to count as a magical attack), something I've seen done that has not broken those games.
But I feel it is a pretty strong thing to grant for nothing, especially early on where your expected damage is likely less than 10 points, so it increases damage by more than 10%, for free, and later on you can combine it with all the other ways in the rules to improve damage. Or it allows them to use s shield for +2 better AC, which is huge, while dealing 1d10. There is no melee weapon in the game that does this, so I'd be careful.
As @Slaves_of_the_Coast points out, you can however use a lance with one hand as a mounted combatant, which deals 1d12 damage. Attacks on opponents within 5 feet with it have disadvantage, but that can often be avoided if not fighting in close quarters, so it might be an interesting, rules-based option for your player, too.
Comment: You are allowed to use lances with one hand while mounted, which is a d12 with reach so quite powerful actually
Comment: @Slaves_of_the_Coast Yes, it is. It does however give disadvantage on attacks against foes in 5 feet range, nothing that cannot be handled but making it difficult to use in close quarters (like mounted combat in general; our DM allows our paladin to ride their warhorse in dungeons if the corridors are high/wide enough, but it feels a bit cheezy).
Comment: True. My comment was addressing your last sentence specifically. Indeed, lances have a downside, which is trivially avoided in the usual use case though.
Comment: Not really relevant to the game, but afaik in real-life jousting you DO hold the reins in your shield hand.


How do computers boot?

Question: How does a computer boot and how does this differ for Windows, Linux and other OSes?
Comment: For further discussion, please look here: http://meta.superuser.com/questions/1856/help-create-and-maintain-community-faqs
Comment: As pointed out by some users, please help us clarify and split this question into sub questions as there are different types of firmware and OSes. We can write the common things they share in this question and refer to the other questions for a more detailed explanation, example question titles would be "How does an EFI load the boot sector?" and "How does OS X boot?".
Answer: What are the several steps the computer does during boot on a BIOS PC?
When you power your computer on, the processor will start the BIOS boot program.
The BIOS phase
If everything goes well; the computer will look for a video card, execute a power-on self test and show all the useful information about this and the next steps on the BIOS startup screen:

You will see the computer perform a memory test, detect any storage devices connected and depending on BIOS you might also see a second screen showing you an inventory of everything the computer has detected through common interfaces like COM/LTP/USB/PnP/...
So, as your computer is now ready it will now follow the boot sequence to determine which drive to boot from, it will look through the master boot records until a boot partition has been found, in which case the computer will start to boot the operating system by executing the boot record.
The Boot Loader phase
Back in these days, we had to boot DOS and Unix which we could boot in a direct way. Nowadays, the boot procedure is subject to limits. So at this point we'll have to let a small boot loader load the larger boot procedure. The small boot loader will set up important stuff the boot procedure needs and will load the essential parts of boot procedure into memory.
This leads on to booting Windows, booting Linux or ...
Comment: This is *probably* correct, however the OP asked about *his* computer and didn't tell us if it's EFI, BIOS, or one of the other firmware types.
Answer: Your computer will initialize, do some tests and load the boot loader first, then it will load Windows.
How does Windows boot after it's boot loader has been loaded?
The Kernel Booting phase
In this phase, the boot procedure will load the kernel, the device drivers, set up a session and start the first system processes, start the system services and load in basic functionality.

Once everything in this phase is done, the Local Security Authority Subsystem Service and Service Control Manager will be loaded followed by more services that load and Windows Logon.
The Windows Logon phase
Before and after you login; there might execute scheduled tasks, scripts and applications. Furthermore, once you login, the Desktop loads. Some people consider their computer booted once it hits the login screen, some when you get a working desktop...
In either case, your computer has finished booting!

How do computers boot?


Google Chrome: Open a link in new tab and switch to it in one click

Question: Is there a mouse/keyboard shortcut in Google Chrome that when clicking a link opens the URL in a new tab and then makes that tab active? Kind of like CTRL + left click, but also activating the tab rather than loading it in the background.
Comment: i'm wondering if some kind of google chrome extension that can record a macro and associate it with a shortcut. Firefox has iMacros
Answer:
Try Ctrl+Shift+Click or Shift+Middle-click (Cmd+Shift+Click on Mac)
Use the Tab Activate or Tabs to the front! extensions.
Comment: Yeah, sometimes we miss obvious things. You're welcome. :)
Answer: There are many extensions that can open new links in an active tab (i.e., open links in a new foreground tab) with "one click."
Mouse Gesture Extensions

crxMouse Chrome Gestures
By default, click on any link and drag to the right (→) to open it in a foreground tab. You can configure this gesture on the "Super Drag" tab of the extension's Options page.
Gestures for Google Chrome™
Enable the "Super Drag(Drag&Drop Action)" option on the "Basics" tab of the extension's Options page. You can then open new foreground tabs by clicking on links and dragging downward. To change or configure this gesture, go to the "Drag Actions" tab on the Options page (only visible after enabling the "Super Drag(Drag&Drop Action)" option).
smartUp Gestures
By default, click on any link and drag to the right (→) to open it in a foreground tab. To show visual feedback when dragging the link, enable the "Super Drag" feature by going to General → Features ON on the extension's Options page. You can configure the gesture by going to Simple Drag →  Link Actions, or Super Drag →  Link Actions (if you enabled Super Drag), on the Options page.
Smooth Gestures Plus
Paid app with free trial period. By default, right-click on any link and drag upward (↑) to open it in a foreground tab. To make this a left-click drag instead, go to Settings → Mouse Button to Start Gesture on the extension's Options page.

Other Extensions

Long Press New Tab
Allows opening new foreground tabs via "long-clicking", i.e., by clicking and holding down the mouse button on a link for a small amount of time. On the extension's Options page, you can enable long-clicking for the middle and right mouse buttons. You can even enable "Super Drag" to open links in the foreground by dragging them, making this extension a potential substitute for the mouse gesture ones.
Right Click Opens Link in New Tab
Allows right- or middle-clicking to open links in foreground tabs. By default, right click opens a link in a foreground tab, and middle-click opens a link in a background tab. You can configure this on the extension's Options page.
Click to Tab
Can open all links in new foreground tabs without gestures. To enable this behavior, uncheck the "Open in background" box on the extension's Options page.
Answer: On MacOS, it's Cmd + Shift + Click.
Answer: If you have a scroll wheel, click the scroll wheel over a link or url.
If you don't have a scroll wheel, you can simulate a middle click on a laptop touch pad by pressing both left click and right click simultaneously.
See how to change mouse settings here: http://www.howtogeek.com/howto/26552/stupid-geek-tricks-use-both-laptop-mouse-buttons-to-simulate-middle-click/
Answer: I've found MagicPrefs and BetterTouchTool (BTT seems to be more advanced) useful as they allow to generate 'middle-click' which is commonly used by browsers on other OSes to open link in a new tab. And for a touchpad default is to use three finger click which is reasonable extension for two finger as right click.
Also this middle click is compatible with utilities like Synergy (synergy-project.org) so middle-click event is properly propagated to other desktop running Linux/Windows.
Answer:
Open up a google homepage
Click on "Settings" available at bottom right corner. Make sure you select SETTINGS from a bottom right corner only.
Click on "Search Settings"
Select "Open each selected result in a new browser window"
"Save" your settings
You are good to go!!!
Comment: This is only for Google links. The poster is asking about ANY links.


Looking for a javascript callback action to re-initiate a custom slideshow in gutenberg

Question: I'm using the new Gutenberg Blocks in ACF to build a custom slider, but I need a way to re-initiate BXSlider(the library I'm using for the slider) after every change made on the block.  I'm looking in the documentation for what the gutenberg block callback function is after every change/update, but cannot find it.
Answer: I found the solution.  I can include a javascript with callback function for each block in the ACF documentation.


Sharepoint 2010: Restricting Users to only view document

Question: I have a query regarding viewing documents in sharepoint 2010. Basically I need to send a link to another user (employee)in another department to view the document. However i do not want him to view any other documents or be able to navigate to any other document library or folder or root directory/site?
What is the best approcah?
Answer: If that is the case you want the user to view only that document then you have to set permission on that document, a minimum of read-only permission. You should remove access of this user from other documents and other document libraries. Basically you have to break the inheritance of document lib permission. This is the easiest out of the box approach you can follow.
Answer: The easiest way to do that is by setting specific permissions to that user or group in the file or folder you want to give access. All other site/object permissions should not include this user or group.
Answer: The out of the box approach is break the permissions to the document.

Go to the document permissions.
Click "Stop Inheriting Permissions" option from the ribbon.
Add a user you want to grant "Read" permissions.

This will make sure the user can access only that document.


How can I start a function automatically after a certain period of time?

Question: I want to start a function automatically after a certain period of time in our chain. How can I do it?
Answer: You could use the pallet-scheduler.
pallet_scheduler::Pallet::<T>::schedule(
     Origin::root(), // Depending on what you have configured as `ScheduleOrigin` in the runtime for scheduler
     when,
     None, // or Some if it should be periodic
     priority,
     Box::new(Call::Whatever {}), // The actual call that should be scheduled
);

You can also program this on your own using on_initialize:
fn on_initialize(now: T::BlockNumber) -> Weight {
    if now == expected_number {
        // do whatever you want to do.
    }
}

Comment: Uh, you were faster
Comment: @bkchr Can you please suggest the resources to learn about Hooks?
Answer: There exists the scheduler pallet which archives this. The downside is that only the ScheduleOrigin may schedule calls. But your question does not state who should be able to schedule calls.
The signature looks like this:
pub fn schedule(
    origin: OriginFor<T>,
    when: T::BlockNumber,
    maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
    priority: schedule::Priority,
    call: Box<CallOrHashOf<T>>,
) -> DispatchResult {

The call may be executed by the scheduler at any block after when, giving no guarantees if it ever happens. Reasons for non-execution could be full blocks, full schedules or an over-weight call. On successful execution a Dispatched event will be emitted for your convenience.
Usage in tests looks like this:
// Some example call to be scheduled.
let call = Box::new(RuntimeCall::Logger(LoggerCall::log {
    i: 69,
    weight: Weight::from_ref_time(10),
}));
assert_ok!(Scheduler::schedule(RuntimeOrigin::root(), 4, None, 127, call));

Another way would be to write a pallet and utilize its on_initialize/on_idle hooks. In these hooks you can then check the block number and run a specific task. The scheduler uses the same mechanism.
Answer: Like @bkchr mentioned, you can use on_initialize hook.
Here is a concrete example in the treasury pallet:
    impl<T: Config, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I> {
        fn on_initialize(n: T::BlockNumber) -> Weight {
            // Check to see if we should spend some funds!
            if (n % T::SpendPeriod::get()).is_zero() {
                Self::spend_funds()
            } else {
                Weight::zero()
            }
        }
    }

https://github.com/paritytech/substrate/blob/d11dd02dda6a00800a13cd59a0c2f07ac75e082d/frame/treasury/src/lib.rs#L309-L326

spend_funds() is only called on the T::SpendPeriod::get() - which in Polkadot's case, is every 24 days.
Comment: can please suggest any resources to learn more about hooks?
Comment: Yes, you can look here: https://paritytech.github.io/substrate/master/frame_support/traits/trait.Hooks.html and you can also do a search in the Substrate repo for specific hooks - they are used extensively.


pull-ups between logic gates

Question: I'm trying to understand why, on this circuit bit, they used pull-ups resistors between logic ICs of the 74LS and CD4000 families. Specifically I'm talking about resistor array RM1 and R1. All the ICs on this circuit are supplied by 5V.
As far as I know, pull-ups are needed when you have open-collector/gate outputs/input, and not for TTL and CMOS devices, am I wrong?
Comment: General note: that might be an anti-glitch measure that brings the inputs to a defined state during device power-on or a brownout or similar situations, when the output stops being properly powered.
Comment: @MarcusMüller - Ditto: where ICs might be socketed or unpopulated. (And even if the final product has the IC soldered dev boards might have it socketed.)
Answer: This is a case of interface between logic families (from LS-TTL -to- CMOS). Although both are powered from +5v supply, logic levels differ:

Logic low output for the 74LS93 is compatible with logic low input for CMOS 4002. No problem here.
Logic high output of 74LS93 is marginal compared to logic high input for CMOS 4002.

This is a matter of noise immunity: pull-up resistors ensure that a logic high is closer to Vcc of +5V rather than a \$V_{be}\$ lower than +5V.
Worst case \$V_{OH}\$ for 74LS93 is 2.7V
Admittedly, that's with Vcc at minimum 4.75V, and loaded with maximum current (0.4mA). When lightly loaded with high-impedance CMOS, far less static current flows.
Minimum acceptable \$V_{IH}\$  of 4002 is 3.5V
Clearly, the 74LS93 needs some extra help to pull up to 3.5V. 10k pull-up resistors do the job. Even so, at higher speeds, capacitance may slow the rising edge.
Comment: LS-TTL asserts logic **low** strongly: it can sink 8mA while remaining below 0.5V worst case...a 10k load only requires 0.5mA. On the CMOS input side, a logic **low** is any voltage below 1.4V. Do note that CMOS logic thresholds are highly dependent on Vcc (+5V), while LS-TTL thresholds are almost independent of Vcc.
Comment: How much does the 10k pullup affect the margin for logic low?

pull-ups between logic gates


How do I comletely remove the LAMP -Linux, Apache Mysql and php from ubuntu 18.04 installing in VM

Question: How can I completely uninstall LAMP installed in the Ubuntu 18.04 which is running in the VM, from the code I like to remove and make completely free now.
Answer: Assuming you are removing the "AMP" from the "LAMP" (you wouldn't like to remove the Linux, too), the following should work in most cases. The first command removes Apache, MySQL and PHP. The rest cleans up the packages that were only required by these packages. The purge removes all the configuration files, too; if you wish to preserve the configuration, use remove instead.
sudo apt-get purge apache2 mysql-server php
sudo apt autoremove
sudo apt autoclean


Different infinity, same limit?

Question: I heard that there are different ranks of infinity, like $\aleph_0, \aleph_1, \aleph_2$, etc, my question is, the base of natural log, i.e. '$e$' is defined by a limit of taking $n\rightarrow$infinity , will the limit for the value of '$e$' be different if $n\rightarrow\aleph_1$ or $n\rightarrow\aleph_2$ or $n\rightarrow\aleph_3$ etc? That is if $n$ tends to different ranks of infinity, will the limit be different?
Comment: Easy, easy. ¶ @Henry: The notation $\lim_{x \to \infty} f(x) = L$ is shorthand for a mathematical statement that doesn't make direct reference to any infinity, so the differing orders of infinity don't come into play.  What the above equation means, symbolically, is that for any positive value $\varepsilon$, $f(x)$ is within $\varepsilon$ of $L$ for all $x$ beyond some point that may depend on $\varepsilon$.  For instance, we say that $\lim_{x \to \infty} 1/x = 0$ because for any $\varepsilon > 0$, $|1/x-0| = 1/x < \varepsilon$ for any $x > 1/\varepsilon$.  Note: No $\infty$.
Comment: $\lim_{x\to\infty}$ is just shorthand for $x$ growing without bound within the reals, it doesn't deal with any real infinity.
Comment: DIFFERENT RANKS of infinity??? Do you really know what INFINITY is?
Comment: I'm referring only to standard analysis in the foregoing, incidentally.
Comment: I don't think the downvotes on this are fully justified (at least not if they are based merely on the OP mixing up the various different notions comprised under the name "infinity"). It a very important question and it should especially be addressed that in symbolisms such as $\lim_{x\to\infty}$ or $\sum_{n=0}^\infty$, there isn't really an object/entity "infinity" involved and this contrasts a lot with the infinite cardinalities ...
Comment: http://math.stackexchange.com/questions/90758/the-aleph-numbers-and-infinity-in-calculus
Answer: I'm going to assume that by the limit definition of $e$, you mean
$$
e=\lim_{n \rightarrow \infty} {\left(1+\frac{1}{n}\right)^n} \quad \text{where } n\in \mathbb{N}
$$
In a way (but not all ways!), the $\infty$ can be thought of as the number of objects $n$ will pass by on the way to $e$.
The number of elements in $\mathbb{N}$, called the cardinality of $\mathbb{N}$, is $\aleph_0$.
The following definition of $e$ is also valid:
$$
e=\lim_{x \rightarrow \infty} {\left(1+\frac{1}{x}\right)^x} \quad \text{where } x\in \mathbb{R}
$$
The cardinality of $\mathbb{R}$ is $\mathfrak{c}$, where it is known that $\mathfrak{c} > \aleph_0$ (and if the continuum hypothesis is true then $\mathfrak{c} =\aleph_1$).
So in this case it seems that passing $\aleph_0$ objects in $\mathbb{N}$ is the same as passing $\mathfrak{c}$ objects in $\mathbb{R}$, which isn't surprising since $\mathbb{N} \subset \mathbb{R}$.
Consider the following description of these limits using their definitions:
$$
\forall \epsilon > 0 \ \exists N \in \mathbb{N}: n\geq N \Rightarrow |a_n - e| <\epsilon \text{ where } (a_n):\mathbb{N} \rightarrow \mathbb{R}\text{ is defined by }a_n = \left(1+\frac{1}{n}\right)^n
$$
and
$$
\forall \epsilon > 0 \ \exists \delta \in \mathbb{R}: x\geq \delta \Rightarrow |f(x) - e| <\epsilon \text{ where } f:\mathbb{R} \rightarrow \mathbb{R}\text{ is defined by }f(x) = \left(1+\frac{1}{x}\right)^x
$$
Is there anything that can be said about some type of limit that involves more than $\mathfrak{c}$ objects?
In topology the notion of the limit of a sequence is generalized by the limit of a topological net. For a topological space $(X,\tau)$ and a directed set $\Lambda$, a net is some function $(x_\lambda): \Lambda \rightarrow X$.
We can talk about convergence, that is the net $(x_\lambda)_{\lambda \in \Lambda}$ converges to $x \in X$ and we write:
$$
\lim_{\lambda \in \Lambda} x_\lambda =x
$$
which has a similar definition to the ones above:
$$
\text{For every neighbourhood } U \text{ of } x \text{, there exists } \lambda_0 \in \Lambda \text{ such that } \lambda \geq \lambda_0 \Rightarrow x_\lambda \in U
$$
So think about the notions presented here
$$
n \rightarrow \infty \text{ where } n \in \mathbb{N} \text{ and } |\mathbb{N}| = \aleph_0
$$
$$
x \rightarrow \infty \text{ where } x \in \mathbb{R} \text{ and } |\mathbb{R}| = \mathfrak{c}
$$
With nets we can talk about the situation where $\lambda \in \Lambda$ and $|\Lambda| > \mathfrak{c}$.
Is it possible to define some net $(x_\lambda)_{\lambda \in \Lambda}$ for some topological space $(X,\tau)$ and some directed set $\Lambda$ where $|\Lambda|>\mathfrak{c}$ that behaves like $(a_n)^{\infty}_{n=1}$ and $f$ above? It's gotten too abstract to make that easy to talk about.
Although certainly, since the limit $x\in X$, then $x\neq e$ if $e \notin X$.
Comment: Do I understand you right? You're suggesting that limits of sequences are limits up to $\aleph_0$ and limits over $\Bbb R$ are limits up to $\frak c$ and so on?
Comment: No, not really, just that one limit is defined on a sequence with indices in $\mathbb{N}$ (a set with cardinality $\aleph_0$), and one limit is defined on a function with a domain in $\mathbb{R}$ (a set with cardinality $\mathfrak{c})$.
Answer: There are different kinds of infinity.
When talking about limits you see if you consult the definition of $\lim_{x\to\infty}$ you'll see that there's actually no infinity involved. This is because the concept of infinity is a bit confusing and here's a occasion where you can easily avoid an actual infinity.
This is a case of infinity that could be called potential infinity. While there's no actual infinity involved. The quantities are all finite, but we don't restrict the size of them.
Another concept of the theme is Bachmann-Landau notation (or ordo notation). It's a notation describing the assymptotic behavior of functions (ie how it grows or diminishes for large $x$). In some sense this is a description of potential infinities, in addition these can be compared in some cases (for example $\Theta(x^2) > \Theta(x)$).
Then of course there are actual infinities, but these should not (IMHO) be studied before you actually learned the concept of limits, by it's definition. This is because at first one think may think that actual infinities would simplify the concepts instead of relying on the $\epsilon$-$\delta$ definition of limits, but in reality I don't think that's the case.
There's not only one kind of actual infinities (but keep in mind none of them are the infinity sign in $\lim_{x\to\infty}$) that is used in different fields. There's for example cardinal numbers which can be thought as the count of elements in a set - for these some are larger than others, but this kind of infinity is normally not used in mathematical analysis. The one's that's used there are used there normally doesn't come in different sizes.

Different infinity, same limit?


Needing a clearer idea on "quotient topology"

Question: So here's the definition of a quotient topology

Let $(X,\tau)$ be a toplogical space and define some equivalence relation $\sim$ on the set $X$. There exists a natural surjection denoted $p:X \to X/\sim$. Then the quotient topology on $X/\sim$ is
$$\tau_q=\{W \subseteq X/\sim : p^{-1}W \in \tau\}$$

Well, I am trying to see that $\tau_q$ is actually a topology. I am stuck on how to even think about the first axiom that "the entire set is in the topology."
Namely, I need to show that "$X/\sim \in \tau_q$" or equivalently,

$$p^{-1}(X/\sim) \in \tau$$

My problem is, $X/\sim$ is essentially a set of equivalence classes. So, if $X \to X/\sim$ I know exactly which equivalence class/element of $X/\sim$ it will be sent to. The reverse $X/\sim \to X$ is not so clear necessarily. That is one issue. Another is, the ambiguity of what topology is defined on $X$, namely, what are the elements of $\tau$? All I know is that they satisfy the requirements of a topology.
I consider the modulo $2$ on set $\mathbb{Z}$. Then $\mathbb{Z}/\sim=\{[0],[1]\}$.  I can specify a discrete topology on $\mathbb{Z}$ for instance(but what if some other topology is defined on it?). So $\tau$ consists of all subsets(power set) of the integers. In this case, sine any subset imaginable on the integers is open so $p^{-1}(\mathbb{Z}/\sim) \to \mathbb{Z}$ is open.
I just don't know how to generalize this; for some other topology? Like say, how about the indiscrete topology, so $\tau=\{\mathbb{Z},\phi\}$. Then, $p^{-1}$ might send $[0]$ to any even number so, it could be $0,\pm 2,\pm4...$ and similarly to the odds for $[1]$.
Say it sends $[0] \to 2$ and $[1] \to 1$. So basically, $\mathbb{Z}/\sim$ is sent to the set $\{1,2\} \in \mathbb{Z}$. Is this in the topology? i.e. is this set open? Well no, because $\{1,2\} \not\in \tau=\{\mathbb{Z},\phi\}$.
I mean, it need not be sent to $1,2$ it could be anything else as long as they are even/odd respectively, but even so the "pair" of even and odd integers is not in $\tau$ the indiscrete topology on $\mathbb{Z}$.
So, $p^{-1}\mathbb{Z}/\sim \not\in \tau$ in this case and therefore the entire set $\mathbb{Z}/\sim \not\in \tau_q$, which violates the axiom a topology must satisfy.
where have I gone wrong in my thoughts? Please give me an idea of how to prove that $\tau_q$ is a topology!
Answer: $p^{-1}$ is not the inverse function, is the $\textbf{inverse image}$ of $\, p: X \to Y$, and is defined for every subset $W \subset Y$ of the codomain of $p$ as
$$ p^{-1}(W) := \{x \in X \mid p(x) \in W\} $$
Now, if $\, p: X \to X/\sim $, then $p$ is surjective, and so
$$p^{-1}(X/\sim)= \{x\in X \mid p(x)\in X/\sim\}= X \in \tau \, \text{so } X/\sim \in \tau_q.$$
$$\text{What about } p^{-1}(\emptyset)?$$
The problem doesn't state anything particular of $\tau$, so you just know that it satisfies the axioms of a topology. A quick check on the properties of the inverse image should help you prove the union and intersection properties and hence showing that $\tau_q$ is in fact a topology for $X/\sim$.
Answer: For any function $f:A\to B$ between any sets, you always have $f^{-1}(B) = A$, because all elements of $A$ are sent into $B$.
Apply this to $p:X\to X/\sim$ : $p^{-1}(X/\sim) = X$.
Comment: how about in the context of my example? Are you saying that $p^{-1}: \mathbb{Z}/\sim=\mathbb{Z}_2 \to \mathbb{Z}$ is a map $p^{-1}(\mathbb{Z}_2)=\mathbb{Z}$? How?
Comment: @JohnTrail Watch out: $p^{-1}$ is not a function. It is a short way of saying "*all* those $x$ such that $p(x)\ldots$"


Looking for the shortest string type conversion C++

Question: I'm making an unmanaged C++ DLL which uses the C# managed DLL. I'm writting the C++ library as I need to use functions and headers defined in a software for which the C++ library can be added as an addon. But the things I want to make are so complex that my sparse knowledge of C++ would slow me down so I decided to do things in my favourite C# and connect the DLLs via COM and I was successful.
I'm somehow successful in making the code work, but less successful in keeping the code concise as I'm clearly not a professional C++ programmer.
The problem is with converting various string types. BSTR and const char * in particular.
The following code converst const char * to BSTR:
BSTR bstrt;
const char * someChar;

csharpInterfacedClassPointer->get_PropertyForSomeChars(&bstrt);
strcpy_s(nstring, (char *)bstrt);
someChar = nstring;

The problem is, I have plenty of discrete someChars with corresponding discrete interface methods...the property method is generated from the C# interface so I can't change it. Each of the "someChar" requires the following three lines of code so for 30 discrete variables, I'd need to write 90 lines of code.
csharpInterfacedClassPointer->get_PropertyForSomeCharX(&bstrt);
strcpy_s(nstring, (char *)bstrt);
someCharX = nstring;

The question is: how do  write some shortcut for this so it'd fit just in one line?
I tried some sort of function with the "getter" function pointer and the someChar pointer.
typedef HRESULT (__stdcall *get_string_func)(BSTR * str); //getter function pointer

//the converting function
void ConvertAndAssign(get_string_func bstr_get_fx, const char * constCharString)
{
const size_t nsize = 1000;
char nstring[nsize];

BSTR bstrt;
bstrt = bstr_t(constCharString);
bstr_get_fx(&bstrt);
strcpy_s(nstring, (char *)bstrt);
constCharString = nstring;
}

//calling the function...as I thought that would work
ConvertAndAssign(sPtr->get_DataFile, someChar);

But then the compiler says some weird things aboud bound functions and how they are not allowed as pointers...I googled what does it mean and the solutions given required to alter the function definition but I can't do that since the definition is generated from the C# code (by regasm.exe).
Important note: I need to get the const char * type in the end because it is the required input type to the functions of the program for which I'm making the C++ DLL.
Comment: Can I ask do you really need to use arrays of char instead of std:string (or wstring)? There are defined system functions that do conversion from bstr to wstring and vice versa (sample: http://stackoverflow.com/questions/6284524/bstr-to-stdstring-stdwstring-and-vice-versa)
Comment: Unfortunately, I need to get array of chars...imposed by the program functions for which I am writting the C++ library
Comment: @Motig: `std::string::c_str()` problem solved.
Answer: Disclaimer: it was a long time (7 years to be more precise) since I have touched C++/COM code for the last time.

Regarding binding an instance method to a function pointer check this SO question.
Another option is to use the IDispatch interface (if your COM component implement it)
Regarding ConvertAndAssign() implementation, IMO it has some issues. In order to make it easier to explain I have copied it bellow:
void ConvertAndAssign(get_string_func bstr_get_fx, const char * constCharString)
{
    const size_t nsize = 1000;
    char nstring[nsize];

    BSTR bstrt;
    bstrt = bstr_t(constCharString); // issue 1
    bstr_get_fx(&bstrt);
    strcpy_s(nstring, (char *)bstrt); // issue 2
    constCharString = nstring; // issues  3 & 4
}

if your COM method returns a BSTR (i.e, it has an out parameter of type BSTR) you should not pass on a pre-allocated string otherwise you'll end up
leaking memory.
Casting bstr to char * will not work. BSTRs are Unicode strings. Also they are encoded such its length preceeds the actual characters.
If you are using ATL/MFC you can use one of the string conversion macros.
If you are NOT using ATL/MFC you can use WideCharToMultiByte() function or one of the "Smart" BSTR classes (CComBSTR in ATL, bstr_t, etc)
Assigning nstring to constCharString will have no effect on the outside string. If you are calling ConvertAndAssign like follows
char *outsideStr = NULL;
ConvertAndAssign(whatever, outsideStr);

Inside ConvertAndAssign() function consCharString will point to NULL in the begning. After the assignment constCharString does point to nstring but
outsideStr still points to NULL (remember, when you called ConvertAndAssign() function a copy of the pointer value was passed to it).
In order to get what you want you can either pass a reference or a pointer to a pointer:
 void ConvertAndAssign(get_string_func bstr_get_fx, const char * &constCharString)
 {
      constCharString = nstring; // Assignment
 }

or a pointer to a pointer:
 char *outsideStr = NULL;
 ConvertAndAssign(whatever, &outsideStr);

 void ConvertAndAssign(get_string_func bstr_get_fx, const char **constCharString)
 {
      .
      .
      .
      *constCharString = nstring; // Assignment
 }

After fixing the previous issue you'll hit another one: You cannot return the address of a local variable! When your code resumes after ConvertAndAssign() returns, this
address is not allocated for you anymore (it's part of the stack, so it may even look to be working, but I assure you, it is not; the slightest changes
in your code may break it)
To fix this you need to pass a pre-allocated string:
char outsideStr[1000];
ConvertAndAssign(whatever, outsideStr);

void ConvertAndAssign(get_string_func bstr_get_fx, const char * constCharString)
{
    strcpy_s(constCharString, /* result str here */ );
}

or allocate a string in the heap.

Given all the above, one possible implementation for ConvertAndAssign() and its usage is as follow:
char outsideStr[1000];
ConvertAndAssign(whatever, outsideStr);

void ConvertAndAssign(get_string_func bstr_get_fx, const char * constCharString)
{
    BSTR bstrt;
    if(SUCCEEDED(bstr_get_fx(&bstrt)))
    {
         // Assumes constCharString points to a buffer large enough to hold the converted string.
        strcpy_s(constCharString, CW2A(bstr)); // not completely correct since bstr may contain the byte 0 but I guess thats not your scenario.
        SysFreeString(bstr);
    }
    else
    {
         // error handling.
         constCharString[0] = 0;
    }
}

Answer: This question can be deleted if any mod is going to read this. I realized I have a totally different problem. Thanks Vagaus for his effort.


Would I be able to see light coming towards me before it got to me

Question: If I were in space looking at a star that just started producing light that was two light years away. Would I be able to see the light coming towards me?
Comment: No. How would you?
Comment: No. You would have to wait two years.
Answer: You can't see the light coming towards you. But you can see it as soon as it reaches your position. That means, that if you're in space and there is a star which is 10 times far than the speed of light in seconds. And if that star emits the light "now", then you won't be able to know that whether the light is emitted "now" or not. Instead, after 10 seconds, you'll be able to see the light that was actually emitted by that start 10 seconds earlier.
This also means that you'll be looking at something that happened 10 seconds ago "at that star". If you ever took a telescope and looked at the sky, then you'll actually be looking at the lights that were emitted few seconds/minutes(depending on the power of telescope, whether it can see that far or not) ago.
Good luck!
Comment: Just to note, our own sun is over 8 light-minutes away. Other objects in our solar system range from light-seconds (the moon) to light-hours (the outer planets) from us. The nearest star is four light-*years* away.
Comment: Exactly! We can also say that the sun that we see is actually an image of sun that had already happened in past, i.e. 8 minutes ago.


Linear ephemeris

Question: What is the T in the formula for the linear ephemeris T_max = T + P*E, please? P stands for the period; E, for ephemeris. How to determine T? I have T_max and P. Or is it a referent epoch? Many thanks
Comment: There's not near enough context here to be able to answer this question.
Comment: @DavidHammen and yet... :-)
Comment: Sometimes having done exactly this is in a previous life help with "matched filtering" what's behind the question... ;-) Remains for the OP to judge whether it actually answers their question
Answer: This is a fairly standard ephemeris for e.g. times of maximum light of a variable star but you are getting some of the symbols mixed up. The ephemeris is normally written as:
$$
  T_{event} = T_0 + P\times E
$$
where $T_{event}$ is the time of the given event (time maximum or minimum light, maximum positive radial velocity etc), $T_0$ is a reference time when the particular event occurred in the past, $P$ is the period and $E$ is an integer "cycle count" of how many times the particular event has recurred.
In this specific example, your 'event' is a time of maximum light, $T_0=2454767.4648$, $P=0.4737$. If you wanting to calculate the next time of maximum light, you need to:

calculate the HJD for the time of interest ($T_{now}$),
obtain an estimate of the cycle count $E=\textrm{int}(\frac{T_{now}-T_0}{P})$
Add 1 to $E$ to obtain the next time of maximum light
Plug the new $E$ into your ephemeris which will give the HJD of the new/next $T_{max}$

As a worked example, for "now":
<code>T_now = 2459359.4269246464
E = (2459359.4269246464-2454767.4648)/0.4737 = 9693.81913583739
int(E)+1 = 9694
Next T_max = 2454767.4648 + 0.4737 * 9694
           = 2459359.5126
</code>
Comment: Thank you very much for your explanation. It helped a lot.

Linear ephemeris


Self testing PCB

Question: Is there a way that I can test my PCB by myself (if it works properly or not) before sending the design to the manufacturer? Like if Altium has some kind of feature like that? Or is there other software? Or if there is any kind of devices that help in testing PCBs?
Comment: Buy one from a quick turn service, build it, test it. You can usually turn this around in 2-3 weeks using express shipping. Simulation helps enormously to develop designs that work the first time, but it's not a panacea. I would never manufacture a complex design without physically building one.
Comment: If you're buying a few thousand at a time, you may wish to engage the test engineering services of the manufacturer (or find one so equipped).
Comment: usually the projects are of few pcbs like between 10 and 20, but what do u mean by buy one from a quick service?
Comment: PCB design tools like Altium can verify that your layout matches your schematic and can do some basic electrical rules checking based on assigned pin type. It is possible to do small-scale simulation of analog circuits in Altium if you have component models. But it is not possible to fully simulate a complex circuit board.
Comment: You can use the Proteus software for simulation, this is will help you to see if your circuit works, if it does , then copy it to Altium and make PCB. Run design rule checks and make all connections. The circuit should work most probably after that.
Comment: sounds helpful, thank u so much
Answer: To ensure that your PC board matches the schematic, use the ERC (Electrical Rules Check) function. ERC will check for unconnected input pins, multiple output pins connected together, and other schematic faults.
Run DRC (Design Rules Check) on the PB board. This will check for shorted or missing connections, clearance between tracks and pads, and other layout problems.
You should try to correct all ERC and DRC errors, but there may be some reported errors that can be ignored if you know they will not cause a problem.
Errors from either DRC or ERC will not prevent you from generating the Gerber and drill files to manufacture the PC board.
Comment: Thank u for ur help, I already know those functions, but I wanted to know if I can test it like when drawing a circuit using circuit wizard software for example or matlab and run a simulation so u could see how the current flows what voltages are there and so on and if this connection is good or not , is there similar thing for pcb?
Comment: Yes, Altium and others have simulation facilities so you can confirm that your schematic as valid (subject to the SPICE models being adequate for your application and your simulation parameters being valid).  Once the simulation shows that the schematic is valid, DRC can confirm that the PCB is a correct implementation of the schematic.  You can go as far as you feel necessary with design rules, eg specifying track widths and spacing for specific nets.  Eventually you'll get to a point where making a prototype is best use of your time.
Comment: still a beginner, I hope to reach that point, thank u so much
Answer: I am using Mentor Graphics PADS-PCB, which is an integrated design suite, and includes schematic capture, layout, and autorouter. Although it is the 2004 version, it still works well for simple and moderately complex designs. I also have the 2005 version and their 9.x package, but I really don't need the extra functionality, and the 2004 schematic software does not require a dongle.
To start, draw a schematic, and create or use third party components, which will have attributes. If there are design questions, you can ask questions here, before getting too deep. Then you can use layout module, where you can assign physical attributes such as track width and spacing, and you can run a design rules check.
As for determining the actual performance, a good simulator is very useful, although my app of choice, LTspice, is mostly useful for analog circuits.
Once you have created a complete package, including Gerber files, you can use something like FreeDFM, which may detect manufacturing problems. They will also show a quote. However, you can get boards made in China for less than $5 each. I haven't had any problems, but you may want to choose a more costly fab house if high reliability is paramount.
Finally, you may be able to perform a Power On Self Test or a special test mode to aid in troubleshooting, particularly if there is a microcontroller.
Comment: looks pretty useful, thank u so much

Self testing PCB