text:
# What are the fewest weights you need to balance any weight from a triangular seesaw?

I saw this question:

What's the fewest weights you need to balance any weight from 1 to 40 pounds?

Suppose you want to create a set of weights so that any object with an integer weight from 1 to 40 pounds can be balanced on a two-sided scale by placing a certain combination of these weights onto that scale.

What is the fewest number of weights you need, and what are their weights?

Now, the answer was weights of mass in powers of 3 (1, 3, 9, 27, etc.) since they can be placed in either pan. Apparently, this is not really what I imagine as base-3, but something to the effect of a "-1, 0, 1" and not 0, 1, 2. I am using this reasoning for my guess on this for the triangular cause, but first let me state the question.

Say a regular triangle balanced on it's center with any weight held on any corner. I'll uses specific number of weights, for a with rational cevians (if it matters) with a total weight of 1029 (with 440 on corner 'A', 325 on corner 'B', and 264 on 'C'). I would assume that you add Total - Individual (ie. 589 on 'A' 704 on 'B' and 765 on 'C'). Is there a more efficient way? Is there a best power of weights or is that only applicable if there is 1 or only 2 weights on the triangle to be balanced. What about a regular tetrahedron centered on it's typical center of mass half way between opposite edges, and were weights added to each corner?

• the original question I copy/pasted was in puzzling... puzzling is my source :) Jul 29, 2016 at 6:05
• So, I assume from the problem statement that in the "triangle case" you have a mystery weight on one (or two) of three pans, and you want to be able to rearrange your weights to make all three pans have the same weight. The confusing part is that I personally don't understand what you mean by the "tetrahedral" and "octahedral" cases. How many pans are in each, and how does one "balance" them? (A little confused since triangles are 2D, whereas tetrahedra and octahedra are 3D) Jul 29, 2016 at 6:47
• no rearrangement of weights! unknown weights can be of any mass, but known weights must be added of mass x^n with n=0,1,2,etc what is the optimal x for minimizing the number of weights used... you have an unlimited number of x^0, unlimited x^1, unlimited number of x^2 weights, etc... find the most efficient x... the tetrahedral case has 4 pans (instead of the triangular 3 or the linear 2)... the "octahedra" merely refers to a weight on 2/4 tetrahedral pans so that the mass is centered on one of the 6 edges rather than the 4 faces/vertices. Jul 29, 2016 at 6:56
• @Jasand Pruski: That picture does not show a tetrahedron as a tetrahedron has only 4 vertices instead of 5 and never has two vertices on directly opposite sides of its center Jul 29, 2016 at 7:33
• @TheDarkTruth A regular tetrahedron is most easily drawn correctly by connecting 4 of the vertices of a cube, and that is what was done here. The tetrahedron is ACHF. The vertex D is a vertex of the surrounding cube but not of the tetrahedron, and DF is only drawn in order to get the centre O of the cube/tetrahedron. Jul 29, 2016 at 7:45

In order to balance a Triangle every vertice needs to have exactly the same weight.

To show this we can look from a single vertice in the direction of the center and realize that the other two vertices would need to have the same weight as otherwise the triangle would tilt somewhere in the half of the heavier one (depending on the weight of the vertice you look from).

If we name the vertices as A,B,C and look from vertice A that would mean that vertice B and C would need to be equal.

If we now look from one of the other two vertices we can make the same deduction and thereby can see that all three vertices must have the same weight for the triangle to stay in balance.

In order to balance a weight on one vertice that would mean that we can simply use the same strategy as in the original question.
However instead of looking at a single empty vertice we now have two empty vertices which means that we need to place the same weights on each of these two vertices.
therefore we need 2 sets of weights of order $3^n$.

For the tetrahedron we can use the same general idea.

