text:
## marianopolis one year ago A rope is tied to a large crate, which is sitting on a flat surface. The coefficient of static friction between the crate and the ground is 0.9. If a person is to pull on the rope with the minimum force needed such that the crate begins to slide, the angle between the rope and the ground should be A) greater than 0 degrees but less than 90 degrees B) 0 degrees (rope is horizontal) C) 90 degrees I know the answer is A.

1. marianopolis

Now, I was trying to prove it: horizontal pulling: F=ukmg. greater than 0 degrees but less than 90 degrees: Horizontal component: uk(mg-sinthetaF) (Let F be magnitude of force.) Vertical component: costhetaF Total magnitude: (Pythagoras) and (sin^2theta+cos^2theta=1) 0.81mg-1.8sinthetaF+F^2=Magnitude. How do I prove 0.81mg-1.8sinthetaF+F^2 > 0.9mg?

2. theEric

Hi! I want to follow this from the beginning. You are using two different $$F$$'s, right? So let's say $$F_f=\mu_kmg$$ and $$F$$ is the minimal force we're looking for. Then we'll define $$\theta$$ to be the angle between the ground and rope length, like you did I think.. Then the vertical component is $$\mu_kF_N=\mu_k(mg-F\sin\theta)$$ And the horizontal is $$F\cos\theta$$ Besides switching the horizontal and vertical components, we're on the same page. And then you look to identify the total force. $$\sqrt{\left(\mu_k(mg-F\sin\theta)\right)^2+\left(F\cos\theta\right)^2~~}$$ $$=\sqrt{\mu_k^2(mg-F\sin\theta)^2+\left(F\cos\theta\right)^2~~}$$ $$=\sqrt{\mu_k^2(m^2g^2-mgF\sin\theta+F^2\sin^2\theta)+\left(F\cos\theta\right)^2~~}$$ $$=\sqrt{\mu_k^2(m^2g^2-mgF\sin\theta+F^2\sin^2\theta)+F^2\cos^2\theta~~}$$ $$=\sqrt{\mu_k^2m^2g^2-\mu_k^2mgF\sin\theta+\mu_k^2F^2\sin^2\theta+F^2\cos^2\theta~~}$$ And we can't isolate the $$\sin^2\theta+\cos^2\theta$$. Also, I see different powers of $$F$$ in there.

3. theEric

Although I guess we should use $$\mu_s$$ for static friction.

4. theEric

Wait... I did that wrong. I looked at everything all wrong... It's been a long day!

5. marianopolis

Dang!

6. theEric

Haha, I'm about to take another look, sorry.

7. marianopolis

No problem. What you have done, I already consider great ;)

8. theEric

Haha, it's wrong, don't look at it too long! :)

9. theEric

I guess we can say the horizontal component of $$F$$ is $$F\cos\theta$$ And this should be greater than the maximum static friction force, which is given by $$F_f=F_N\mu_s=(mg-F\sin\theta)\mu_s$$ So, $$F\cos\theta>(mg-F\sin\theta)\mu_s=mg\mu_s-F\sin\theta\ \mu_s$$ $$\implies F\cos\theta+F\mu_s\sin\theta>mg\mu_s\\ \implies F(\cos\theta+\mu_s\sin\theta)>mg\mu_s\\ \implies F>\dfrac{mg\mu_s}{\cos\theta+\mu_s\sin\theta}$$ Note for the inequality: when multiplying or dividing the inequality, a negative sign will flip the inequality. We are looking at the range from $$0^\circ$$ to $$90^\circ$$, in which both $$\sin\theta$$ and $$\cos\theta$$ are positive. So, $$\cos\theta+\mu_s\sin\theta$$ is positive, and we don't flip the inequality for those angles. Since $$\cos\theta+\mu_s\sin\theta$$ is in the denominator, it can't be $$0$$. But that's not a worry unless $$\mu_s=0$$ and $$\theta=90^\circ$$, but $$\mu_s\neq0$$, so our denominator is okay. The whole term that $$F$$ must be greater than is a minimum for the angles where the denominator is largest. So... And I would imagine that you're sick of the denominator, but $$\cos\theta+\mu_s\sin\theta$$ must be maximum. Which really depends on $$\mu_s$$. If $$\mu_s$$ is close to $$0$$, then the denominator is about $$\cos\theta+0\dot\ \sin\theta=\cos\theta$$ which maxes at $$0^\circ$$. If $$\mu_s$$ is huge, like $$9999$$, then the denominator is $$\cos\theta+9999\dot\ \sin\theta$$ So, it makes sense that $$9999\dot\ \sin\theta$$ will be the most deciding term. So, if you want the denominator big, put your stock in the sine function. For the sine function to be greater, you want $$\theta$$ closer to $$90^\circ$$. If $$\mu_s$$ something lower, then you'll want $$\theta$$ to be somewhere in-between.

10. marianopolis

Okay, I am half-way through.

11. marianopolis

Eric, when we say "The whole term that F must be greater than is a minimum for the angles where the denominator is largest.", what de we mean? Why does that have to be true? Now, I seem to be missing the central point here ([ashamed]). How did we prove that F directed at a certain angle is the minimal force?

12. marianopolis

do we mean*

13. theEric

I actually haven't solved for the best angle sorry.. Just thinking... And that is from $$F>\dfrac{mg\mu_s}{\cos\theta+\mu_s\sin\theta}$$ So, $$F$$ can be smaller if the denominator is smaller. I think I tried to say too much in one sentence, sorry! That's what math is for anyway. But, if we have $$\frac1x$$, it's smallest when the denominator is largest. So our denominator should be largest. So we pick the $$\theta$$ to make the denominator largest. That is the optimal angle (that I can't find).

14. theEric

Note that $$\mu_s$$ won't ever be $$9,999$$. Unless the crate is sticky, or something. It will probably be a little below $$1$$, like the $$0.9$$ in the problem.

15. marianopolis

Hmm. I am still lost. Where the statement that Fmin is necessarily smaller than Fhorizontal? Sorry, I am really bad at physics.

16. theEric

Don't worry about it! I'm not the best, either. Math is somewhat of a weakpoint, also. But, let's go back to $$F>\dfrac{mg\mu_s}{\cos\theta+\mu_s\sin\theta}$$ and think about $$F=\dfrac{mg\mu_s}{\cos\theta+\mu_s\sin\theta}$$ since it's easier. What would make $$F$$ really small? I mean, we can't $$\rm choose$$ $$m$$, $$g$$, or $$\mu_s$$. All we can adjust is $$\theta$$. To make $$F$$ as small as possible, all we can do is make the denominator as BIG as possible, by changing $$\theta$$. I guess I should go back to the magnitude, for you. Don't read it if you don't want to! Since I did something weird before... First I break up the pulling force again. Horizontal is at least $$F_N\mu_s=(mg-F\sin\theta)\mu_s=mg\mu_s-F\sin\theta\ \mu_s$$ Vertical is just $$F\sin\theta$$. I guess the magnitude would be this, but I don't know how it helps. $$\sqrt{(F\sin\theta)^2+(mg\mu_s-F\sin\theta\ \mu_s)^2~~}$$ $$=\sqrt{F^2\sin^2\theta+m^2g^2\mu_s^2-mg\mu_s^2F\sin\theta+F^2\sin^2\theta\ \mu_s^2~~}$$

17. marianopolis

OHHH

18. marianopolis

ok, I reread the whooole post.

19. marianopolis

I think I am starting to understand.

20. marianopolis

21. marianopolis

So, let me sum up to see if I got this clear.

22. theEric

All that I did is show that it would be best for the angle to be somewhere between $$0$$ and $$90$$ degrees. I didn't find any best angle. Haha, you're trying! I am, too :P So you feel more comfortable with this now?

23. marianopolis

We ended with that relationship. We pluged in 0 and 90 and a random other number. The random number gave a better result.

24. marianopolis

Out of curiosity, how would I find the optimal angle?

25. theEric

That sounds good! Optimal angle... Time for the thinking cap.

26. theEric

So, a formula for the optimal angle as a function of $$\mu_s$$...

27. marianopolis

By the way, if you dont mind me asking, what is your background? You're good at this.

28. theEric

Thanks! I have not shined in this post, but thanks! :) Undergraduate physics and computer science majors at a state university in Pennsylvania.

29. theEric

I've had lots of time to practice :)

30. marianopolis

ohhh ok. ;) that's why

31. theEric

Haha, yep!

32. marianopolis

Could taking the derivative of both sides help? I do not conceptually understand how it would, but the textbook sometimes does that.

33. marianopolis

Oh of course! It finds the minimal value!

34. marianopolis

All those cal courses now come back to me!

35. theEric

I didn't know you knew about derivatives and stuff! Well, derivatives will give you rates of change. It's like a slope. So, you take the derivative of $$f(x)$$ and you get $$\dfrac{{\rm change\ in\ }f(x)}{{\rm change\ in\ }x}$$ |dw:1397356730399:dw|The function has to turn around at maximums and minimums. Then the function's value doesn't change for an instant as the independent variable goes on. Just like when you throw a ball up in the air, it has to stop before it comes down. And at the turn-around point, there is no change, and the derivative is $$0$$. So, if we have a function to describe the force, $$F(\theta)$$, and we differentiate it (find its change) with respect to $$\theta$$... Well, we can look at when it equals $$0$$.

36. theEric

Haha, glad they came back to you!

37. theEric

I don't know how to make it help at the moment, though!

38. theEric

Finding the angle....

39. theEric

Hmm...

40. marianopolis

Well, if we set the derivative to 0, the moment where there will be a min/max value, we'll be able to find the angle.

41. marianopolis

I might be wrong though!

42. theEric

Right! And I didn't think it would work for a certain reason that doesn't matter because it was wrong! But we'd still have to be able to solve for $$\theta$$. If we focus on finding the max of the denominator... $$\dfrac d{dt}(\cos\theta+\mu_s\sin\theta)=-\sin\theta+\mu_s\cos\theta$$

43. theEric