If we place a single vertice at the bottom we can again see, that all 3 vertices on top need to have exactly the same weight (as long as I understand the question correctly and don't make a deduction based on misunderstood logic).

Next place one of the other vertices at the bottom and we see that all vertices must have the same weight again.

So for the tetrahedron we again use the same strategy only this time with 3 sets of weights of order $3^n$.

Lastly we look at the octahedron.

As an octahedron has 6 vertices consisting of 3 pairs of vertices on exact opposite sides of the center we only need to balance each vertice with its opposite one.

So we use the original strategy 3 times for a total of 3 sets of order $3^n$.

Edit:

I just thought about it again and realised that i made a mistake with the triangle (not in the logic but in the number of sets required).

We effectively need to use our weights to make every digit of our base 3 weight numbers equal.
So if we have our 3 weights and $\mod 3$ them we would need to distribute our 1-weights on the 3 vertices to get the same result on each of them.
After that we take $\mod 9$ and distribute our 3-weights and so on until we balanced all 3 vertices.

We reach a problem with the triangle when we have a $\mod 3^n$ result of 0,1 and 2 as it is impossible to make them equal with only 2 sets of weights.

Therefore we will need 3 sets of weights for the triangle as well.

• I think the number of sets required makes sense in terms of the mod-3 mod-9 mod-27 etc makes sense in a greedy algorithm, but I just don't know if 3^n is the answer in all circumstances since I am not qualified to make such a judgement. I am hoping other people will confirm or deny. Jul 29, 2016 at 22:11

You can uniquely weigh items using paired weights, two for every power of $4$:

$\begin{matrix} \color{red}{1} & = & 1 & = & 1 \\ \color{red}{2} + 1 + 1 & = & 4 & = & 4 \\ \color{red}{3} + 1 & = & 4 & = & 4 \\ \color{red}{4} & = & 4 & = & 4 \\ \color{red}{5} & = & 4 + 1 & = & 4 + 1 \\ \color{red}{6} + 1 + 1 + 4 + 4 & = & 16 & = & 16 \\ \color{red}{7} + 1 + 4 + 4 & = & 16 & = & 16 \\ \color{red}{8} + 4 + 4 & = & 16 & = & 16 \\ \color{red}{9} + 4 + 4 & = & 16 + 1 & = & 16 + 1 \\ \color{red}{10} + 1 + 1 + 4 & = & 16 & = & 16 \\ \color{red}{11} + 1 + 4 & = & 16 & = & 16 \\ \color{red}{12} + 4 & = & 16 & = & 16 \\ \color{red}{13} + 4 & = & 16 + 1 & = & 16 + 1\\ \color{red}{14} + 1 + 1 & = & 16 & = & 16 \\ \color{red}{15} + 1 & = & 16 & = & 16 \\ \color{red}{16} & = & 16 & = & 16 \\ \color{red}{17} & = & 16 + 1 & = & 16 + 1\\ \color{red}{18} + 1 + 1 & = & 16 + 4 & = & 16 + 4 \\ \color{red}{19} + 1 & = & 16 + 4 & = & 16 + 4\\ \color{red}{20} & = & 16 + 4 & = & 16 + 4 \\ \color{red}{21} & = & 16 + 4 + 1& = & 16 + 4 + 1\\ \color{red}{22} + 1 + 1 + 4 + 4 + 16 + 16 & = & 64 & = & 64 \end{matrix}$

This is because every integer has a unique representation in base $4$ using digits valued $-2, -1, 0, 1$.

• i kind of don't understand but I think this makes sense in the case of a triangle... i am waiting for more confirmations. Jul 29, 2016 at 23:13
• Works while only one pan has a random weight at the start. Stops working when more than one pan can have a weight at the start. For example you will not be able to balance a 1,2,3-starting-weight-distribution with only two sets of your weights. Aug 1, 2016 at 14:39
• @TheDarkTruth Yes, that's true. But if you have two things you want to weigh, you can just weigh them one at a time.
– Anon
Aug 1, 2016 at 15:12
• @McFry The question however is not about weighing a certain weight but about balancing a triangular(and tetrahedral and octahedral) scale Aug 2, 2016 at 6:38
• i am very uninformed in math (more into artsy synergetics stuff), but wouldn't 2 unknowns in a triangle have its center of mass on an edge, so this still has a triangle type symmetry but just reversed? Aug 5, 2016 at 19:52

Triangle case: If the triangle has three weights, we can subtract the smallest value from each side. That reduces to the case of only two unknown weights and a zero in the third pan.

The original problem defines the maximum weight as 40. Rather than examine this exact case, I assume an arbitrarily large MAX weight and solved for that. This will give an optimal solution for arbitrarily large MAX, but for specific values (such as 40) it may merely give a very good solution rather than an optimal one.

There's a particularly good solution I want to mention, which doesn't quite fit the rules. You can balance the two unknown weights using a single set of 3^n weights as in the solution for the original problem, then fill the empty pan using a single set of 2^n weights. This efficiently uses fewer weights in total, but requires two differing sets of weights.

To solve this problem we are going to be working in some base x, and assume each weight is a number written in base x. When solving any particular case we will work on it one digit at a time, starting from the smallest digit. If we can balance the triangle for the smallest digit, then we simply repeat the same process to solve each larger digit. Note that because the process is the same for each digit, we only need to ensure that our process works for the smallest digit. If it works for one digit it will work for every digit.

This means that for x=2, we only need to examine the cases where the weights are 0,0 0,1 1,0 and 1,1. For X=3 we only need to examine the cases where the weights are 0,0 0,1 0,2 1,0 1,1 1,2 2,0 2,1 and 2,2. Similarly for x=4 we only need to examine the 16 cases with weights ranging up to 3,3. If that works we can solve the lowest digit and the process can repeat to solve every digit.

When x=2 the worst case is when the unknown weights are 0,1. We can add 1 to the second pan - this changes it into a 0 and a carry into the next digit. This results in 0,0,0 for the lowest digit in each pan. (We don't care about the carry, it gets absorbed into the next digit and solved when we handle that digit.) We only need 1 of each size weight.

When x=3 the worst case is when the unknown weights are 1,2. We will need 2,2,2 to balance the triangle, meaning we will need 3 of each size weight.

When x=4 the worst case is when the unknown weights are 1,3. The most efficient solution is to add 3 to the first pan and 1 to the second pan. This means we'll have 0,0,0 as the lowest digit in each pan, and the weights generate a carry into the next digit. This means we need 4 of each size weight.

When x=5 the worst case is when the unknown weights are 1,3. The most efficient solution is to add 2 to the first pan and 3 to the empty pan. This means we need 5 of each size weight. And things just get worse for larger x.

So which is the most efficient x?

For x=2 we will need 1 weight of each size, times LogBase2(MAX) sized-weights.

For x=3 we will need 3 weights of each size, times LogBase3(MAX) sized-weights.

For x=4 we will need 4 weights of each size, times LogBase4(MAX) sized-weights.

For x=5 we will need 5 weights of each size, times LogBase5(MAX) sized-weights.

For an arbitrarily large MAX value, lower is better:

x=2 has an efficiency of 1/Ln(2)=1.4427

x=3 has an efficiency of 3/Ln(3)=2.7307

x=4 has an efficiency of 4/Ln(4)=2.8854

x=5 has an efficiency of 5/Ln(4)=3.1067

For arbitrarily large MAX weight best solution is x=2, with one copy of each weight.

For the tetrahedron yet the reasoning is essentially the same. We'll have three unknown weights, and we only need to find how many weights are needed to solve a single digit in the worst case.

For x=2 the worst case is 0,1,1. We need 2 weights to balance that as 1,1,1,1.

For x=3 the worst case is 1,1,2. We need 4 weights to balance that as 2,2,2,2.

For x=4 the worst case is 1,1,3. We need 7 weights to balance that as 3,3,3,3.

For an arbitrarily large MAX value, lower is better:

x=2 has an efficiency of 2/Ln(2)=2.8854

x=3 has an efficiency of 4/Ln(3)=3.6410

x=4 has an efficiency of 7/Ln(4)=5.0494 and clearly worse for higher X.

For a tetrahedron the most efficient is x=2 with 2 copies of each weight.

• You have the same problem as I had. For the triangle and x=2, if you have (0,1), you add 1 right and you have (0,2). Then you add 2 to 2 and you get (0,4). Then you add 4 to 4 and you get (0,8). etc. So zero all digits but you never reach an equality. Jul 26, 2020 at 15:06

As already explained by The Dark Truth, to balance a triangle you need all corners to have equal weight.

With two weights of 1 and 2 you can add the weights to some corners to make the corner weights all equal (mod 3). If 2 corners have equal weight (mod 3) then add 1 or 2 to the third one. If they are all different (mod 3) you can choose one corner and align the two others by adding 1 and 2 to them.

With 2 more weights of 3 and 6 (2x3) you can repeat the procedure and make all corner weights equivalent (mod 9).

Then with weights 9, 18, 27 and 54 you can make all corner weights equivalent (mod 81).

So far we have that with 8 weights (1, 2, 3, 6, 9, 18, 27, 54) we can align all corners (mod 81). But we want strict equality.

Unfortunately this process doesn't always end on an equality. The simple example of corner weights (0, 0, 1) results in a runaway (0, 0, 1) -> (0, 0, 1+2=3) -> (0, 0, 3+6=9) -> (0, 0, 9+18=27) -> ... To terminate the process we can split the last weight in two (54 becomes 27 and 27). The process can end with ... -> (0+27=27, 0+27=27, 27).

With that adjustment you get a working set of 9 weight: (1, 2, 3, 6, 9, 18, 27, 27, 27).

A computer search shows that it works up to an imbalance (max difference between 2 corner weights) of 27.

In general, with $$2k+3$$ weights, you can balance an imbalance of up to $$3^k$$ between 2 corners.

Evaluation: For large values it is more efficient than the "3 sets of 1, 3, 9, 27" solution, but not as good as the "powers of 2" solution.


text:
# Find Primes!

$[1]$. It is completely impossible to find a non-constant infinite arithmetic progression such that all of the terms are prime numbers.

$[2]$. It isn't possible to find a non-constant polynomial $f(x)$ with integer coefficients such that $f(x)$ is a prime number for all integer values of $x$.

$[3]$. If $f(x)=4x-1$, it is possible to find infinite values of $x$ such that $f(x)$ is a prime.

Which of these are correct?

This problem is from the set "MCQ Is Not As Easy As 1-2-3". You can see the rest of the problems here.

×

format: plain


text:
A nice new feature of Pellet 2.0.

The open-source program Pellet is described as an OWL reasoner, but I’ve used it mostly as a SPARQL engine that happens to understand OWL. So, for example, if I have RDF that says “Loretta’s spouse is Leroy and spouse is a symmetric property,” but the data makes no mention of Leroy’s spouse, and I ask Pellet “who is Leroy’s spouse,” it can give me the answer.

Most SPARQL engines can’t do this kind of OWL inferencing, and I thought it would be cool if Pellet could read a batch of RDF with some facts and some OWL properties, infer what it can, and then write out a copy of the RDF with all the implicit facts made explicit. This way, the less intelligent SPARQL engines could take advantage of the inferred data. It’s one of those holy grails in publishing technology: a process that reads data and adds value to it (in this case, by adding new facts that weren’t there before) and then writes out the data in a standard format so that other programs can use it. Pellet 2.0’s new extract subcommand now makes this possible.

First, let’s review how Pellet would run a SPARQL query against some sample data and infer a new fact to answer a question that a non-reasoning SPARQL engine could not answer. The following RDF/XML sample has a few facts about Leroy and Loretta and specifies that the spouse property is symmetric (that is, that if X is the spouse of Y, then Y is the spouse of X):

<-- spousedemo.rdf -->
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns="http://www.snee.com/ns/abook#">

<first>Leroy</first>
<last>Lockhorn</last>
</rdf:Description>

<first>Loretta</first>
<last>Lockhorn</last>
<spouse rdf:resource="L1"/>
</rdf:Description>

<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#SymmetricProperty"/>
</owl:ObjectProperty>

</rdf:RDF>

Leroy has no spouse property, and if I tell a SPARQL engine such as ARQ to run the following query against the RDF above to ask who Leroy’s spouse is, it won’t have anything to tell us. Old or new versions of Pellet, though, will read this query and tell us that Leroy’s spouse is Loretta Lockhorn because that information is available to it after it uses the extra OWL metadata to infer what it can.

PREFIX a: <http://www.snee.com/ns/abook#>
SELECT ?spouseFirst ?spouseLast WHERE {

?s a:first  "Leroy";
a:last   "Lockhorn";
a:spouse ?spouse.

?spouse a:first ?spouseFirst;
a:last  ?spouseLast.
}

Pellet 2.0’s extract subcommand reads RDF, does any inferencing it can from included OWL metadata, and then writes out RDF that includes the inferenced data. The following command line shows how I used it. (Additional command line parameters let you control just how much inferenced data Pellet adds when doing this.)

pellet extract --input-format RDF/XML spousedemo.rdf  > temp.rdf

This copies all the triples from spousedemo.rdf to temp.rdf and includes new data such as the bolded part in the following (the “j.0” prefix is assigned to the URL that was the default namespace in spousedemo.rdf):

  <rdf:Description rdf:about="http://www.snee.com/ns/ID#L1">
<j.0:last>Lockhorn</j.0:last>
<j.0:first>Leroy</j.0:first>
<j.0:spouse rdf:resource="http://www.snee.com/ns/ID#L2"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
</rdf:Description>

If I ask ARQ to run the query shown earlier on temp.rdf, it can tell me the name of Leroy’s spouse, because Pellet’s extract subcommand has made temp.rdf a richer data file than spousedemo.rdf.

Declaring the spouse property to be symmetric is just a small bit of metadata added to the data shown in the file. OWL can add all kinds of metadata, and Pellet now makes it even easier to take take advantage of that metadata.

For me, this small bit of metadata also proves something important about the value of semantic technology: while it would be silly to try to encode all the semantics of the word “spouse” in a machine-readable form, encoding just this small bit of the word’s semantics—that it’s a symmetric property—can add value to data and let you answer questions that you couldn’t answer before.


text:
# Pearson correlation with very low p-value

I am checking correlations between arrays of values. These values are the weights of a network and some features of the nodes of the same network. I often get good correlations (sometimes > 0.6), but I always get an incredibly low p-value, usually between 1.0664e-48 and 9.6488e-181. So it's basically a 0, and this rings a few alarms in my mind, but I can't find an explanation.

How is that possible? How should I interpret these values?

EDIT: I'll try to explain myself better by simplifying the question. If I check the Pearson correlation (using a simple function in Python) between two vectors of length ~1300, and I get a good r value and an incredibly low p value, how should I interpret this?

I know what a p value is, but I never got such a low result. This is so low that it makes me wonder if there is something wrong in the analysis, so I was asking more experienced people what I could look for.

• This doesn't make sense to me. Can you explain more about how you're computing the correlations and their p-values? – Glen_b -Reinstate Monica Jul 9 '18 at 1:02
• Question updated, I hope I clarified it. – sato Jul 9 '18 at 8:12
• Ah. Thanks for clarifying. For some reason I had thought your samples were very small but they're very large. Nothing seems to be obviously astray here. What is the reason for your concern? – Glen_b -Reinstate Monica Jul 9 '18 at 9:37
• I thought there was something wrong, since I am still not used to analysis of very large data sample, so I needed opinions. Thanks a lot! – sato Jul 13 '18 at 8:29

First of all, a tiny p-value is not at all surprising for a moderate effect size with a large data set. Here's a quick brute-force example of the p-value of a random sample of 1300 values from a bivariate Normal with $\rho=0.6$:

> m <- MASS::mvrnorm(1300,mu=c(0,0),Sigma=matrix(c(1,0.6,0.6,1),2))
> cor.test(m[,1],m[,2])$p.value [1] 1.562375e-128  For large data sets, it's quite common to get extremely low p-values. At these levels, you should remember that the interpretation of a p-value is conditional on all of the assumptions of the test (Normality, independence, etc.); the likelihood/degree of violation of some of those other assumptions is much higher than the p-value itself. (I sometimes tell students that the probability that some top-secret government agency broke in and secretly tampered with your data is much higher than the p-value.) Therefore, it's probably not worth taking the precise value of the p-value too seriously - this is one reason that the R language only reports exact p-values above a threshold of$2.2 \times 10^{-16}\$.

One sometimes sees tiny p-values reported in bioinformatics where thousands or tens of thousands of replicate tests are being done (e.g. on a set of genetic markers); in this case, the p-value is really used as an index of the strength of evidence - still shouldn't be taken seriously as a precise quantitative value.

You want your p-value to be as low as possible for your value to be significant. If your p-value is above your significant level (usually 1% or 5%) then your correlation is not significant.

If you want to know more about the theory behind p-values, here is an easy explanation: https://www.medcalc.org/manual/correlation.php

Depending on what you are testing, you can think about p-values as a measure of how likely it was to get the result you obtained (or a more surprising result) from your test simply by chance. At 95% confidence, we decide to call any p values that are less than 0.05 'statistically significant'. If your p value is > 0.05, then your result is not statistically significant, ie., then your data was reasonably likely to occur even if the null hypothesis was true (i.e., there was an actual correlation of 0). Here is a nice summary that briefly mentions p-values for correlations. https://www.nature.com/news/statisticians-issue-warning-over-misuse-of-p-values-1.19503

The correlation (r-value) tells you how strong a relationship is between 2 variables. The p-value simply tells you how likely it was to get an r value as big (or bigger) as the one you actually got under the null hypothesis (i.e., assuming that there is a true population correlation of r = 0). Sometimes a large sample size will give you a significant (low) p-value with almost any slight difference between the "null" (little to no correlation between variables A & B) and the alternate (a significant correlation between variables A & B). In your case, it is reasonably unsurprising that a correlation > 0.6 would produce a significant p-value (ie, a p-value below 0.05, for a 95% confidence level) -- you would typically only see a strong correlation produce a non-significant result (ie, p > 0.05) if you have a very small sample size. In other words, the stronger your observed effect size (whether it's a correlation, Cohen's d, etc) the lower your p-value, all else being equal, while a smaller observed effect size will be accompanied by a larger p-value. If your sample size is large enough, even a "clinically non-significant" effect could still produce a p-value that indicates statistical significance.

https://www.ncbi.nlm.nih.gov/pubmed/26342862

• The phrases "At 95% confidence" and "for a 95% confidence level" are at best redundant here. In fact they are best avoided: for example, there are significance tests not associated with confidence intervals and the idea of significance doesn't depend on a prior idea or choice of confidence level. Further, 0.05 is just a conventional level and hence is not the only way to decide on what should and should not be called significant. Also, your null, for your purposes, can't be "little or no correlation", just no correlation. – Nick Cox Jul 9 '18 at 7:55
• Thanks a lot for the references. Actually the sample is quite large, even though "large" should be defined based on the context. Thanks for the hint anyway. – sato Jul 9 '18 at 8:17


text:
# Perplexing Years!

Let the numbers $$P=2008^{2007}-2008$$, and $$Q=2008^{2}+2009$$.

What is the remainder when $$P$$ is divided by $$Q$$?

×


text:
## hmailserver freezing after upgrading to 5.2.1

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
entropicsinkhole
Normal user
Posts: 119
Joined: 2007-05-28 21:10

### hmailserver freezing after upgrading to 5.2.1

Recently upgraded to version 5.2.1 (on Server 2003). We upgraded 5.1.2 first (to 5.2), then did the upgrade from 5.2 to 5.2.1. We are now having alot of problems with the queue filling up and the server freezing (resolved by restarting). When we try to stop the service through the hmailserver console (ie. under the Server tab), we get the following error:

This error was similar (but not the same) to the one here: http://www.hmailserver.com/forum/viewto ... 0x80010105 so I double-checked everything suggested without success. There was never a resolution posted, so I don't know if that would have been helpful.

My hmailserver logs don't seem to indicate a specific issue (mail just queues up when this happens). The error logs has some dnsresolver errors, but I believe this just happens when the server has to be rebooted.

martin
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

### Re: hmailserver freezing after upgrading to 5.2.1

What is shown in the log if you send a message after the queue is filled up?
How often does the queue fill up?
If you restart the service, is the messages sent then?

entropicsinkhole
Normal user
Posts: 119
Joined: 2007-05-28 21:10

### Re: hmailserver freezing after upgrading to 5.2.1

What is shown in the log if you send a message after the queue is filled up?
It just says 'queued' (this log was taken the first day it happened). Is that enough information? I kept a log from that day, if you need more information let me know (it hasn't happened today yet).

"SMTPD" 6400 11107 "2009-09-16 08:42:24.426" "127.0.0.1" "SENT: 220 mydomain.com ESMTP"
"SMTPD" 6400 11107 "2009-09-16 08:42:24.426" "127.0.0.1" "RECEIVED: EHLO ASSP-nospam"
"SMTPD" 6400 11107 "2009-09-16 08:42:24.426" "127.0.0.1" "SENT: 250-mydomain.com[nl]250-SIZE 16000000[nl]250 AUTH LOGIN"
"SMTPD" 6400 11107 "2009-09-16 08:42:24.426" "127.0.0.1" "SENT: 250 OK"
"SMTPD" 6400 11107 "2009-09-16 08:42:24.426" "127.0.0.1" "RECEIVED: RCPT TO: <not-spammmaster@mydomain.com>"
"SMTPD" 6400 11107 "2009-09-16 08:42:24.426" "127.0.0.1" "SENT: 250 OK"
"SMTPD" 6400 11107 "2009-09-16 08:42:24.426" "127.0.0.1" "RECEIVED: DATA"
"SMTPD" 6400 11107 "2009-09-16 08:42:24.442" "127.0.0.1" "SENT: 354 OK, send."
"SMTPD" 5320 11107 "2009-09-16 08:42:24.473" "127.0.0.1" "SENT: 250 Queued (0.031 seconds)"
How often does the queue fill up?
It seems to happen once or twice a day.
If you restart the service, is the messages sent then?

Yes. But usually if you try to restart the service it gives you that HResult error and freezes everything up, forcing me to reboot the server itself. After rebooting, the queue empties right away.

martin
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

### Re: hmailserver freezing after upgrading to 5.2.1

Without debug logging enabled, it's not really possible to say what's going on. :-\

If you restart the hMailServer service using the control panel and then restart hMailServer Administrator, you should not have to restart Windows. If you still need to restart Windows after doing this, Windows installation is broken in some way.

entropicsinkhole
Normal user
Posts: 119
Joined: 2007-05-28 21:10

### Re: hmailserver freezing after upgrading to 5.2.1

I'll turn on debugging, since it definitely will recur at some point. Also, I've always been able to restart hmailserver service from windows even after the error. My co-worker tells me he wasn't able to, so I'm going to assume he might not have been telling the truth and go from there, unless I experience the same thing.

I will repost when it happens again! Thanks for your help!

martin
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

### Re: hmailserver freezing after upgrading to 5.2.1

The interesting part in the log to see what happens after hMailServer has queued the message. Typically a delivery should start directly after this, if not all delivery threads are already busy.

entropicsinkhole
Normal user
Posts: 119
Joined: 2007-05-28 21:10

### Re: hmailserver freezing after upgrading to 5.2.1

Hey Martin, I took a look through yesterday's log (it froze yesterday too), which had DEBUG turned on. I've managed to cut it down to about 12MB (covering about 10 minutes, before and after the freezing), but it's still too big to post here. The server gets shut down at 11:21:51 and restarts at 11:26:27. Do you want me to email it to you or make it available from a download site?

Unfortunately I was away yesterday, so I'm assuming (from what I've been told) that the 'freezeup' followed the usual queue-fill-up, he got that error I described trying to stop the service, and then rebooted the server when it did not respond.

martin
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

### Re: hmailserver freezing after upgrading to 5.2.1

Just email it to me at martin@hmailserver.com. If you zip it, I guess it will be fairly small.

entropicsinkhole
Normal user
Posts: 119
Joined: 2007-05-28 21:10

### Re: hmailserver freezing after upgrading to 5.2.1

Sent the file this morning

martin
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

### Re: hmailserver freezing after upgrading to 5.2.1

In your log, I see that hMailServer starts an external virus scanner:

Code: Select all

CustomVirusScanner::Scan()
What should typically happen after this is that the scanner is executed, and hMailServer reports the result. A result line current

Code: Select all

CustomVirusScanner::Scan() - "C:\Program Files\yourscanner.exe" /switches D:\path\to\datadir\{930FA237-A2C0-4838-AFAB-9D9A90779620}.eml - Returned 0

Before the reboot, I see the first line (scan started) several times. I don't see any scan result lines though. After the reboot, I see both scan start and scan completed lines. If hMailServer starts a virus scanner and that scanner does not complete, hMailServer will just sit and wait (which appears to be what's happening in your case), and the queue will get filled up. The thread information in the log confirms this. The second column is the thread ID, and threads which starts the virus scanner does not produce any more output after the scan start. If it's possible, you could try to temporarily disable the virus scanner. An alternative is to wait for the problem to occur again, and then check the task manager to see if there's multiple instances of the scanner executable running.

The other problem you mentioned was that the server 'freezes'. Is this a separate problem, or does 'freezes' mean that the queue delivery stops?

^DooM^
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

### Re: hmailserver freezing after upgrading to 5.2.1

Is there a reason why hMail sits and waits for a virus scan rather than timing out after a set time?
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

martin
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

### Re: hmailserver freezing after upgrading to 5.2.1

I would love to have answered yes to that, but no. It should obviously give up after a certain amount of time but it's very persistent... It's in the "things-to-fix-in-5.4-list" though. In 5.4, an error will probably be reported if the scanner times out and the message delivery rescheduled for later delivery.

entropicsinkhole
Normal user
Posts: 119
Joined: 2007-05-28 21:10

### Re: hmailserver freezing after upgrading to 5.2.1

Yeah, looks like we have to kill the antivirus (Kaspersky) every time it queues up like that then--since the queue empties right away after we do that. We may have to try with a different antivirus and see what happens, since no one else seems to be complaining.

The freeze-up/error only seems to happen if we stop the service through hmailserver console after it has a huge queue. You can't do anything in the hmailserver admin console after this happens and the mail can no longer be sent/received, but the rest of the server programs are fine. Since the log I sent you was a day that the server 'froze', it must be related to the antivirus scan too.

The 'timeout' change you're suggesting for 5.4 would be perfect to prevent this, so I'll eagerly wait for it. Happily you roll out the updates quickly

Thanks as usual!

martin
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

### Re: hmailserver freezing after upgrading to 5.2.1

Well, the timeout problem would not really be a good solution to your problem. It would be a ugly workaround. I suggest you contact the anti virus vendor, tell them what parameter you're using and ask them if they can tell you why it locks up. It could be that there's some bug in it which occur if you launch many scanners at the same time. Maybe the Kasperskys scanner does not support many simultaneous processes. :-\

entropicsinkhole
Normal user
Posts: 119
Joined: 2007-05-28 21:10

### Re: hmailserver freezing after upgrading to 5.2.1

Sounds like a plan! Thanks!


text:
# Characterizing continual features based upon the chart of the function

I had actually asked this inquiry : Characterising Continuous functions time back, and also this inquiry is essentially pertaining to that inquiry.

Intend we have a function $f: \mathbb{R} \to \mathbb{R}$ and also intend the set $G = \\{ (x,f(x) : x \in \mathbb{R}\\}$ is attached and also enclosed $\mathbb{R}^{2}$, after that does it indicate $f$ is continual?

0
2019-05-13 03:52:19
Source Share

intend you have a function $f:\mathbb{R} \rightarrow \mathbb{R}$ which is not continual and also its chart is shut and also attached. wlog think f is not continual at absolutely no and also f (0) = 0.

first, I intend to show that when x comes close to absolutely no after that either f (x) comes close to 0 or mosts likely to infinity. for every single b > a > 0 allowed $X_{a,b} = \{ x>0 \mid a < f(x) < b \}$. if this set is not vacant, after that its infimum can not be 0, due to the fact that after that the closure of the chart will certainly offer us that $a \leq f(0) \leq b$ (you can locate a collection $a_n \rightarrow 0 \subseteq X_{a,b}$ and also a below - collection such that $f(a_{n_i})$ is monotone and also hence merges in $R^2$).

currently I intend to make use of the connectedness to show that f (x) can not most likely to infinity when x mosts likely to absolutely no.

$f$ isn't continual at absolutely no, so wlog there is an $\varepsilon > 0$ such that $X_{2\varepsilon, \infty}$ is not vacant and also its infimum is 0. $X_{\varepsilon, 2\varepsilon}$ has infimum > 0 (otherwise vacant) - represent it by $\delta$. if you have $0 < x_0 < \delta$ such that $x_0 \notin X_{2 \varepsilon, \infty}$ (therefore $f(x_0) < \varepsilon$) after that you have the open collections $A = (0, x_0) \times (1.5 \varepsilon, \infty)$ and also $R^2 - \bar A$ which divides the garph of the function.

or else, if $(0,\delta) \subseteq X_{2\varepsilon, \infty}$ after that you can take the collections $A = \{x\leq 0 \} \cup (0, \delta/2) \times (-\infty, 1.5 \varepsilon)$ and also $R^2 - \bar A$.

0
2019-05-17 15:04:31
Source

The solution is of course. Below is one means to confirm it. (There could be a slicker means, yet this appears to function.)

Think $G$ is attached and also shut. Allow $a\in\mathbb R$ be approximate, and also allow $\epsilon>0$ be offered. Due to the fact that $(a,f(a)-\epsilon)\notin G$, the reality that the enhance of $G$ is open indicates that there is an item area of the kind $(a-\delta,a+\delta)\times (f(a)-\epsilon-c, f(a)-\epsilon+c)$ had in the enhance of $G$. This suggests that $|x-a|<\delta$ indicates that of the adhering to 2 inequalities holds:

1. $f(x)\ge f(a)-\epsilon+c>f(a)-\epsilon$, or
2. $f(x)\le f(a)-\epsilon-c$.

If there is any kind of $x\in (a-\delta,a+\delta)$ to make sure that the 2nd inequality holds, claim $f(b)\le f(a)-\epsilon-c$ (without loss of generalization, we might think $b\lt a$), after that the chart of $f$ does not converge the adhering to set:

$$\\{(b,y): y\ge f(a)-\epsilon \\}\cup \\{(x,f(a)-\epsilon): b\le x \le a\\} \cup \\{(a,y): y\le f(a)-\epsilon\\}.$$

(See the layout listed below.) This busted line separates $G$, negating the presumption that $G$ is attached. Consequently inequality (1) holds when $|x-a|<\delta$.
A comparable argument reveals that $f(x)\lt f(a)+\epsilon$ when $|x-a|<\delta$.

Placing these with each other, we end that $|x-a|<\delta$ indicates $|f(x)-f(a)|<\epsilon$, so $f$ is continual at $a$.

0
2019-05-17 15:03:54
Source

Yes, I assume so.

First, observe that such $f$ has to have the intermediate value building. For intend not ; after that there exist $a < b$ with (say) $f(a) < f(b)$ and also $y \in (f(a),f(b))$ such that $f(x) \ne y$ for all $x \in (a,b)$. After that $A = (-\infty,a) \times \mathbb{R} \cup (-\infty,b) \times (-\infty,y)$ and also $B = (b, +\infty) \times \mathbb{R} \cup (a,+\infty) \times (y,+\infty)$ are disjoint nonempty open parts of $\mathbb{R}^2$ whose union has $G$, negating connectedness. (Draw an image.)

Currently take some $x \in \mathbb{R}$, and also intend $f(x) < y < \limsup_{t \uparrow x} f(t) \le +\infty$. After that there is a series $t_n \uparrow x$ with $f(t_n) > y$ for each and every $n$. By the intermediate value building, for each and every $n$ there is $s_n \in (t_n, x)$ with $f(s_n) = y$. So $(s_n, y) \in G$ and also $(s_n,y) \to (x,y)$, so given that $G$ is shut $(x,y) \in G$ and also $y = f(x)$, an opposition. So $\limsup_{t \uparrow x} f(t) \le f(x)$. In a similar way, $\limsup_{t \downarrow x} f(t) \le f(x)$, so $\limsup_{t \to x} f(t) \le f(x)$. In a similar way, $\liminf_{t \to x} f(t) \ge f(x)$, to make sure that $\lim_{t \to x} f(t) = f(x)$, and also $f$ is continual at $x$.

0
2019-05-17 15:02:01
Source

This Monthly paper has brief straightforward evidence of the adhering to

THEOREM $\$ TFAE if $\rm\ f: \mathbb R\to \mathbb R\$ has a shut chart in $\:\mathbb R^2$
(a) $\rm\ \ f\$ is continual.
(b) $\rm\ \ f\$ is in your area bounded.
(c) $\rm\ \ f\$ has the intermediate value building.
(d) $\rm\ \ f\$ has a linked chart in $\rm\mathbb R^2$.

Extra usually the outcome is just a grandfather clause of R. L. Moore is 1920 characterization of a topological line as an in your area portable statistics room that is divided right into 2 linked collections by each of its factors.

Per demand, I've added the evidence of the theory listed below.

.

0
2019-05-17 14:42:01
Source


text:
## Profile

Vasilis Vassalos
Attended Stanford University
Lived in Stanford, CA
320 followers|18,355 views
AboutPostsPhotosVideos

## Stream

### Vasilis Vassalos

Shared publicly  -

Ελπιζω να το αποτρεψουμε αυτο το αίσχος
·  Translate
1
Add a comment...

### Vasilis Vassalos

Shared publicly  -

For all those who think that a conference publication (or even a journal publication) is a proof of correctness :)

1980: Mical+Vazirani $O(m\sqrt{n})$ algorithm for matching in general graphs
1994: Vazirani "journal version" of above result
2014: Vazirani "correct version" of above result.
A famous algorithm, a new paper, a full correctness proof Vijay Vazirani is one of the world experts on algorithmic theory, and is especially known for his masterful book on approximation algorithm...
1
Add a comment...

### Vasilis Vassalos

Shared publicly  -

For Yannis Papakonstantinou

Is this life real? - Our species is not going to last forever. One way or another, humanity will vanish from the Universe, but before it does, it might summon together sufficient computing power to emulate human experience, in all of its rich detail. Some philosophers and physicists have begun to wonder if we’re already there. Maybe we are in [...]The post Is this life real? appeared first on Aeon Magazine. http://ow.ly/2D7lcG
1
Add a comment...

### Vasilis Vassalos

Shared publicly  -

I could have written a much shorter (and not so witty) but similar letter to the Portuguese PM when I moved to the US after my Edinburgh PhD in 1982. Change seems really hard in Iberia... (ht  )
1
Add a comment...

### Vasilis Vassalos

Shared publicly  -

Autoawesome. Got to try this soon
1
Add a comment...

### Vasilis Vassalos

Shared publicly  -

I have not yet seen this one posted, so here goes.

All 6 Star Wars movies, AT ONCE!

All 6 Star Wars HD
1
Add a comment...
In his circles
231 people
Have him in circles
320 people

### Vasilis Vassalos

Shared publicly  -

Which airport is closest to you?

The dots in this graphic by Jason Davies show the major airports of the world. Each region consists of the points that are closer to a particular airport than to any other. For example, the irregular pentagonal light green area containing Iceland (near the top of the picture) shows all the places for which Reykjavik is the nearest major airport.

Jason Davies' website (https://www.jasondavies.com/maps/voronoi/airports/) has an interactive version of this map, in which the airports are labelled. The globe can be spun and twisted, and you can zoom in and out.

The furthest place in the world from a major airport is in Antarctica, which is perhaps not a surprise given that there are no large airports on that continent. It lies 5173.7km from each of the three nearest airports.

Mathematicians call a picture like this a Voronoi diagram. The individual regions are called Voronoi cells, and the points (airports in this case) are often called sites. Wikipedia has a nice page on Voronoi diagrams here (http://en.wikipedia.org/wiki/Voronoi_diagram).

(Seen via .)

#mathematics
1
Add a comment...

### Vasilis Vassalos

Shared publicly  -

Thought provoking

The meanings of life - Parents often say: ‘I just want my children to be happy.’ It is unusual to hear: ‘I just want my children’s lives to be meaningful,’ yet that’s what most of us seem to want for ourselves. We fear meaninglessness. We fret about the ‘nihilism’ of this or that aspect of our culture. When we lose [...]The post The meanings of life appeared first on Aeon Magazine. http://ow.ly/2zVMCP
3
1

"Humans evolved minds that chatter all day because chattering aloud is how we survive" - that could be my life's credo :)
Add a comment...

### Vasilis Vassalos

Shared publicly  -
1
Add a comment...

### Vasilis Vassalos

Shared publicly  -

A surprisingly persuasive argument for why a college education should be completely 100% free. Bonus: a scheme to fund it.
1
Add a comment...

### Vasilis Vassalos

Shared publicly  -
1
Add a comment...

### Vasilis Vassalos

Shared publicly  -

How a key works.  That's the best use of an animated GIF that I have ever seen. Now I'm off to my lock-picking class.
3
1
Add a comment...
People
In his circles
231 people
Have him in circles
320 people
Work
Occupation
Professor of Computer Science, experience in entrepreneurship, banking&finance, IT and management consulting
Places
Previously
Stanford, CA - Athens, Greece - New York, NY - San Diego, CA - Los Altos, CA
Links
Contributor to
Story
Introduction
This is the correct Vasilis.
Education
• Stanford University
Computer Science, 1994 - 2000
• National Technical University of Athens
Electrical Engineering, 1989 - 1994
Basic Information
Gender
Male


text:
# The natural logarithm of -1

Whilst going over old material, I remember a friend had told me something that was I found quite interesting a while ago about logarithms, and it's troubled me enough for the past few minutes for me to come to fellow mathematics enthusiasts for some insight regarding this conundrum.

If you were to enable imaginary numbers on a calculator, or even do this out by hand, it's found that:

$ln { (-1) } =\pi i$

I have a good understanding of logarithms to know what this technically means, but I'm curious as to why it is.

How come ${ e }^{ \pi i } = { (-1) }$ ? How does the ratio of the circumference of a circle to it's diameter and a complex number come into play in exponential and logarithmic functions?

Note by Andrew Tawfeek
4 years, 10 months ago

This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.

When posting on Brilliant:

• Use the emojis to react to an explanation, whether you're congratulating a job well done , or just really confused .
• Ask specific questions about the challenge or the steps in somebody's explanation. Well-posed questions can add a lot to the discussion, but posting "I don't understand!" doesn't help anyone.
• Try to contribute something new to the discussion, whether it is an extension, generalization or other idea related to the challenge.

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in $$ ... $$ or $ ... $ to ensure proper formatting.
2 \times 3 $2 \times 3$
2^{34} $2^{34}$
a_{i-1} $a_{i-1}$
\frac{2}{3} $\frac{2}{3}$
\sqrt{2} $\sqrt{2}$
\sum_{i=1}^3 $\sum_{i=1}^3$
\sin \theta $\sin \theta$
\boxed{123} $\boxed{123}$

Sort by:

Hmm , complex numbers is not my forte too .

I'm sure you must be knowing that $e^{ix} = \cos x + i \sin x$ . So replace $x$ by $\pi$ ,to get your answer .

- 4 years, 10 months ago

This is actually my first time hearing of that identity! Is that where the Eulurs number came from?

- 4 years, 10 months ago

Do you know MacLaurin's expansion? You may use it to get that identity.

- 4 years, 10 months ago

This is my first time hearing of it, I'll be sure to look into it, it looks really interesting!

- 4 years, 10 months ago

Complex logarithms are actually periodic with period $2\pi$

- 4 years, 10 months ago

Khanacademy teaches this part well. On how the Euler identity comes about. Look up a few of the videos.

- 4 years, 10 months ago

What all topics did you learn from Khan Academy ?

- 4 years, 10 months ago

idk... This was a long time ago, and one of the first thing i learnt from there. Afterwards I did a lot of organic chemistry. But that's it. Haven't logged onto it for many months.

- 4 years, 10 months ago

I didn't know that they had Org Chem videos , I just learned Math from there .

- 4 years, 10 months ago

Chem is good, but not good enough for JEE, or even board. Math class at our coaching institute is very good, so I didn't have to look to other sources. I finally had to learn all of chemistry on my own though.Hey, I you got my email id right? If not: raghav1900@gmail.com

- 4 years, 10 months ago

What are your views on a possible geometric interpretation ?

- 4 years, 10 months ago


text:
# R glm probit regression marginal effects

I am using R to replicate a study and obtain mostly the same results the author reported. At one point, however, I calculate marginal effects that seem to be unrealistically small. I would greatly appreciate if you could have a look at my reasoning and the code below and see if I am mistaken at one point or another.

My sample contains 24535 observations, the dependent variable x028bin is a binary variable taking on the values 0 and 1, and there are furthermore 10 explaining variables. Nine of those independent variables have numeric levels, the independent variable f025grouped is a factor consisting of different religious denominations.

I would like to run a probit regression including dummies for religious denomination and then compute marginal effects. In order to do so, I first eliminate missing values and use cross-tabs between the dependent and independent variables to verify that there are no small or 0 cells. Then I run the probit model which works fine and I also obtain reasonable results:

probit4AKIE <- glm(x028bin ~ x003 + x003squ + x025secv2 + x025terv2 + x007bin + x04chief + x011rec + a009bin + x045mod + c001bin + f025grouped, family=binomial(link="probit"), data=wvshm5red2delna, na.action=na.pass)

summary(probit4AKIE)

However, when calculating marginal effects with all variables at their means from the probit coefficients and a scale factor, the marginal effects I obtain are much too small (e.g. 2.6042e-78). The code looks like this:

ttt <- cbind(wvshm5red2delna$x003, wvshm5red2delna$x003squ, wvshm5red2delna$x025secv2, wvshm5red2delna$x025terv2,
wvshm5red2delna$x007bin, wvshm5red2delna$x04chief, wvshm5red2delna$x011rec, wvshm5red2delna$a009bin, wvshm5red2delna$x045mod, wvshm5red2delna$c001bin,
wvshm5red2delna$f025grouped, wvshm5red2delna$f025grouped,wvshm5red2delna$f025grouped, wvshm5red2delna$f025grouped,wvshm5red2delna$f025grouped,wvshm5red2delna$f025grouped,
wvshm5red2delna$f025grouped,wvshm5red2delna$f025grouped,
wvshm5red2delna$f025grouped) #I put variable "f025grouped" 9 times because this variable consists of 9 levels ttt <- as.data.frame(ttt) xbar <- as.matrix(mean(cbind(1,ttt[1:19]))) #1:19 position of variables in dataframe ttt betaprobit4AKIE <- probit4AKIE$coefficients

zxbar <- t(xbar) %*% betaprobit4AKIE

scalefactor <- dnorm(zxbar)

marginprobit4AKIE <- scalefactor * betaprobit4AKIE[2:20]

#(2:20 are the positions of variables in the output of the probit model 'probit4AKIE'
#(variables need to be in the same ordering as in data.frame ttt), the constant in
#the model occupies the first position)

marginprobit4AKIE #in this step I obtain values that are much too small

-
I don't know the formula you are trying to implement, but dnorm cannot possibly be right: it is the normal density, which will be very small at most points. – Aniko Apr 27 '11 at 20:33

I think there are at least 3 types of marginal effects for a non-linear model like the probit. Authors are often unclear about which one they are using. The marginal effect at the mean (MEM) is what Matt Simpson described. That's the derivative evaluated at the mean values of the explanatory variables. There is also the average marginal effect: $AME=\frac{1}{N}\sum_{i=1}^{N}\frac{\partial \Pr \left( y_{i}=1|x_{1},...,x_{k}\right) }{\partial x_{j}}=\frac{1}{N} \sum_{i=1}^{N}\phi \left( \alpha +\beta _{1}x_{1i}+...+\beta _{k}x_{ki}\right) \beta _{j}$, where $\phi$ is the standard normal density function. That is the average of derivatives for everyone in your sample. There is also the marginal effect at a representative value (MER), which is kind of like the MEM, but the values of explanatory variables are chosen to be representative, perhaps means or medians for continuous and modes for categorical. For dummy variables, the logic is analogous, but you should use the approach written up by Matt. If you got the dummy version working, you can also treat continuous variables the same way. Here's one's an example of how to do this with the dummies with R. Here's one for continuous variables.
Make sure that you're calculating the marginal effects correctly. For a continuous variable, the marginal effect is $\frac{\partial \mathrm{Prob}(y_i=1|\mathbf{\bar{x}},\mathbf{\beta})}{\partial x_j}$. These are typically rather small. However for a dummy variable, thinking about the partial derivative isn't very useful, so instead we define the marginal effect as $\mathrm{Prob}(y_i=1|x_j=1,\mathbf{\bar{x}_{-j}},\mathbf{\beta})-\mathrm{Prob}(y_i=1|x_j=0,\mathbf{\bar{x}_{-j}},\mathbf{\beta}))$
In the context of the Probit regression model, the marginal effect for a continuous variable $x_j$ is $\phi(\mathbf{\bar{x}}'\mathbf{\beta})\beta_j$ On the other hand, the marginal effect for a dummy variable $x_j$ is $\Phi(\mathbf{\bar{x}}_{j1}'\mathbf{\beta})-\Phi(\mathbf{\bar{x}}_{j0}'\mathbf{\beta})$ where $\mathbf{\bar{x}}_{j1}$ is $\mathbf{\bar{x}}$ except the $j$'th element is replaced by 1 and $\mathbf{\bar{x}}_{j0}$ is the same except the $j$'th element is replaced by 0.


text:
New Sexy Snakeskin Floral Bandini

Regular price
\$27.00
Sale price
\$27.00
Regular price
\$40.00
Sold out
Unit price
per

*Tag Size:S-L. Please make sure that these actual measurements will fit you.

 Size Chart( 1 inch=2.54cm) Size Unit Bust Waist S cm 66-70 66-70 inch 26-27.6 26-27.6 M cm 70-74 70-74 inch 27.6-29.1 27.6-29.1 L cm 74-78 74-78 inch 29.1-30.7 29.1-30.7
Measured before being stretched.Known as Laid Flat Data.Please allow1~2cm deviation? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

* Item Fabric: Polyester
* Item Color: One Color(As Pictures Show)
* Item Condition:100% Brand New
* Item Description: New Sexy? Snakeskin Floral Bandini
* Package Contents: 1*Swimwear(NO Accessories Included)

How to choose proper size?

1) Use similar garment to compare with the sizes
2) Choose larger sizes if your sizes are same as the flat measurement size chart

Notes:

1. The real color of the item may be slightly different from the pictures shown on website caused by many factors such as brightness of your monitor and light brightness.
2. Please allow slight (¡À2cm)manual measurement deviation for the data.


text:
# How does the resistor at the tail act as a current source in a differential pair?

Here is a version of differential pair:

I can understand the working principle of differential pair above. When Ic1 increases Ic2 decreases that's the thing. And for that to happen the tail current must be constant. And the above differential pair example is using current source at the tail which makes this idea work. But have a look at below:

In the above version there's no current source but just a resistor at the tail. How is the tail current kept constant by that resistor Re? Or am I misunderstanding something here?

Edit:

Finally after reading τεκ's answer I started to understand. Below is an example how we can replace a "voltage source in series with a resistor" with a "current source in parallel with the same resistor". I added disturbance to see how much the current is regulated. I and II shows that source transformation which was the keyword to make things sense. Black plot of the current for I and II is identical which proves this. In III I've increased the source impedance of that equivalent current source and that shows us that moving to an ideal current source makes the current variation much smaller as shown in the red plot.

An ideal current source has infinite output impedance (i.e. $dV/dI = \infty$). A real current source is equivalent to an ideal current source in parallel with some finite output impedance Ro.

A current source in parallel with a resistor is equivalent to a voltage source in series with a resistor (source transformation).