$$-\sin\theta+\mu_s\cos\theta=0$$ $$\implies\mu_s\cos\theta=\sin\theta$$ $$\implies\mu_s=\dfrac{\sin\theta}{\cos\theta}=\tan\theta$$ $$\implies\arctan(\mu_s)=\theta$$ So the best angle is $$\arctan(\mu_s)$$! Cool! :)

44. theEric

The arctan function gives you the angle if you give it the "slope" on the unit circle. So a positive slope is in the first or first or third quadrants|dw:1397360433999:dw| And $$\arctan(x)$$ is always between $$-90^\circ$$ and $$90^\circ$$. So we are limited to the first quadrant, right where we want to be. Long story short, it's good. And there's probably a more algebraic way to go about this. But oh well!

45. theEric

It's weird that we didn't have to find whether it was a minimum or maximum, though.

46. marianopolis

I think it does not matter, we could simply plug the angle back in. This would find F and we could compare with another random value, telling us whether we get a minimum or a max.


text:
An inequality involving binomial coefficients

For $k\leq n$, how do I prove that ${2n \choose n}(1-\frac{k}{n})^{k}\leq{2n \choose n+k}$?

-

1 Answer

Hint: If $0\lt a\leqslant b$, then $\dfrac{a}b\leqslant\dfrac{a+1}{b+1}$.

Application: The hint yields $\dfrac{n-k}n\leqslant\dfrac{n-k+i}{n+i}$ for every $i\geqslant0$. Multiplying these inequalities for $1\leqslant i\leqslant k$, one gets $$\left(\frac{n-k}n\right)^k\leqslant\frac{n-k+1}{n+1}\frac{n-k+2}{n+2}\cdots\frac{n}{n+k}=\frac{n!\,n!}{(n-k)!(n+k)!}.$$ Hence, $${2n\choose n}\left(\frac{n-k}n\right)^k\leqslant\frac{(2n)!}{n!\,n!}\,\frac{n!\,n!}{(n-k)!(n+k)!}=\frac{(2n)!}{(n-k)!(n+k)!}={2n\choose n+k}.$$

-
Thank you, Didier. –  bscptn Jan 11 '12 at 2:20

format: plain


text:
ML-Fundamentals - Decision Trees

Introduction

In this exercise you will train and evaluate a decision tree. Opposed to the previous exercises with the topics univariate linear regression, multivariate linear regression, logistic regression and bias variance tradeoff, you will not implement the algorithms from scratch using numpy. Instead you will use two python packages written on top of numpy, namely the pandas and the scikit-learn package, which are both widely used by the machine learning community. The steps can be broken down into:

1. Load the data from a csv file into a pandas DataFrame object
2. Preprocess the data
3. Train a decision tree and visualize it.
4. Do hyperparameter optimization by dividing the dataset into a fixed training set and a fixed validation set.
5. Do hyperparameter optimization by crossvalidation
6. Do hyperparameter optimization by gridsearch

Afterwards, show that you understand, what computations are done by the scikit-learn package you have used by manually computing:

1. The entropy for one node
2. The information gain for one node

Note:

As this exercise heavily focuses on the usage of the high-level APIs pandas and scikit-learn, reading their documentations (just the parts corresponding to the current task) is strongly recommended:

Requirements

Knowledge

You should have a basic knowledge of:

• Decision Trees
• Entropy
• Information gain
• Crossvalidation

Python Modules

By deep.TEACHING convention, all python modules needed to run the notebook are loaded centrally at the beginning.

import numpy as np
import pandas as pd

from sklearn.preprocessing import Imputer # in newer versions: from sklearn.impute import SimpleImputer as Imputer
from sklearn import tree
from sklearn.externals.six import StringIO
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import GridSearchCV
from graphviz import Source

Teaching Content

Decision Trees for Classification

In a decision tree the data is split at each node according to a decision rule. This corresponds to nested if-then-else-rules. In the if-part of such a rule are decison is made based on a feature of the data record.

We will use the scikit learn implementation. For this implementation the features must be binary or have (at least) ordinal characteristic. If a feature is e.g. nominal with many values, it must be converted to a set of binary (one-hot-coded) features.

The splitting rules in the scikit learn implementation are binary and are based on a threshold, e.g.

• if$x_6 <= 2.14$ then left subbranch, else right subbranch.
• binary features must be coded as 0/1, so the rule becomes: if$x_2 <= 0.5$ then left subbranch, else right subbranch.

In the leafs of the tree the (class) predictions are made. There are two possibilities for such an inference:

• hard assignment: Predict for the data records which end up on a leaf by the majority class of the training data that end up on that leaf.
• soft assignment: Assign probabilities according to the distribution of the classes in respect to the training data which end up on that leaf.

As an example of a decision tree we will learn the following tree from the titanic data set:

A full explanation of the tree will be given later. Here just look at the desion rules (first line of the inner nodes) and at the last line of the leafs. In each leaf you see an array (values) with counts of the different targets for the train data: [number_died, number_survivors] .

Learning

Finding a tree that splits the traing data optimal is np-hard. Therefore often a greedy-strategy is used:

To build up a decision tree the algorithm starts at the root of the tree. The feature and the threshold that splits the training data best (with respect to the classes) are choosen. In an iterative way the whole tree is build up by such splitting rules.

There are different criteria for measuring the "separation (split) quality". The most important ones are:

• Gini Impurity
• Information Gain

In this tutorial we concentrate on the information gain.

Information Gain as Splitting Criterion

The entropy with respect to the target class variable$y$ of a training data set$\mathcal D$ is defined as:

$H(y, \mathcal D) = - \sum_{y \in \mathcal Y} p(y|\mathcal D) \log_2 p(y|\mathcal D)$ with the domain of the target values$\mathcal Y = \{t_1, t_2,... \}$.

The probabilities are estimated by $p(y=t_i, \mathcal D) = |\mathcal D^{(y=t_i)}| /|\mathcal D|$

with the number of training data$|\mathcal D|$ and the number of training data$|\mathcal D^{(y=t_i)}|$ with target label$t_i$:

On a node a (binary) split on a feature$x_k$ is made by the split rule$x_k \leq v$. As result there are two data sets$\mathcal D_0$ and$\mathcal D_1$ for the left resp. the right branch.

The feature$x_k$ and the split value$v$ are choosen that they maximize the 'reduction of the entropy' measured by the information gain$I$: $I(y; x_k) = H(y, \mathcal D) - H(y|x_k) = H(y, \mathcal D) - \sum_{j=0}^1 p_jH(y, \mathcal D_j) = H(y, \mathcal D) + \sum_{j=0}^1 \sum_{y \in \mathcal Y} \frac{|\mathcal D_j|}{|\mathcal D|} p(y|\mathcal D_j) \log_2 p(y|\mathcal D_j)$ Note that$p_{j=0}$ is the estimated probability that a random data record of$\mathcal D$ has feature value$x_k \leq v$ which can be estimated by${|\mathcal D_0|}/{|\mathcal D|}$ (analog for$j=1$). $p(y=t_i|\mathcal D_0)$ can also be estimated by the fraction of the counts${|\mathcal D_0^{(y=t_i)}|}/{|\mathcal D_0|}$. So the information gain can be computed just with counts:

$I(y; x_k) = \sum_{y \in \mathcal Y} \frac{|\mathcal D^{(y=t_i)}|}{|\mathcal D|} \log_2 \frac{|\mathcal D^{(y=t_i)}|}{|\mathcal D|} + \sum_{j=0}^1 \sum_{y \in \mathcal Y} \frac{|\mathcal D_j^{(y=t_i)}|}{|\mathcal D|} \log_2 \frac{|\mathcal D_j^{(y=t_i)}|}{|\mathcal D_j|}$

<!-$|\mathcal D_0|$ respectivly$|\mathcal D_1|$ is the number of elements in the splitted data sets.-->

Overfitting

Deep decision trees generalize often poorly. The following remedies reduce overfitting:

• Limitation of the maximal depth of the tree.
• Pruning with an validation set either during training (pre-pruning) or after training (post-pruning).
• Dimensionality reduction (reducing the number of features before training)

Also often combining decision trees to an ensemble (decision forests) is used against overfitting.

Exercises

First we read in the titanic data set with pandas

1. Complete the code to load the dataset as pandas DataFrame object.
### Exercise: Load the csv file as pandas DataFrame
url = 'https://gitlab.com/deep.TEACHING/educational-materials/raw/master/datasets/titanic-train.csv'
train_df = None

The DataFrame class implements (and overwrites) a lot of (standard) methods. Some of the are:

### Not an exercise, just execute the cell

print(train_df.ndim)
print(train_df.shape)
### Not an exercise, just execute the cell

### To view the dataset as pretty table (when using jupyter)
train_df
### Not an exercise, just execute the cell

### To return the data as numpy array:
train_df.values
### Not an exercise, just execute the cell

### To return just certain features (columns)
train_df[['PassengerId', 'Survived', 'Sex']].values

Data Preprocessing

Feature Transformation

Scikit's learn decision trees can handle only numeric data. So we must convert the nominal Sex feature.

Convert the nominal feature into a binary feature.

### Exercise: Convert to binary feature
train_df["Sex"]
train_df["Sex"].values.sum()

Feature Selection

Survived is the target, that we want to predict from the values of the other columns.
But not all of the other columns are helpful for classification. So we choose a feature set by hand and convert the features into a numpy array for scikit learn.

1. Query the values of the feature we have chosen as target feature (class) and save them as numpy array
2. Query the values of the features we want to use for training ("Fare", "Pclass", "Sex", "Age", "SibSp") and save them as numpy array.
y = None # Exercise: Extract target feature "Survived" as 1D array
x = None # Exercise: Extract the features we want to use for training as 2D array

Missing Values

There are missing values (NaN) for some examples in the "Age" column. Use the scikit learn Imputer class to replace them by the mean of the columns.

# TODO as Exercise

Training and Visualization

Now we are ready to define and learn a decision tree by the criterion 'entropy' and we restrict the depth of the tree to 3. We use the scikit learn decison tree module.

Define and train the model.

clf = None # Exercise: Define and train the classifier

clf is an instance of a trained decision tree classifier.

The decision tree can be visualized (after training). For this we must write an graphviz dot-File

graph = Source(tree.export_graphviz(clf, out_file=None
, feature_names=columns, class_names=['survived', 'survived']
, filled = True))
graph