simulate this circuit – Schematic created using CircuitLab

So the long-tail resistor in your circuit is just a non-ideal current source.

simulate this circuit

In the traditional vacuum tube version, V- would be a very large voltage and Re would be a very large resistance, so that the resulting current was correct but it was closer to the ideal of infinite resistance.

• Thanks a lot finally things made sense to me. Please also see my edit. – floppy380 Apr 5 '18 at 18:04

First of all, the 'tail' resistor is a current sink, not a source. No need to get into semantics over this.

In many low cost designs resistors are used with the understanding that they limit dynamic range by not regulating the current, which also limits the working voltage range. The constant current sink you saw in the first version is typical of op-amps and other IC's where it is easy to implement current sources and sinks all over the place. Being on the same die helps a lot to avoid temperature drift and external noise. A medium value resistor in the 10K to 50K is treated as if it were a current sink, because so little current flows to begin with. It cannot be more than the sum of Q1 current and Q2 current.

However, for boards made with discrete parts it becomes a tyranny of numbers, because each source or sink must be made with temperature stable parts. Special 5 pin dual transistors can be used as differential inputs or current mirrors, but it starts to consume space and drives up the cost.

Yes there are amplifiers made by Crown and Cerwin Vega that are built like that, but they are thousands of dollars each, just to get a 70V/uS slew rate and 130dB dynamic range, for 500 to 5,000 watts.