According to the decision tree the main criterion (root node) for survival is the sex of the passenger (if your implementation is correct so far). In the left subtree are the male passengers (sex = 0), in the right subtree the female (sex=1).

In the leafs the class information is given by a value array. Here the second value is the number of survivers in the leafs.

For example the leftmost leaf represents passengers that are male (sex=0) with fare<=26.2687 and age<=13.5. 13 of such boys survived and 2 of them died.

The entropy$- \sum p_i \log_2 (p_i)$ is displayed also at each node (splitting criterion).

Prediction / Validation

To make predictions with scikit learn, we must convert the data in the same way as we did it with the training data. Then we could use the method:

clf.predict(validation_data)

The depth of the decision tree is a hyperparameter. So the depth should be determined with the help of a validation set or by cross validation.

1. Manually split your training data in 75% for training and 25% for validation
2. Repeat the training process several times for different tree depths (define a new model every time)
3. Use clf.predict(validation_data) to predcit your validatipon data
4. Manually calculate the accuracy for the validation set each time
• Accuracy is defined as$\frac{\text{number of correct predictions}}{\text{number of all predictions}}$
1. From your results: Which seems to be the best tree depths?
### Exercise: Your code below to divide x and y

### Exercise: Your code below to train and predict trees with different depths

for depth in range(1,20):
pass

Crossvalidation

Now with a dataset with less than 900 data examples (we have 891), chances to unluckily divide training and validation split seem pretty high. Also "wasting" 25% for validation on such a small data set is also not the ideal solution.

Now do not manually divide your data and do not manually compute the accuracy. Instead use the function sklearn.model_selection.cross_val_score to search the best tree depth. Use 10-fold crossvalidation.

### Exercise: Your code below for crossvalidation

for depth in range(1,20):
pass

Gridsearch

This already works pretty well to determine one hyperparameter. But imagine you had several hyperparameters. Since the computation (even with 10 fold crossvalidation) is very fast for decision trees, it is no problem at all to try out every possible combination of hyperparameters. For each hyperparameter you would have to implement another for-loop. Should be no problem. But for convenience, you should know sciki-learn also has a built-in function for that.

Use sklearn.model_selection.GridSearchCV to do a grid search for the best hyperparameters. In addition to max_depth parameter between [1, 20], add the criterion as another hyper parameter with the possible values "entropy" and "gini".

Further useful functions after the grid search: clf.best_score_ and clf.best_params_

### Exercise: Your code below for grid search

Splitting Criterion Entropy / Information Gain

As you might have noticed, packages like scikit learn can be very comfortable, since they do most of the work for you as long as you provide the data in the right format. Though a good advice is, that you should know what happens inside of such a black box.

Recompute the root node entropy. On Pen & paper or with just some lines of code here using basic mathematical operations.

# Code below
np.testing.assert_almost_equal(entropy_before_split, 0.9607079018756469)

Compute the information gain of the first split node (root node). Use the shown entropy values and number of data records (samples). Again on Pen & paper or with just some lines of code here using basic mathematical operations.

# Code below
np.testing.assert_almost_equal(information_gain_split_root_node, 0.2176601066606142)

Compute the information gain of the following split table:

The numbers are the corresponding data records, e.g. there are 13 data records with target class 1 and feature$\le$ v.

Write a python function that computes the information gain.The data is given by a python array:

Like always, you are free to write as many helper functions as you want.

data = np.array([[2.,13.],[359., 41.]])
def information_gain(data):
raise NotImplementedError()
np.testing.assert_almost_equal(information_gain(data), 0.07765787804281093)
print("Information Gain:", information_gain(data))

[TODO]

Literature

The following license applies to the complete notebook, including code cells. It does however not apply to any referenced external media (e.g., images).

Exercise: Logistic Regression and Regularization
by Christian Herta, Klaus Strohmenger


text:
# Current Density (J)

Current density at any point inside a conductor is defined as a vector having magnitude equal to current per unit area surrounding that point. Remember area is normal to the direction of charge flow (or current passes) through that point.
• Current density at point P is given by

Fig. 3
• If the cross-sectional area is not normal to the current, but makes an angle θ with the direction of currentm then

di = JdA cos θ
• If current density is uniform for a normal cross-section , then J = i/A.
• Current density is a vector quantity. Its direction is same as that of . Its SI unit is amp/m2 and dimension [L–2A].
• In case of uniform flow of charge through a cross-section normal to it as i = nqvA J = i/A = nqv.

Fig. 4
• Current density relates with electric field as , where σ = conductivity, and ρ = resistivity or specific resistance of substance.


text:
# Is this number a prime?

Believe it or not, we do not yet have a code golf challenge for a simple primality test. While it may not be the most interesting challenge, particularly for "usual" languages, it can be nontrivial in many languages.

Rosetta code features lists by language of idiomatic approaches to primality testing, one using the Miller-Rabin test specifically and another using trial division. However, "most idiomatic" often does not coincide with "shortest." In an effort to make Programming Puzzles and Code Golf the go-to site for code golf, this challenge seeks to compile a catalog of the shortest approach in every language, similar to "Hello, World!" and Golf you a quine for great good!.

Furthermore, the capability of implementing a primality test is part of our definition of programming language, so this challenge will also serve as a directory of proven programming languages.

Write a full program that, given a strictly positive integer n as input, determines whether n is prime and prints a truthy or falsy value accordingly.

For the purpose of this challenge, an integer is prime if it has exactly two strictly positive divisors. Note that this excludes 1, who is its only strictly positive divisor.

Your algorithm must be deterministic (i.e., produce the correct output with probability 1) and should, in theory, work for arbitrarily large integers. In practice, you may assume that the input can be stored in your data type, as long as the program works for integers from 1 to 255.

### Input

• If your language is able to read from STDIN, accept command-line arguments or any other alternative form of user input, you can read the integer as its decimal representation, unary representation (using a character of your choice), byte array (big or little endian) or single byte (if this is your languages largest data type).

• If (and only if) your language is unable to accept any kind of user input, you may hardcode the input in your program.

In this case, the hardcoded integer must be easily exchangeable. In particular, it may appear only in a single place in the entire program.

For scoring purposes, submit the program that corresponds to the input 1.

### Output

Output has to be written to STDOUT or closest alternative.

If possible, output should consist solely of a truthy or falsy value (or a string representation thereof), optionally followed by a single newline.

The only exception to this rule is constant output of your language's interpreter that cannot be suppressed, such as a greeting, ANSI color codes or indentation.

• This is not about finding the language with the shortest approach for prime testing, this is about finding the shortest approach in every language. Therefore, no answer will be marked as accepted.

• Submissions in most languages will be scored in bytes in an appropriate preexisting encoding, usually (but not necessarily) UTF-8.

The language Piet, for example, will be scored in codels, which is the natural choice for this language.

Some languages, like Folders, are a bit tricky to score. If in doubt, please ask on Meta.

• Unlike our usual rules, feel free to use a language (or language version) even if it's newer than this challenge. If anyone wants to abuse this by creating a language where the empty program performs a primality test, then congrats for paving the way for a very boring answer.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

• If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck derivatives like Headsecks or Unary), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

• Built-in functions for testing primality are allowed. This challenge is meant to catalog the shortest possible solution in each language, so if it's shorter to use a built-in in your language, go for it.

• Unless they have been overruled earlier, all standard rules apply, including the http://meta.codegolf.stackexchange.com/q/1061.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf; these are still useful to this question as it tries to compile a catalog as complete as possible. However, do primarily upvote answers in languages where the author actually had to put effort into golfing the code.

### Catalog

The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:

## [><>](http://esolangs.org/wiki/Fish), 121 bytes

• Can I take inputs as negative numbers, where abs(input) would be the number I am testing? – Stan Strum Sep 6 '17 at 3:40
• Is there a reason for the full program requirement, rather than allowing the full range of default input types? E.g. answering with a function that takes its input as an argument, is currently disallowed? codegolf.meta.stackexchange.com/questions/2447/… – Lyndon White Dec 12 '17 at 6:21
• @LyndonWhite This was intended as a catalog (like “Hello, World!”) of primality tests, so a unified submission format seemed preferable. It's one of two decisions about this challenge that I regret, the other being only allowing deterministic primality tests. – Dennis Dec 12 '17 at 12:51
• @Shaggy Seems like a question for meta. – Dennis Jun 25 '18 at 13:44
• Yeah, that's what I was thinking. I'll let you do the honours, seeing as it's your challenge. – Shaggy Jun 25 '18 at 13:45

# Python 3, 42 55 bytes

n=int(input());print(sum(n%m<1 for m in range(1,n))==1)

Try it online!

The n%m<1 comparison is sufficient to check that n is a multiple of m. I start the range at 1 to correctly handle the case n == 1.

# Go, 231 bytes

package main
import."fmt"
type c chan int
func main(){a,k:=0,make(c);Scan(&a);go func(d c){for i:=2;;i++{d<-i}}(k)
for{p:=<-k;if a==p||a<p{Print(a==p);break};j:=make(c)
go func(i,o c,p int){for{j:=<-i;if j%p!=0{o<-j}}}(k,j,p);k=j}}

This solution contains a sieve that generates primes, when the primes exceed the candidate, or there is a match it outputs true for primes and false for non-primes.

The main code is blatantly stolen from this playground example.

Since it is rather silly I probably wont be golfing this solution any further

Try it online!

# Python 2, 51 bytes

p=input()
print all(p%i for i in range(2,p-1))==1<p

Try it online!

# Procedural Footnote Language, 41 bytes

[1]
[PFL1.0]
[1] [PRIME:[INPUT]]
[PFLEND]

## Explanation

This program is fairly straight-forward: The body of the document (above the [PFL1.0] tag) is the result/output, and is equivalent to the evaluated contents of footnote [1]. Footnote [1] evaluates to the result of the [PRIME] function on input from STDIN.

# Reality, 1 byte

P

This takes input via stdinput and return true if it is a prime and false other wise

## Alternate :

If taking input is not allowed then

p number

space is not required (replace number with your number)

Note : Reality is an under-development language and was created after this challenge