It comes down to cost vs. required or mandated performance. In IC's it is easy to just lithograph all the extra goodies that make an excellent op-amp or other analog IC.

Note that many RF IC's in the GHZ range avoid current sinks or sources as they have more capacitive loading then a resistor, but they usually consume more current than audio IC's or slow micro-power IC's.

• But I'm not asking why resistor is used instead of current source. I'm asking how does that resistor keep the current roughly/almost constant? How does it act as if it is a current source? – floppy380 Mar 23 '18 at 2:28
• Oh so its purpose is not to keep the current constant at all? I really thought it was. But what is its real purpose? I thought the idea of diff pair is to decrease Ic1 when Ic2 increases or the other way around. But that can only be done by a current source. Could you explain how Re makes things work here? Thanks – floppy380 Mar 23 '18 at 2:34
• No forget about the current source version; Im wondering how does the pair with resistor work. – floppy380 Mar 23 '18 at 2:35
• Hmm I still dont understand how this works. I thought the whole idea is to make Ic1+Ic2 = constant – floppy380 Mar 23 '18 at 2:37
• @pipe What Im trying to understand is not that imperfection. Im trying to understand how does it even mimic a "constant current sink" even though it is not ideal. How does a resistor act like a "sort of non ideal constant current sink" in that tail. Even though it doesn't regulate the current perfect, something make it enough to be used as a current regulator. I dont know what. We dont put an inductor there but a resistor. Why a resistor? I needed an analytic step by step explanation. – floppy380 Mar 23 '18 at 16:27

The resistor keeps the tail current fairly constant, constant enough.

If the magnitude of V- is much more than the of Vin range, then the current is fairly constant indeed.

There is a common mode gain, RC/2RE, but it's much smaller than the differential gain, RC/2(Qx intrinsic Re), and for many purposes, this degree of CMRR is sufficient.

You'll notice there's no resistor used between Q1/2 emitters to reduce the differential gain, so this gain stays very high. Where this degeneration is used, the CMRR is much less, and a current source may be used in the tail to increase it again.

The emitter resistor behaves approximately like a current source provided the base emitter resistance is much smaller and that you only consider the small signal model. Forget about the differential pair for now and consider the common emitter amplifier. The emitter current is $$I_\mathrm{e} = \frac{V_\mathrm{in}}{r_\mathrm{e} + R_\mathrm{E}} \approx \frac{V_\mathrm{in}}{R_\mathrm{E}},$$ using the fact that the base emitter resistance is small. Under the small signal assumption the voltage across the emitter resistor will remain relatively constant. Therefore the emitter resistor behaves approximately like a constant current source.

"How is the tail current kept constant by that resistor Re?"

No - it cannot be kept constant. However, the total current change can be kept very low. Just imagine that the long-tailed pair is excited with a small signal voltage Vin(+) only (Unsymmetrical operation with Vin-=0). In this case, the diff. amplifier can be seen as a common collector-common base series connection.