# Racket, 67 42 bytes

When run in DrRacket, this will prompt the user for an integer and return #f (false) if the number is not a prime and #t (true) if the number is a prime.

### Previous (and much more complicated) version:

((λ(l)(or(= l 1)(ormap(λ(x)(=(modulo l x)0))(range 2 l))))(read))

# Z80Golf, 30 bytes

00000000: 040c 0934 0c28 0d0a b720 f960 6909 38f4  ...4.(... .i.8.
00000010: 2534 18f9 24cd 0380 6f7e cd00 8076       %4..$...o~...v Try it online! Takes a single-byte input. Outputs a zero byte for prime byte values, and some non-zero byte for composite values. (This value is actually the number of distinct prime divisors!) Disassembly: inc b inc c add hl, bc ; HL = BC =$0101.
; We use $0100~$ffff as a prime sieve array.
inc (hl)    ; Mark 1 as composite.

next:
inc c       ; Loop for C from 2 to 255.
jr z, done
ld a, (bc)
or a
jr nz, next ; If *BC is marked as composite, skip.

; sieve
ld h, b     ; Mark *(BC), *(2*BC-256), *(3*BC-512) ... as composite.
; (So for BC = $0103, this is$0103 $0106$0109 ...)
ld l, c
clear:
jr c, next  ; Run until HL overflows! This is more work than necessary, but shorter.
dec h
inc (hl)
jr clear

done:          ; Now H = 0.
inc h        ; Now H = 1.
call $8003 ld l, a ; Now HL =$0100 + input.
ld a, (hl)
call $8000 ; putchar(*HL) halt # Elixir, 122 bytes o=fn f,p,1->1 f,1,c->0 f,p,c->case rem(p,c)do 0->0 _->f.(f,p,c-1)end end {i,_}=Integer.parse IO.gets"" IO.puts o.(o,i,i-1) Try it online! Can definitely be golfed. Outputs 1 for prime and 0 for composite • This breaks on 1. Otherwise, replacing True by 0<1 and False by 1<0 shortens it a bit. – Ørjan Johansen Jun 21 '18 at 18:03 • 1 has been fixed, and I just switched True / False out for the easier int equivalents – Dave Jun 21 '18 at 18:49 # Scala, 40 bytes def f(n:Int)= !(2 to n-1).exists(n%_==0) Try it online! • Unfortunately, this challenge doesn't allow functions. – Dennis Jun 25 '18 at 13:49 # Julia 0.6, 44 bytes n=parse(Int,ARGS[]);show(sum(n%(1:n).<1)==2) Try it online! Since the existing answers are invalid for the challenge and/or outdated by newer Julia versions, I'm adding a Julia answer that works in Julia 0.6. For Julia 0.7 (and to avoid deprecation warnings in 0.6), this needs just one more byte (% becomes .%): ### 45 bytes n=parse(Int,ARGS[]);show(sum(n.%(1:n).<1)==2) Try it online! # Foam, 9 bytes ;# #.% .# Foam isn't on TIO yet, but it should be coming soon! Outputs 1 for prime and 0 for nonprime. Foam has a prime checking builtin. ;# <- read number #.% <- is number prime? .# <- output number # Flobnar, 25 bytes %\ @ :&|\< -:1> 1*< >> * Try it online! Outputs 1 for prime, 0 for composite. Uses the -d flag to get numerical input. Be aware that the time it takes for each number doubles, where an input of 18 will take ~6 seconds, and 19 takes ~12 seconds. This is because the algorithm (based on Wilson's theorum) looks somewhat like: def f(n): if n == 0: return 1 else: return n*f(n-1)*f(n-1) print f(input)*f(input)%input So basically the function takes 2n+1 steps, doubling the time it takes for each step. If you want to test the code itself, you can use this (+2 bytes) which is merely 2n steps. It basically removes the surplus extra call of f(n-1) in the return of the function. # Elixir, 75 72 bytes n=String.to_integer IO.gets"" IO.puts Enum.all?2..n-1,&rem(n,&1)>0||2==n Try it online! # Pixiedust, 59 bytes Takes input in the ++ register, and leaves output in the .. register. *.+*.*+. +. .++*++ +*.. **+..+++* *+++*+*.*+ +** +.. .*...* ## Explanation * . +* .*+. Set the +* register to 2 - this is the factor being checked +. Define a label whose name is the empty string . + +* ++ Test whether +* has reached ++ yet +* . . If it has, go to the "." label * *+ .. ++ +* Set the branch register to ++ modulo +* * ++ +* +* .*+ Increment the factor +* * If the branch register is not 0 (meaning it's not a factor) restart the loop +. . The "." label . * .. .* Invert the .. register # Cardinal, 24 21 bytes Thanks to @Jo King for golfing off 3 bytes ### Code: % : =>-!. v#~M!@ - R^ Try it online! ### Explanation: % //Start program : //Read input = //Copy input to inactive value v# //Loop around and pass copy of pointer up and to right after each loop - //Decrement active value by 1 R^ //End program if input=1 *>-!. //If active value =1 print 0 (occurs just before line below ends program) *#~M!@ //If inactive value divisible by active value end program ** ** # F#, 79 84 bytes Fixed as per Dennis's suggestion. stdin.ReadLine()|>int|>fun n->not(Seq.exists(fun i->n%i=0)[2..n-1]||n=1)|>printf"%b" Now works for input = 1. Can be run same as before. Original submission: I didn't see an F# answer so... stdin.ReadLine()|>int|>fun n->not(Seq.exists(fun i->n%i=0)[2..n-1])|>printf"%b" Can be compiled with fsc or run directly in fsi. Takes a newline-terminated string from stdin and spits out a bool to stdout when run. • Unfortunately, that doesn't work for input 1. Try it online! – Dennis Dec 27 '18 at 20:59 • Remember, lambdas are allowed, so... 44? – ASCII-only Jan 31 at 8:38 C#, 116 bytes Non fancy full program entry (cherry-picking some stuff from java): class P{static void Main(string[] a){int i=2,n=int.Parse(a[0]);for(;i<n;)n=n%i++<1?0:n;System.Console.Write(n>1);}} # C++ (gcc), 85 bytes #include<iostream> int main(){int n,d=1;for(std::cin>>n;n%++d%n;);std::cout<<(n==d);} Try it online! • -2 bytes thanks to @ceilingcat # Ungolfed #include <iostream> int main() { int n,d=1; for (std::cin >> n; n % ++d // Trial division. If n dividible by d, end. % n /* No effect when n > 1. But required to make sure the loop ever ends if n == 1 */ ); ) { /* Empty loop body */ } /* d is now the lowest number greater than 1 which divides n (or 2 if n == 1) */ std::cout << (n==d); // If that number is n, n must be prime. } Port of my Ink answer. Competitive in multiple other languages. I wasn't going to post this, but I couldn't find a C++ compiler that would compile the existing C++ answer. • @ceilingcat well spotted, thanks – Sara J Jun 3 at 18:34 # K (oK), 14 19 bytes Solution: 2=+/d=_d:x%!x:. 0: Try it online! Example: root@c957fa0dccbd:/ok# echo 1 | node repl.js examples/prime.k 0 root@c957fa0dccbd:/ok# echo 2 | node repl.js examples/prime.k 1 root@c957fa0dccbd:/ok# echo 5 | node repl.js examples/prime.k 1 root@c957fa0dccbd:/ok# echo 97 | node repl.js examples/prime.k 1 Explanation: Calculate number of factors for input, if equal to 2, then it's prime. 2=+/d=_d:x%!x:. 0: / the solution 0: / read from stdin . / value (ie convert "123" > 123) x: / store input as x ! / range 0..x x% / x divided by ... d: / store as d _ / floor d= / d equal to ... +/ / sum 2= / 2 equals? # Ink, 68 51 bytes -(l) +(n)[+] ->l *(r)[{n}] {n%(r+1)%n:->r|{n==(r+1)}} Ink was made for writing interactive fiction. It was never meant to be a general-purpose programming language. So it only has one way to recieve input. Choice prompts. So the way it works is, if option 2 is labelled with the number you want to check, you pick option 2. Otherwise you pick option 1 to increment option 2's label. So, if you want to check if 15 is prime, you'd input 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 TIO doesn't handle this, unfortunately. -17 bytes by using read counts of named options instead of creating variables. This brings the overhead of taking input this way down to something like 24 characters (or even 18 if we don't care about minimising the text from the prompts), compared to the 10 for defining a parametrised stitch and returning from it. Since full programs can use global variables and read counts, but stitches that have to be reusable can't, using full programs might actually pay off in places where I thought it wouldn't. Neat. # T-SQL, 116 bytes WITH t AS(SELECT 2n UNION ALL SELECT n+1FROM t WHERE n<5e4) SELECT*FROM z,t WHERE p%n=0AND n<p OPTION(MAXRECURSION 0) There is an Oracle SQL answer here, but couldn't find a Microsoft T-SQL version for this classic question. Notes: • Line break is for readability only. • Returns no rows if prime, returns 1 or more rows otherwise. This is allowed per this output rule. • Input is taken via pre-existing table $$\z\$$ with INT field $$\p\$$, per this input rule. • Handles values of $$\p\$$ up to the max value of the INT type, $$\2^{31}-1\$$ Explanation: Generates an in-memory number table $$\t\$$ from 2 to 50k (which exceeds the square root of the max int), then joins to the input table $$\z\$$ and uses the modulo operator % to test for divisibility. Any values that divide evenly are returned, so an empty result means the input is prime. OPTION(MAXRECURSION 0) is needed to recursively generate a table with more than 100 rows, unless you've altered this configuration setting on your SQL server. Optimized for bytes, not speed; checks more values than is strictly necessary. ## Shakespeare Programming Language, 300 176 bytes (whitespace added for readability) h.Ajax,.Puck,.Act I:.Scene I:.[Enter Ajax and Puck] Ajax:Listen tothy. You is the remainder of the quotient betweenthe square ofthe factorial ofthe sum ofyou a pig you. Open heart Try it online! Explanation: Uses Wilson’s theorem to find primality. Due to integer constraints, only works properly for numbers up to 9, but theoretically would work for any integer. I saved a ton of bytes by using builtins for square and factorial that I didn’t know existed before. • Welcome to Code Golf! Unfortunately, the rules require your program to work for all integers between 1 and 255. – Dennis Oct 9 at 14:44 • I'd say that this only doesn't work due to the implementation. If I'm not mistaken, it never says in the specs for SPL that integers should be bounded, so this would work if the interpreter matched the specification – EdgyNerd Oct 9 at 14:59 • @EdgyNerd The implementation defines the language. The specification is irrelevant. – Dennis Oct 9 at 15:12 • Well, there are quite a few Wilson’s Theorem answers here, and I doubt all of them can calculate 254! exactly... – Hello Goodbye Oct 9 at 15:23 # Keg, 4336 6 bytes (SBCS) :;¡²$%

Try it online!

-30 bytes thanks to @JoKing

No TIO as it needs to be updated due to a bug found with the ² operator.

Transpiles to:

from KegLib import *
from Stackd import Stack
stack = Stack()
printed = False
duplicate(stack)
decrement(stack)
factorial(stack)
square(stack)
swap(stack)
maths(stack, '%')

if not printed:
printing = ""
for item in stack:
if type(item) is Stack:
printing += str(item)

elif type(item) is str:
printing += custom_format(item)
elif type(item) == Coherse.char:
printing += item.v

elif item < 10 or item > 256:
printing += str(item)
else:
printing += chr(item)
print(printing, end="")

### 36 bytes (SBCS)

¿®n21®t{:©n≠©t0≠*|:©n$%[1|0]®t1+}©t. Try it online! -7 bytes by not using a variable to keep track of the count. Explained ¿®n21®t{:©n≠©t0≠*|:©n$%[1|0]®t1+}©t.
¿®n                                 #Take the number to check and store it in variable n
2                                #This will act as the divisor counter
1®t                             #This will act as the return value, indicating the primality
{:©n≠©t0≠*|                  #While the counter isn't equal to n and there isn't a divisor yet
:©n$% #Take the counter and number, then swap for modulus [1|0]®t #Depending upon the result set t to 1 if it doesn't divide otherwise 0 1+} #Increment the counter ©t.#Print the result ### 43 bytes (SBCS) ¿®n2®c1®t{©c©n≠©t0≠*|©n©c%[1|0]®t©n1+®c}©t. It's a real ugly mess, but it works. I'll explain it all later. Also, doesn't work on TIO due to a bug that I found. It should work soon however. Use the latest github interpreter ## Wren, 6451 42 bytes Fn.new{|x|(2...x).map{|n|x%n}.all{|n|n>0}} ## Explanation Fn.new{ // New anonymous function |x| // With the parameter x (2...x) // Generate the range from 2 to x-1 .map{|n|x%n} // Map every item in the range with // the function that modulos' the // x parameter by the current paremeter .all{|n|n>0}} // Check whether all items in the list are // larger than 0 // The boolean value is returned. TIO, now I have adopted from this answer. ## Old answers Fn.new{|n| for(i in 2..n-1)n=n%i<1?0:n return n>0 } TIO. I realized that trial/division is shorter. Adopted from this answer. Fn.new{|n| var f=1 for(a in n-1..2)f=n%a==0?0:f return n<2?0:f } TIO, the header and footers are not working right now. Or you can copy the following full program (with testing code) and test it here: var f = Fn.new{|n| var f=1 for(a in n-1..2)f=n%a==0?0:f return n<2?0:f } System.write(f.call(13)) $$$$ • Your most recent one fails for 1, which should not be prime. – Ørjan Johansen Oct 31 at 12:47 ## STATA, 62 bytes di _r(a) gl c=$a-1
forv b=2/$c{ if!mod($a,b') gl c=0
}
di $c Ungolfed display _request(number) global maxtest =$number-1
forvalues counter=2/$maxtest{ if !mod($number,counter') global $maxtest = 0 } display$maxtest

This tests every integer from 2 to number-1 for divisibility. By printing number-1 as the output, it prints a 0 for an input of 1. Today I learned that STATA has truthy/falsey values. Previously I assumed I could only use (in)equalities in conditions. Note: this does not yet work in the online interpreter and is only valid in the proprietary STATA interpreter.

# Mathematica, 33 bytes or 61 bytes

Manipulate[PrimeQ[n],{n,1,255,1}]

<<PrimalityProving
Manipulate[ProvablePrimeQ[n],{n,1,255,1}]

As explained in the implementation documentation, PrimeQ[] is known to produce correct output for arguments less than 10^16 (though is widely believed, on heuristic arguments, to be correct for any input). (User Charles claims this bound can be increased to 2^64 ~= 10^19 in an answer here.) It tests for small primes, uses Miller-Rabin with bases 2 and 3, then uses a Lucas test. ProvablyPrimeQ[] uses a much slower testing procedure, Atkin-Morain (reference with further citations), but is known to be correct and can produce a certificate of primality or witness of compositeness, if desired. So, PrimeQ[] meets the challenge (255 is much less than 10^16), but ProvablyPrimeQ[] meets the specification "primality test" without reservation.

These wrap the PrimeQ[] call into a widget for user interaction. See the docs for a visual example. This widget provides a slider over the range 1 to 255 with unit increments. Next to the slider is a button to provide additional controls: a textbox for direct input and "playback" controls. It's interesting (at most, three times :-) ) to watch this widget iterate through the range.

• The rule for hardcoding are "If (and only if) your language is unable to accept any kind of user input" (emphasis mine). Mathematica can take user input, so I believe it needs to use that (see this answer for an example). – Sp3000 Sep 13 '15 at 12:50
• @Sp3000 : Huh. Did not know about Input[]. So, ..., is the local protocol to withdraw the whole solution, or keep the documentation that the solution you cite (and many others here) do not provably test for primality? – Eric Towers Sep 13 '15 at 23:55
• @Sp3000 : I now also perceive a bit of a gap between the rule you reference and the other rule "If your language is able to read from STDIN or accept command-line arguments". I certainly can't make Mathematica do that (and I think this negative capability is why I went the way I did). But I agree that Mathematica meets the description you have. Yet I can imagine settings where neither clause applies. – Eric Towers Sep 13 '15 at 23:59
• The rule you mention was indeed badly phrased, so I've rephrased it. However, the rule Sp3000 mentioned clearly stated that hardcoding is only allowed if there are no alternatives. Since Mathematica has Input[], your three snippets are invalid in its current form. – Dennis Sep 14 '15 at 3:59
• @Dennis : The third snippet receives user input, as described. – Eric Towers Sep 14 '15 at 6:33

# Mumps, 29

R J F I=2:1:J W:I=J J Q:J#I=0

Output is nothing if not prime, repeat the number if prime. [[ Looks kind of ugly, but I did this to save a carriage return, as carriage returns aren't echoed on user input. It was also easier to see the number out again than just a 1 or zero, that was confusing on longer queries, especially if they contained a '1' at the end. ]]

Test runs:

USER>R J F I=2:1:J W:I=J J Q:J#I=0
1234312343
USER>R J F I=2:1:J W:I=J J Q:J#I=0
12345
USER>R J F I=2:1:J W:I=J J Q:J#I=0
11141111114111

In these three runs, 12343, 12345 and 1114111 are the inputs (the 'R J' reads standard input into the J variable - but the carriage return is not echoed to the output).

As 12343 is a prime, it's echoed directly after the input; as 12345 is not prime, it sits alone. 1114111 is prime, but if I output just a single '1' to indicate prime, it would be much more difficult to tell if it was or not. I leave it up as an exercise to the reader to remember what was entered for the input number. :-)

[[ I wanted to output a character like '*', but then I would have needed to enclose that in quotes thereby making the answer longer. As would adding my own carriage returns...]]

# VBA, 160 bytes

For casuals only. Is MsgBox a STDOUT equivalent?

Sub p(n)
Dim t
For i = 2 To n - 1
If n / i = Int(n / i) Then t = True
Next
If t <> True Then
MsgBox n & " is truthy"
Else
MsgBox n & " is falsy"
End If
End Sub
• Your code can be significantly improved to Sub p() For j=2To n+1 t=IIf(n Mod j=0Or n<2,"falsy","truthy") Exit For Next Debug.? IIf(n=2,"truthy", t) End Sub 112 bytes – Anastasiya-Romanova 秀 Aug 21 '16 at 12:50

# Actionscript 3, 504 bytes

There are 265 bytes for the actual code. Nearly half the bytes come from the required xml file used by Adobe Debug Launcher to run the swf.

This is run by executing adl P-app.xml -- n to test n, followed by echo %errorlevel% to see the result.

<?xml version="1.0" encoding="UTF-8"?>


text:
PDA

Aethelwulf
2012-May-11, 10:37 PM
So, what do physicists mean when they speak of a mass, or rather, a mass term? For a while, physicists tried to answer this question a number of ways.

There was such a thing as an electromagnetic mass [1] at one point in physics. The was the idea that the electromagnetic field interacted with a quantum object in such a way that it gave a contribution of mass to a system. This was called the self-energy of a system -- in fact, so mainstream the idea was at one point, it was in fact considered as an explanation for inertial mass itself.

It is quite curious to mention that there was even an electromagnetic inertia which was experienced by particles which where accelerated, this was explained through what is called the Larmor Equation, but given as an expression here:

\frac{2}{3}\frac{e^2}{c^3}a^2

This would in fact describe how much radiation a charged particle would give off as it was accelerated to higher and higher speeds. The faster you made your particle move at, the more power was required to bring it to that speed. This was in fact analogous to inertia which was experienced by particles with a charge: today, our new definition is that inertia is strictly a property of mass. As much as this idea has faided, some scientists still use the equations describing the EM-mass.

There maybe some important clues however that it may still have importance, especially since the current model, the Higgs Boson is now finally faiding into the past as scientists have narrowed the possible energy levels for the Higgs Boson to a very small corner. Some of these clues, may exist in the fact that charged massless bosons don't exist. The Yang Mills Equations once predicted massless charge bosons but the approach has been generally considered today as a false one. But why should this prediction and how it failed important?

Charge is considered by physicists as an ''intrinsic property'', something which is inherent with particles of mass. When we think about charge, we usually talk about electromagnetic charges e, which will sometimes be found as a coefficient to the electromagnetic potential in equations ieA. What is important here, is that the electric charge is always found with mass, so maybe electromagnetic mass contributions will arise from the shadows again? Who knows, but what does seem clear that the Higgs Boson is now failing our theory so we will need to revise the equations again. So what is a Higgs Boson? How does it enter our theories?

Our theory of Gauge Fields [2] where \phi is a Gauge Boson, has a structure in the equations which invariance. This has been called, Gauge Invariance and this invariance allows physicists to make certain transformations to fields. The laws of physics always remain the same under gauge invariance, indeed, that is what it's all about! It means there is no such thing as an absolute position in physics - the only thing which does count is relative positions. Another feature of the gauge fields is that they retain a symmetry of the theory.

A symmetry can be understood from the most simplest langrangian term

\partial\phi^{\dagger} \partial \phi

\partial \phi'(x) \rightarrow e^{i\theta}\phi(x)

In this transformation, the derivatives of \phi' are concerned only with \phi. This transformation will look like

\partial \phi'(x) = e^{i \theta} \partial \phi(x)

\partial \phi'^{\dagger}(x) = e^{-i \theta} \partial \phi^{\dagger}(x)

Therefore, when you multiply \partial \phi ' with \partial \phi^{\dagger} the e^{i\theta} and e^{-i\theta} will cancel out because that is how you would compute them with their conjugates. Thus

In other words, our field \theta is constant, and does not require the same derivatives as our boson. In return, we would just get

\partial \phi^{\dagger}\partial \phi

and viola! This was the most simplest demonstration of a symmetry conserving field. An even simpler demonstration would be:

\frac{d(x +C)}{dt}

is in fact simply the same as

\frac{dx}{dt}

this means that the equations where symmetry existed and what we have in these symmetries are extra constants always remain the same, just as our Gauge example above.

But what if \theta also was a function of position \theta (x)? Well let's see shall we.

\partial \phi' = (\partial \phi + i \phi \frac{\partial \theta}{\partial x})e^{i \theta}

and our conjugate would be

\partial \phi'^{\dagger} = (\partial \phi^{\dagger} - i \phi^{\dagger} \frac{\partial \theta}{\partial x})e^{-i \theta}

Multiplying the two, we need to factorize it

(\partial \phi + i\phi\frac{\partial \theta}{\partial x})(\partial \phi^{\dagger} - i\phi^{\dagger}\frac{\partial \theta}{\partial x})

which gives

=\partial \phi^{\dagger} \partial \phi + i(\phi \partial \phi^{\dagger} - \phi^{\dagger} \partial \phi)\frac{\partial \theta}{\partial x} + \phi^{\dagger} \phi (\frac{\partial \theta}{\partial x})^2

The reason, again why this equation turned out to be such a mess was because our \theta-field now depended on position, so the derivatives of our boson field also included it.

This motivated scientists to find a symmetry again in the equations, and to do so required the use of te Covariant Derivative which originally came form the work on fibre bundles.

To restore symmetry, we need to define the Covariant Derivative as

A_{\mu}' \rightarrow A_{\mu} - \partial_{\mu} \theta

Here, we can see our four-vector potential again A_{\mu} - you can basically build the electromagnetic fields form this. It's time component in A_0 but that is really not relevant right now. Our Covariant Derivative and the respective conjugate fields are usually denoted as

D_{\mu} \phi = \partial_{\mu} \phi + iA_{\mu} \phi

and

D_{\mu} \phi^{\dagger} = \partial_{\mu} \phi^{\dagger} - iA_{\mu} \phi^{\dagger}

So calculating it all together, we just define the whole thing again as:

D\phi' = (\partial \phi + i\phi \frac{\partial \theta}{\partial x})e^{i\theta} + i(A_{\mu} - \partial_{\mu} \theta) \phi e^{i \theta}

Well, with this, we can see straight away that some terms cancel out. The i\phi terms cancel, and \frac{\partial \theta}{\partial x} is in fact the same as \partial_{\mu} \theta. So what we are really left with is

D\phi' = D \phi e^{i\theta}

and so its conjugate is

D\phi^{\dagger} = D\phi^{\dagger} e^{-i\theta}

Again, the latter terms cancel out when you multiply these two together and so what you end up with is

D\phi^{\dagger}' D\phi' = D\phi^{\dagger}D\phi

and so by using the Covariant Derivative, we have been able to restore the lost U(1) symmetry where U(1) symmetries deal with rotations.

But when physicists talk about a mass, we don't want to retain symmetry in these fields. In fact, the very presence of a mass term will imply an explicit symmetry breaking. The process of course, is a little more complicated however. It involves another boson, called a Goldstone Boson, which can be thought of as a ground-state photon which lives in the minimum of a Mexican Hat potential. Something which exists in the minimum is the same as saying our system does not contain a mass term and so \phi=0. In such a potential, we may describe our field as

\phi = \rho e^{i\alpha}

Here, \rho is a deviation from the ground state. \rho is in fact our Higgs Boson and \alpha is our Goldstone Boson. If \alpha is a frozen (constant) field, then there are no changes in the equations. But if there is a deviation of the Goldstone Boson from the minimum of our potential, then we are saying that it costs energy to do so, and this energy is what we mean by particles like a photon obtaining a mass. In fact, the Goldstone Boson is gobbled up by the Higgs Boson which gives the system we speak about a mass. Our flucuation from the minimum has the identity f \ne 0 where f plays the role of mass.

Let's discuss this mass term in terms itself of the electromagnetic field tensor. Such a tensor looks like:

F_{\mu \nu}F^{\mu \nu} = \partial_{\mu}A_{\nu} - \partial_{\nu}A_{\mu}

here, F_{\mu \nu}F^{\mu \nu} is in fact just F^2 and it makes up the langrangian. F_{\mu \nu} is an antisymmetric object with respect to swapping its indices. It is like a four dimensional curl.

It is Gauge Invariant, but checking that, remember our transformation

A' \rightarrow A - \partial \theta

plugging that into the tensor gives:

F_{\mu \nu}' = \partial_{\mu}A'_{\nu} - \partial_{\nu}A'_{\mu}

That is

\partial_{\nu} \partial_{\mu} A_{\nu} - \partial_{\mu} \partial_{\nu} \theta - \partial_{\mu} \partial_{\nu}A_{\mu} + \partial_{\nu} \partial_{\mu} \theta

Since the order of partial differentiation doesn't matter, the -\partial{\mu} \partial_\nu}\theta and \partial_{\nu}\partial_{\mu} \theta cancel and what you are left with is invariance.

There are some numerical factors left out of this, such as a quarter, but that really isn't all that important in this demonstration. And so, we may have a completely Gauge Invariant term

D_{\mu}\phi D_{\mu} \phi^{\dagger} - V(\phi^{\dagger}\phi) + F_{\mu \nu} F^{\mu \nu}

One should keep in mind that the potential term here V(\phi \phi^{\dagger}) is also manifestly invariant. What becomes interesting however, is the question of what cannot be added to this but still can remain Gauge Invariant. What we cannot add to the electromagntic part (F^2)-part, is this:

\frac{M^2}{2}A_{\mu}A^{\mu}

This is just the same as \frac{M^2 A^{2}_{\mu}}{2}. The reason why, is because a mass-term for a photon would typically look like this. This actually breaks local invariance. In nature there is only one massless spin-1 boson - the photon - then it seems that if we where to use a local gauge group that is less trivial than U(1), then the symmetry would be broken. It's interesting, that when we speak about symmetry breaking for a photon, we are in fact talking about an electromagnetic term which is squared in the Langrangian.

It seems, by no far shot, that physicists will not abandon the use of symmetry breaking to describe mass for particles, but it must be noted that our usual, and perhaps, most insightful way out of the problem, the Higgs Boson, may need some drastic changes. As I presented at the beginning of this thread, we have dealt with theories involving electromagnetic theories of mass. If this idea is not recollected, what will we turn to?

There are some alternatives. These actually go by the specific name of ''Higgless models''. We have actually a reasonable list of different theories which can be read about here: http://en.wikipedia.org/wiki/Higgsless_model

[1] - It seems that Einstein may well have been influenced by Thomson in his derivation of particles with mass unable to reach the speed of light. Thomson stated long before the development of modern relativity, ''... when v=c the energy becomes infinite, so that it would seem to be impossible to make a charged body move at a greater speed than that of light.'' Searle also stated this in the 1800's.

[2] - http://www.wiley-vch.de/books/sample/3527408355_c01.pdf

Aethelwulf
2012-May-11, 10:40 PM
Why has my tex code came up in this strange [img] thing?

Aethelwulf
2012-May-11, 10:49 PM
I just tried the equations on another site... they came up fine. I don't understand what is wrong here?

pzkpfw
2012-May-11, 11:00 PM
Tex tags are turned by the software into image tags, pointing (for a source for the image) to a site where the mark-up text is turned on the fly into an image.

e.g.

If you enter this: \mathcal{B} \subseteq \mathcal{A}

It gets turned into something like this: http://www.codecogs.com/eq.latex?\mathcal{B} \subseteq \mathcal{A}

Which makes this when you view: \mathcal{B} \subseteq \mathcal{A}

Not sure yet why some of your equations in post #1 don't work. Possibly a fault in them, or maybe that particular tex processor can't handle something in them.

Edit1: One that works one that doesn't

A: \partial \phi'(x) = e^{i \theta} \partial \phi(x)

B: \partial \phi'^{*}(x) = e^{-i \theta} \partial \phi*(x)

A: \partial \phi'(x) = e^{i \theta} \partial \phi(x)

B: \partial \phi'^{*}(x) = e^{-i \theta} \partial \phi*(x)

Edit2: I think that processor doesn't like use of "phi^{*}" or "phi*" - that seems a commonality in the tex tags that don't show correctly.

Aethelwulf
2012-May-11, 11:45 PM
hmmm... I wonder if it would prefer dagger notation... if that is indeed the problem.

Aethelwulf
2012-May-11, 11:45 PM
Yup, that seems to be the problem.. sigh... more work...

Aethelwulf
2012-May-11, 11:50 PM
Bravo pzkpfw, that seems to have fixed it. Thank you.


text:
# Constructing an Infinite Family of Graphs

In a number of graph theory books that I am working through I come across questions that ask something like $$\textit{'Construct an infinite}$$ $$\textit{family of graphs with _________'}$$ and state some property in the blank space that the family of graphs have to satisfy. These questions totally stump me, so my question is what, if any, is a good method of attack for these types of questions? Also what is a 'solution' to these questions meant to look like?

As an example, I am currently trying to work through the following problem from John Meier's book $$\textit{Groups, Graphs and Trees; An Introduction to the Geometry of Infinite Groups}$$ that asks:

Construct infinitely many distinct (2,3)-biregular graphs

In this case I understand what a biregular graph is and can construct a number of distinct graphs by hand, however, I don't understand how to generalise it to get infinitely many distinct graphs of this type.

If you want to construct infinitely many graphs, you want to construct arbitrarily large graphs with the given property. A straightforward approach to try would be to try to find an $$n$$-vertex graph for any $$n$$.

This might not always work, because not all values of $$n$$ are valid. An infinite family also lets you skip values of $$n$$ that don't work, as long as you still have $$n$$-vertex graphs for infinitely many $$n$$. For example:

• If you were looking for examples of $$10$$-regular graphs, you would not be able to find any for fewer than $$11$$ vertices. It's okay to skip $$n=1, 2,\dots, 10$$.
• If you were looking for examples of $$3$$-regular graphs, you would not be able to find any for an odd number of vertices. It's okay to only take $$n=2, 4, 6, 8, \dots$$.
• Even finding a graph of some type with, say, $$2^{2^k}$$ vertices for each $$k$$ is still an infinite family, as long as any sufficiently large $$k$$ works.

In your case, there's a simple restriction: a $$(2,3)$$-biregular graph has $$3k$$ vertices on one side, and $$2k$$ vertices on the other, for some $$k$$. So you might try to find an example of a $$5k$$-vertex $$(2,3)$$-biregular graph for each $$k$$, and that would give an infinite family.

(Or you might discover another restriction, specify which values of $$n$$ work more precisely, and try again.)

In some cases, part of the challenge might be describing how you actually get the example. This would look like an algorithm: given $$k$$, here is how you construct a $$5k$$-vertex graph with the property we want.

The answer to your problem is quite easy. Just observe that if $$K_{2,3}$$ is the $$(2,3)$$-biregular graph with $$5$$ vertices then the distinct union of $$n$$ $$K_{2,3}$$ is a $$(2,3)$$-biregular graph with $$5n$$ vertices.

A more general way to attack the problem, where you can see the heuristics is the following:

Let $$G=(V,E)$$ be a $$(2,3)$$-biregular graph with parts $$B$$ and $$C$$, where $$\forall b\in B \ \deg_G b=2$$ and $$\forall c\in C \ \deg_G c=2$$. It is easy to see that $$2|B|=3|C|$$. Indeed, we can count the number of edges of $$G$$ in two different ways as follows: the number of edges of $$G$$ that are incident to some vertex in $$B$$ is equal to $$2|B|$$, while the number of edges of $$G$$ that are incident to some vertex in $$C$$ is equal to $$3|C|$$. Hence, since every edge of $$G$$ is between a vertex in $$B$$ and a vertex in $$C$$ we have the equality, i.e. $$2|B|=|E|=3|C|$$. It is easy to solve this Diophantine equation. We get that $$|B|=3n$$ and $$|C|=2n$$ for some positive integer $$n$$.

Therefore, you have restricted considerably the problem of finding $$(2,3)$$-biregular graphs to bipartite graphs of parts of sizes $$3n$$ and $$2n$$ respectively.

This example is not so interesting as it has an easy solution but in general, the strategy to tackle this kind of problems is to gradually restrict the structure of the graph being considered. In many of these problems a nice way to construct the family of graphs is by induction. This example hides an induction in the construction of the graphs, but it is a trivial one!

The question in your first paragraph is way too broad; it's almost like asking "How do I find a graph that satisfies some given conditions?" The difference is, you're asking "How do I find a graph that satisfies some given conditions, where one of the conditions is 'has more than $$n$$ vertices'?" The question is unanswerable because what gives the problem its flavor is not the part about having more than $$n$$ vertices, it's the other conditions. If you ask such a general question, the best you can expect is a very general answer, like "Think hard about it."

Your question about $$(2,3)$$-biregular graphs is the kind we can deal with here. As stated, it's too easy: just consider the graph $$nK_{3,2}$$, the union of $$n$$ vertex-disjoint copies of the complete bipartite graph $$K_{3,2}$$. To make it a little more interesting, lets ask for large connected $$(2,3)$$-biregular graphs. There are still lots of solutions. Here's one:

Draw an $$n\times n$$ chessboard, $$n\ge3$$. Divide each little square into two triangles by drawing a diagonal. Make the chessboard into a torus by identifying the left side with the right side and the top with the bottom. Now each of the $$2n^2$$ triangles has $$3$$ sides, and each of the $$3n^2$$ edges is a side of $$2$$ triangles, so the triangle-edge incidence graph is a $$(3,2)$$-biregular graph of order $$5n^2$$.


text:
Global searching is not enabled.

#### Fertile signs

The signs of the water triplicity: Cancer, Scorpio and Pisces, defined as fruitful because of their moist influence which is conducive to fertility. Unless afflicted, they show (amongst other things) a propensity for large families, many children or easy pregnancy. Scorpio is the least promising in this regard because where it is afflicted it can indicate many pregnancies that fail.


text:
1. Let f(x)=2x^2-4x+5

Let f(x)=2x^2 -4x+5.Suppose that F is an antiderivative of f such that
F(1)=10.Find F(x).

I think the anti derivative is as follows:

F=2∫x^2 dx -4∫x dx + 5∫1 dx
F=2.x^3/3-4.x^2/2+5.x+c

But when I plug in 1 in the F i.e F(1) ...I do not get 10 as given in the problem.Can somebody pls help me?

2. You must make c the number that makes that true. Plug in 1 for x, 10 for y then solve for c.

3. Originally Posted by Jameson
You must make c the number that makes that true. Plug in 1 for x, 10 for y then solve for c.
Yes.

So it will look like F(1)=10=2(1)^3/3 - 2(1)^2 +5(1) + c

c= (whatever you get. solve algebraically)

Rewrite F(x) with the correct value of c.


text:
# naginterfaces.library.mv.rot_procrustes¶

naginterfaces.library.mv.rot_procrustes(stand, pscale, x, y)[source]

rot_procrustes computes Procrustes rotations in which an orthogonal rotation is found so that a transformed matrix best matches a target matrix.

For full information please refer to the NAG Library document for g03bc

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/g03/g03bcf.html

Parameters
standstr, length 1

Indicates if translation/normalization is required.

There is no translation or normalization.

There is translation to the origin (i.e., to zero).

There is translation to origin and then to the centroid after rotation.

There is unit normalization.

There is translation and normalization (i.e., there is standardization).

There is translation and normalization to scale, then translation to the centroid after rotation (i.e., they are matched).

pscalestr, length 1

Indicates if least squares scaling is to be applied after rotation.

Scaling is applied.

No scaling is applied.

xfloat, array-like, shape

, the matrix to be rotated.

yfloat, array-like, shape

The target matrix, .

Returns
xfloat, ndarray, shape

If , will be unchanged.

If , , or , will be translated to have zero column means.

If or , will be scaled to have unit sum of squares.

If , will be scaled to have the same sum of squares as .

yfloat, ndarray, shape

If , will be unchanged.

If or , will be translated to have zero column means.

If or , will be scaled to have unit sum of squares.

If or , will be translated and then after rotation translated back.

The output should be the same as the input except for rounding errors.

yhatfloat, ndarray, shape

The fitted matrix, .

rfloat, ndarray, shape

The matrix of rotations, , see Further Comments.

alphafloat

If the scaling factor, ; otherwise is not set.

The residual sum of squares.

resfloat, ndarray, shape

The residuals, , for .

Raises
NagValueError
(errno )

On entry, .

Constraint: or .

(errno )

On entry, .

Constraint: , , , , or .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

Only one distinct point (centred at zero) in array.

(errno )

Only one distinct point (centred at zero) in array.

(errno )

contains only zero-points when least squares scaling is applied.

(errno )

The singular value decomposition has failed to converge.

Notes

Let and be matrices. They can be considered as representing sets of points in an -dimensional space. The matrix may be a matrix of loadings from say factor or canonical variate analysis, and the matrix may be a postulated pattern matrix or the loadings from a different sample. The problem is to relate the two sets of points without disturbing the relationships between the points in each set. This can be achieved by translating, rotating and scaling the sets of points. The matrix is considered as the target matrix and the matrix is rotated to match that matrix.

First the two sets of points are translated so that their centroids are at the origin to give and , i.e., the matrices will have zero column means. Then the rotation of the translated matrix which minimizes the sum of squared distances between corresponding points in the two sets is found. This is computed from the singular value decomposition of the matrix:

where and are orthogonal matrices and is a diagonal matrix. The matrix of rotations, , is computed as:

After rotation, a scaling or dilation factor, , may be estimated by least squares. Thus, the final set of points that best match is given by:

Before rotation, both sets of points may be normalized to have unit sums of squares or the matrix may be normalized to have the same sum of squares as the matrix. After rotation, the results may be translated to the original centroid.

The th residual, , is given by the distance between the point given in the th row of and the point given in the th row of . The residual sum of squares is also computed.

References

Krzanowski, W J, 1990, Principles of Multivariate Analysis, Oxford University Press

Lawley, D N and Maxwell, A E, 1971, Factor Analysis as a Statistical Method, (2nd Edition), Butterworths


text:
Personal tools

You are here: Home / Abstracts

# Abstracts

### Andy Baker

TAQ and all that

I will survey the basic notions of Topological Andr\'e Quillen (co)homology for commutative $S$-algebras and in particular discuss some sample calculations related to Thom spectra.

### Eugenia Cheng

The universal loop space operad and generalisations
Grothendieck hypothesised that "\omega-groupoids'' could be used to model
homotopy types, and many different ways of approaching this have been
proposed in recent years.  I will discuss a theory proposed by
Batanin/Leinster using a generalised form of operad called "globular
operads''.  There are various analogies with the use of operads to study
loop spaces; I will recall the loop space operad E called universal'' by
Salvatore, and present an analogous globular operad G which can be used to recognise the fundamental \omega-groupoid of a space.  I will give a
categorical proof of the universal property of E, and generalise it to
prove a universal property of G.

### Jeffrey Giansiracusa

Formality of the framed little discs operad

Tamarkin and Kontsevich proved that the little n-discs operad is formal in the following sense: the operad formed by taking its real chains is quasi-isomorphic as an operad to its real homology. This theorem had important applications in deformation quantization and also in computing the homology of spaces of knots. The framed little discs operad is an interesting relative - it actually forms a cyclic operad, meaning that inputs and outputs can be interchanged. Paolo Salvatore and I prove that the framed little 2-discs is formal as a *cyclic* operad. The proof introduces a new and interesting graph complex in which the differential is a combination of edge contractions and deletions.

### Ian Grojnowski

Almost local differential operators

One of the most fundamental theorems in representation theory
is the Beilinson-Bernstein theorem, which describes the representations
of a Lie algebra such as $sl_n$ in much simpler terms---as
sheaves of modules for differential operators on a smooth algebraic variety.

I will describe this theorem, and some work in progress to generalise
it to describe  non-commutative deformations of enveloping algebras
in terms of 'almost local differential operators'.

The goal is to compute the algebraic K-theory of these algebras
by reducing it to the work of Hesselholt and Madsen.

### Jelena Grbic

The homotopy theory of moment angle complexes

In recent years, toric topology has been recognised as an area of topology which has deep connections with combinatorics, algebraic and symplectic geometry, and homological algebra.

The moment-angle complex, an object initially studied in algebraic geometry, has become one of the central objects of toric topology. Thus its homotopy type, stable and unstable, is of great interest. In this talk I'll explain a relation between simplicial complexes and moment-angle complexes and determine the unstable homotopy type of moment-angle complexes related to shifted complexes.

In addition, I'll describe how higher Whitehead products arise in the homotopy theory of moment-angle complexes and their relations with the loop homology of Davis-Januszkiewicz spaces.

Moduli spaces and topology
The lecture will survey a number of results about the stable homological structure of the mapping class group,the moduli space of surfaces in a background space and the moduli space of manifolds embedded in high dimensional euclidian space.Applications will include the stable structure of the Atiyah-Bott moduli space of flat connections on principal bundles over Riemann surfaces.I will also discuss the relationship between the moduli space of manifolds and Waldhausen's algebraic K-theory of spaces.

### Martin Markl

Homotopy invariant structures in algebra and transfers

We discuss the concept of homotopy invariance in algebra and
recall some basic examples of structures having this property. We also
explain that each "reasonable" algebraic structure has its homotopy
invariant version.

We prove that homotopy invariant structures can be transferred over
maps having a one-sided homotopy inverse. We will then recall the
notion of strong homotopy equivalence and show how it explains the
relation between the above transfer property and the classical
perturbation lemmas.

### Constanze Roitzheim

Hochschild cohomology of A-infinity algebras.

In the 1960s, A-infinity algebras were introduced to study the cohomology of topological spaces with products and are now known to arise widely in various areas of mathematics. Roughly speaking, A-infinity algebras are generalisations of associative algebras. We are going to explain how to extend the definition of Hochschild cohomology from associative algebras to A-infinity algebras and how this will help solving realizability problems in topology and present some new results concerning derived A-infinity algebras.

### Shoham Samir

A noncommutative analog of a local-cohomology spectral sequence for chains on loops of certain spaces.

I will present a spectral sequence which is analogous to the local cohomology spectral sequence of Dwyer, Greenlees and Iyengar for the cochains of a space. This spectral sequence can be applied, in some cases, to the dga which is the chains on the loops of a space (with coefficients in a field). As with the local cohomology spectral sequence, when this dga is Gorenstein the spectral sequence converges to the cochains of the loop space.

### Ron Umble

On the Transfer of Multiplicative Structure.

Kadeishvili, Markl, and others have studied the transfer of multiplicative structure from an $A_\infty$-algebra $A$ to a DG module $B$ along a map $f : B \to A$. Kadeishvili assumes that $A$ and $B$ are free modules and $f$ is an inclusion; Markl assumes that $f$ has a left-homotopy inverse. To set the stage for our more general result, we discuss an example in which $A$ and $B$ have torsion and $f$ has a left but no right-homotopy inverse. Theorem. Let $\bar{f} : Hom(B^{\otimes n},B) \to Hom(B^{\otimes n},A)$ be the induced map. The $A_\infty$-algebra structure on $A$ pulls back along $f$ to an $A_\infty$-algebra structure on $B$ whenever $\bar{f}$ is a quasi-isomorphism. In fact, if $\bar{f}$ is a quasi-isomorphism, so is $f$, but not conversely. This result extends immediately to $A_\infty$-bialgebras and gives the Corollary: If $F$ is a field, $H_*(\Omega(X);F)$ is an $A_\infty$-bialgebra. We conclude with a discussion of the $A_\infty$-bialgebra operations on $H_*(\Omega(X);F)$ and the structure relations among them.

Contact details

Department of Mathematics
University of Leicester
Leicester LE1 7RH
United Kingdom

Tel.: +44 (0)116 229 7407

Campus Based Courses


text:
# Selecting class weights for loss function

I have a machine learning task where I would like to weight losses based on the frequency of the categorical values appearing in the data. The binary solution can be seen below, but I'd like to know what to do about the case of n>2 categories.

w_0 = (n_0 + n_1) / (2.0 * n_0)
w_1 = (n_0 + n_1) / (2.0 * n_1)

The frequencies for the samples n0-n5 are:

n_0:     1552829
n_1:     14479
n_2:     13445
n_3:     13781
n_4:     18795
n_5:     64187

• What do you hope to get out of weighting the loss function?
– Dave
Aug 17 '21 at 18:54

Is that what you want?

w_0 = (n_0+n_1+ ... +n_5) / (5.0 * n+0)

If so, it can be achieved by:

    n = [n_0, n_1, n_2, ...]
w = []
for i in range(len(n)):
w[i] = sum(n) / (len(n)*(n[i]))

Notice that Sum(n)/Len(n) = Average(n), so you'd basically saying your loss-function is avg(n)/ni.


text:
# Moduli space of genus 1 curves with a degree n divisors

I am sure this is well known, but I don't know what to search for:

Consider $$M_{1,n}$$, the moduli space of genus 1 curves with $$n$$ marked points. The symmetric group on $$n$$ letters acts on this space by acting on the marked points, and we can quotient out by this action, which corresponds to forgetting the ordering of the n points.

What is known about this space? For instance, for what $$n$$ (and in what characteristics) is it a rational variety? Does this space have a name? In short, how can I find literature on this?

• Do you want the marked points to be distinct? I think the terminology "marked points" usually implies distinct points, while "degree n divisors" in the title usually would not have this restriction. Nov 30 '20 at 8:29
• I do want them to be distinct and the divisors to be squarefree. Sorry for the confusion. Nov 30 '20 at 15:59
• I want to say that this is related to the universal Jacobian $\mathscr{Jac}^n \to M_1$, but that should be $2$-dimensional while your space should be $(n+1)$-dimensional, so I've clearly missed something. Nevertheless, the phrase "universal Jacobian" could be useful. Nov 30 '20 at 16:33

It doesn't have a more standard name than "$$M_{1,n}/S_n$$".

Belorousski's PhD thesis contains very explicit rational parametrizations of $$M_{1,n}$$ for $$n<11$$. I would expect (but haven't checked) that a modification of his constructions would work to show rationality of $$M_{1,n}/S_n$$, too.

The irrationality of $$M_{1,11}$$ can be seen from the nonvanishing Hodge number $$H^0(\overline M_{1,11},\Omega^{11})$$, which comes from modular forms; it is part of the two-dimensional "motive" associated to the Ramanujan cusp form $$\Delta$$. This motive transforms according to the sign representation of $$S_n$$ and in particular it dies in the cohomology of $$M_{1,n}/S_n$$. So I do not see an immediate cohomological obstruction for rationality. The same is true more generally that in the middle cohomology of $$\overline M_{1,n}$$ one finds the motive of cusp forms for $$\mathrm{SL}(2,\mathbf Z)$$ of weight $$n+1$$ and it transforms according to the sign representation. In fact according to a paper of Consani and Faber this is the only part of the rational cohomology of $$\overline M_{1,n}$$ transforming according to the sign representation of $$S_n$$.

The Kodaira dimension of $$M_{1,n}$$ is $$0$$ when $$n = 11$$ and $$1$$ for $$n \geq 12$$ by a paper of Bini-Fontanari. So this is at least an upper bound for the Kodaira dimension of $$M_{1,n}/S_n$$.

I'm not sure which (if any) parts of the above change in positive characteristic, but you could look at a paper of Will Sawin on the non-uniruledness of $$\overline M_{1,n}$$ in characteristic $$p$$.

• Somewhere I saw the notation $\mathcal{M}_{1, \, [n]}$ Nov 30 '20 at 9:39
• What do you mean by "the quotient of a rational variety by a reflection group is rational"? The cubic threefold is a quotient of a rational variety by $\Bbb{Z}/2$.
– abx
Nov 30 '20 at 10:07
• @abx You're right, sorry! Nov 30 '20 at 10:41
• Thanks, this is very helpful. Do you think it's possible that $M_{1,n}/S_n$ is always just $\mathbb P^n$ or do you see any easy obstruction to this? (I have some computations that seem to indicate this...) Dec 3 '20 at 4:56
• If you mean that $\overline M_{1,n}/S_n \cong \mathbb P^n$ that's certainly false (e.g. the Picard group of $\overline M_{1,2}/S_2$ has rank two). If you mean that $M_{1,n}/S_n$ is always a rational variety I highly doubt it but I don't have an argument. Dec 4 '20 at 9:32