Now, let`s write down the collector current changes in both transistors, caused by Vin(+). Of course, Ic1=Ic2 with gm1=gm2=gm.

(1) d(Ic1)=gm[Vin(+)-d(Ve)] with d(Ve): Emitter voltage variation.

(2) d(Ic2)=gm[0-d(Ve)].

The small voltage variation d(Ve) is found to be (emitter follower loaded by 1/gm of the second stage): d(Ve)=Vin(+)[gm/(gm + 1/re)] .

Here the diff. resistance re is the effective dynamic resistance at the emitter node (with the input resistance 1/gm of T2): re=(1/gm)||RE.

Therefore,

(1) d(Ic1)=gm[Vin(+)][1-gm/(gm + 1/re)]

(2) d(Ic2)=-gm[Vin(+)][gm/(gm + 1/re)].

Now, for the condition d(Ic1)+d(Ic2)=0 we have

[1-gm/(gm + 1/re)]=[gm/(gm + 1/re)].

Solving this, we see that this equality is possible for re=1/gm only.

This means: Both variations of the collector currents compensate each other only (constant current in the common emitter path) if the differential resistance of the common emitter path re=(1/gm)||RE reduces to re=1/gm which is equivalent to RE>>infinity (Currrent source).

Comment: Therefore, of course both current variations will NOT cancel each other for a finite value of RE. This effect is expressed using the term "Common mode gain" (which is not zero for a finite RE).

A few days ago I decided to see what happens in the forum... and I came across this question. It seemed simple... but actually, the whole philosophy of the differential pair was hidden behind its answer.

Obviously, the HelpMee's “naive” question (persistently repeated several times) is about the nature of the “tail” - he/she wants to know WHAT, HOW and WHY is done there. I perfectly know the answer… but how do I explain it in the possibly simplest way?

OK, let’s start with a short answer: The differential pair consists of two emitter followers connected in parallel to a common load Re so that each of them tries to make the common emitter voltage equal to its input voltage.

At differential mode, they oppose each other by changing their currents in different directions so both voltage across and current through Re stay constant. In this case, the humble resistor does a good job. It should be resistor (not an inductor or something else) to set the common emitter current according to Ohm's law. This current stays constant; only the partial collector currents change (crossfade, redistribute or are steered). We take one of them, convert to voltage by the corresponding collector resistor and use as a single-ended output.

At common mode, the two emitter followers contribute each other by changing their currents in the same direction. As a result, the common voltage across Re and current through Re, partial collector current and output voltage change as well… which is undesirable. To suppress these current variations, we can make Re dynamic. Then when the emitter voltage increases, the Re resistance increases with the same extent and v.v. By this trick we artificially keep constant the ratio Ve/Re in Ohm's law, which is the common emitter current Ie.

See also this RG discussion - Can we reveal the basic idea behind the long-tailed pair and explain its operation in an intuitive way?

(Another clever trick would be to leave the constant ohmic resistor and make Vee variable. When the emitter voltage increases, the Vee magnitude decreases with the same extent and v.v. Thus we artificially keep constant both the voltage across Re - the numerator in Ohm's law, and common current Ie. See the RG discussion Are there situations in which the common emitter current source of the long-tailed pair can be replaced with a humble resistor?)

Now I will answer the question in detail as HelpMee's wants (and I like) - using “an analytic step by step explanation”. I will do it as a fictional story about the invention of the “long-tailed pair”. I will refrain from using special terms that discourage understanding.

1. Single common-emitter amplifier. In this configuration, we apply the input voltage to the transistor base and take the collector current (converted to voltage by the collector resistor) as an output signal. We can change the gain by inserting various “things” with different (differential) resistance dRe between the emitter and ground. Thus the stage acts as an emitter follower loaded with some “load”... but surprisingly, we do not use the voltage drop across this load as an output… instead we use the collector current that creates this voltage drop. Here are three typical cases:

dRe = 0. If we insert a voltage source, voltage stabilizing element (e.g. Zener diode)... or simply ground the emitter, the emitter voltage will be fixed. Figuratively speaking, the emitter is “stiff”, “immovable”. The whole input voltage is applied to the base-emitter junction and the gain is maximum.

dRe = Re. If we insert an ordinary ohmic resistor with static resistance Re, the emitter voltage will begin “moving” in the same direction as the input voltage. Now the emitter is “soft”, “movable”. A part of the input voltage is compensated and the gain is decreased (as they say, there is a negative feedback or emitter degeneration).

dRe -> infinity. If we insert a current source, or more likely, current stabilizing element (usually, a collector-emitter junction of a transistor), the emitter will become extremely “soft” and will exactly follow the input voltage at the base. As a result, the input voltage is fully compensated and the gain is zero.

The conclusion is that we can increase the gain by “hardening” the common emitter voltage and decrease it by “loosening” this voltage. This trick will lead us to the differential pair...

2. Paired common-emitter amplifier. To make a differential amplifier, it is not enough just to take two single common-emitter amplifiers for at least two reasons. First, we want to have a single-ended output but here we have a differential one. Second, they will amplify both input signals - differential and common-mode. Somehow we have to make them amplify as much as possible the differential signal but do not amplify (and even attenuate) the common-mode signal. According to the trick above, this means to “harden” the emitter voltages at differential mode and “soften” them at common mode.

We can do this magic by connecting their emitters to a common current stabilizing resistor (“current source” or a resistor in the simplest case). Now, at differential mode, each of them will fix the other emitter voltage thus providing maximum gain (the other transistor will have the “feeling” that a voltage source is connected in its emitter). At common-mode, both will work on a common current-stabilizing load that provides a minimum gain (both transistors will have the “feeling” that a current source is connected in their emitters).

See also my answer to the question Why the common-mode gain of the differential pair is almost zero?


text:
Sky Watch

IBDesignable is not enough

I was writing a macOS app in Swift, and I needed several text fields accompanied by those little stepper buttons, like what’s shown below. So I decided to write my own control which wraps the text field and the stepper together.

Figure 1. A bunch of NSStepper’s

The custom control itself was simple enough. It was pretty much just a class containing an NSTextField with a formatter and an NSStepper, and that was it (I added a label later).

@IBDesignable
class NumberStepper: NSControl
{
private var Text: NSTextField = NSTextField(string: "0")
private var Stepper: NSStepper = NSStepper()
// ...

func initSubControls()
{
}

override init(frame frameRect: NSRect)
{
super.init(frame: frameRect)
initSubControls()
}

required init?(coder: NSCoder)
{
super.init(coder: coder)
initSubControls()
}

override func draw(_ dirtyRect: NSRect)
{
super.draw(dirtyRect)
}
}

Notice I added an @IBDesignable before the class defintion. This was to say that the interface builder in Xcode should draw this control when I add it to my UI, so that it should show what’s in the control (the text field and the stepper), instead of just a grey box with “custom NSView” written on it. This was not the first time I did this. I had programmed custom views that had complicated draw() behavior, and @IBDesignable worked nicely for them.

But not this time. This was shown in interface builder:

What?!

I consulted the official doc, again, (It took me a while to find, because interestingly enough, this doc is not in Apple’s dev site. It is under help.apple.com.)

1. Above the class declaration in the implementation file, enter @IBDesignable for Swift and IB_DESIGNABLE for Objective-C.

2. Enter the code for your custom view’s draw method.

3. Save the file.

Interface Builder renders the view in the canvas.

What I did should be all I needed. So what was wrong? Was it yet another Xcode bug? I spent over two hours trying to find out why my code failed, yet all the materials pointed to the same thing: it should work. (BTW, none of the blog posts and guides I read had a link to the official doc. None.) As my last resort, I posted a question on Stack Overflow. Stack Overflow is full of smart and kind-hearted people. Surely one of them would point me to the right direction, … … right…?

Minutes after I posted my question, it was flagged by a guy named matt as a duplicate of this question. “Stack Overflow is truely an amazing place,” I thought. With gratitude, I followed the link. Well that question did contain words like “interface builder”, “subclass”, and “render”, etc., but the issue of that setup (complicated draw()) did not apply to my case. The accepted answer was informative, but again the extra information was not useful for me in particular.

But there must be a reason my question was marked as duplicate. That matt guy is a Stack Overflow guru, and he marked my post so fast and so decisively; surely he knew what he was doing. “The solution must be in one of the answers in that question,” I thought. So I started to tinker with prepareForInterfaceBuilder() and TARGET_INTERFACE_BUILDER. I spent over one hour on it, but nothing worked. Eventually I drew the conclusion that the discussion in the duplicated question had little to do with my situation.

Wow, amazing! Thanks for wasting one hour of my life, matt guy! Furthermore, nobody would be able to answer my question anymore, because you cannot do that on a freakin’ duplicate! I noted that under my question, there was a paragraph,

At that point I had already edited my question stating why it was not a duplicate. Probably I would just post a new question like suggested. So I essentially copied my question into a new one. Not surprisingly, another guy came and asked me to delete it and wait for my original question to be unmarked, “or do you want to marked as a spammer?” he asked. Fair enough. And now I’m stuck. I could perhaps reword my question and post yet a new one, but my original question perfectly described the problem; there was no point changing it. Did I expect that matt guy to realize his mistake and unflag my question? No. From experience, I knew a hot-headed guy like him who was not so smart would not ever think about consequences of his/her own action, otherwise s/he would not be hot-headed in the first place, by definition.

Welp, that’s fine. It’s not like I had not solved any problem by myself before. It would just take more time.

After some painful research, I eventually stumbled upon this post. Perhaps I was right to ask if it was an Xcode bug (it was not. But it could use more documentation), and should have posted that question instead. Oh wait, no, never mind; it would just be marked as duplicate by matt.

Anyways, it looked like to me that the way interface builder draws custom views was by “importing” the layer of the views into its canvas. All UIViews are layer-based (which is the case for pretty much all the materials online), so that works. NSViews are not layer-based by default, therefore there is nothing to draw by interface builder, hence the empty box. All I needed to do was turning on layers by setting some properties. And since I did not actually need the layers, I should only do that in the context of interface builder (as opposed to running apps in production). Combining all information, the solution was to put this piece

#if TARGET_INTERFACE_BUILDER
wantsLayer = true
canDrawSubviewsIntoLayer = true
#endif

into my initSubControls(). And sure enough, it worked. You can find the program here.

Figure 2. A working NumberStepper in interface builder. For some reason it is improperly scaled. But that’s detail.

Aaannd as I had expected, one week later, my question on Stack Overflow was still flagged. So I deleted my question.


text:
1. Sep 13, 2004

### Gokul43201

Staff Emeritus
I can't see any LaTeX today. I only see little blue messages asking me to reload the page in a moment. Is it just me ?

2. Sep 13, 2004

### Leong

No, it is everyone! whatever you are going to write with Latex right now, save it in a text file.

3. Sep 13, 2004

### chroot

Staff Emeritus
The site was moved from one sever to another today. I'm not entirely sure, but it's possible the latex images were not moved over properly. Let me go check...

- Warren

4. Sep 13, 2004

### chroot

Staff Emeritus
It seems some (most?) of them were moved properly. I'm not entirely sure what's up right now... Please bear with me.

- Warren

5. Sep 13, 2004

### chroot

Staff Emeritus
It appears to be a directory permissions problem. When it's solved, worst case, you'll have to hit "edit" and "save" on affected posts to regenerate the images in them. I don't have a login on the server right now, but will be able to fix it shortly. Sorry about this, folks!

- Warren

6. Sep 14, 2004

### Dr Transport

Thanks chroot, I thought it was a setting on my machine........we will be patient.

dt

7. Sep 16, 2004

### chroot

Staff Emeritus
Finally, $\LaTeX$ is working again.

If you made posts which used TeX, and those posts were not parsed properly, go back and edit them. You don't have to actually change anything -- just hit the edit button and then the save button, and the images will be automatically updated.

Sorry again for the inconvenience!

- Warren

8. Sep 16, 2004

### Integral

Staff Emeritus
LaTex at last! Latex at last!

Thanks Greg and Warren!

9. Sep 16, 2004

### recon

Those few days without latex were a nightmare for me! I couldn't understand what was being posted in the homework and math forums.

I also realise that the picture attachments of the mentors that Greg has just made in the Member Photo Thread doesn't seem to exist. I think this problem has something to do with the LaTex problem. Even though LaTex works now, the pictures are still not there.

10. Sep 16, 2004

### marcus

Hi Warren, there is no edit button for me to hit.

I just looked at a thread where I used LaTex in several posts and
it does not parse in any of the posts. It is a fairly recent thread
but not so recent that there's and edit button to use.

Have you any suggestions?

it is the thread with this post in it
several posts before that have LaTex (this one doesnt)

Last edited: Sep 16, 2004
11. Sep 16, 2004

### recon

Quite a lot of picture attachments are no longer valid. The chat room is down too.

12. Sep 16, 2004

### chroot

Staff Emeritus
The edit buttons have returned. We had a time limit on editing posts, but I have reset it to zero. Go ahead and edit those posts to have the latex images rendered.

- Warren

13. Sep 16, 2004

### Greg Bernhardt

the chatroom is down because we're getting ready for a chat event with dr. kaku

14. Sep 17, 2004

### recon

When will this chat event be held? Will it be opened to everyone?

15. Sep 17, 2004


text:
# Which has one monochlorination possibility?

Which would have one monochlorination possibility?

2,2-dimethylpropane:

or 2-methylpropane:

It seems I'm missing something because I thought both would only have one monochlorination possibility. (unless I am allowed to substitute the additional H on the 2-methylpropane with a Cl?)


text:
# Electromagnetism - Quadrupole , Octupole

1. Nov 3, 2009

### syracuse1234

1.Calculate the electric field of a quadrupole in spherical coordinates.

2.Calculate the electric field of a octupole in spherical coordinates.

2. Nov 4, 2009

### Troels

There seems to be missing some information here. How exactly are those multi-poles arranged? equal charges? equal distances? Regular polygons? "a quadupole" or "an octopole" are very wide terms indeed

3. Nov 4, 2009

### clem

Use the multipole expansion for the potential in terms of Legendre polynomials for the case of an axially symmetric chargel distribution. If itr is not axially slymmetric, you need the spherical harmonic expansion.

4. Nov 9, 2009

### sci.chris

Also see Boas (Math Methods) Ch. 12 sect.5 ex. 1 for future reference. Solution if You have 2 +ve charges Q at +/- "a" on y axis and 2 -ve charges Q at +/- "a" on x axis is $$V=\frac{-3Qa^{2}cos(2\theta)}{4\pi\epsilon_{0}r^{3}}$$