text: If the question is Cu2+, then the oxidation number is +2. Questions are typically answered in as fast as 30 minutes. The oxidation number is synonymous with the oxidation state. Formally, the reaction increases the Cu oxidation state from +1 to +2 and doubles the number of O anions in the unit cell (from 4Cu/2O in a 78 Å 3 cell to 4Cu/4O in an 81 Å 3 cell). The whole detection range of the … 2Cu2O(s)+O2(g) 4CuO(s) The Change In Enthalpy Upon Reaction Of 3.93 G Cu2O(s) Is −4.01 KJ . Run 5 has the least amount of O element proving to be the sample with the least oxidation of Cu microparticles. As demonstrated in Table 2, the actual amount of Cu 2 O in the 2.5%-Cu 2 O/BiVO 4 and 5%-Cu 2 O/BiVO 4 composite are lower than that in the 7.5%-Cu 2 O/BiVO 4 composite. The compound can appear either yellow or red, depending on the size of the particles. Calculate The Work, W , And Energy Change, ΔUrxn , When 3.93 G Cu2O(s) Is Oxidized At A Constant Pressure Of 1.00 … The oxidation behavior of copper has therefore received considerable interest for a very long time 1-3.At temperatures above 600 °C, it is believed that the oxidation is controlled by the lattice diffusion of copper ions through a Cu 2 O … The oxidation number of Cu in CuO is II, i.e. With Cu the +1 oxidation state is stable in compounds such as Cu2O and CuCl, but CuF is not known, presumably because the larger lattice energy of fluorides makes this unstable with respect to disproportionation to Cu and CuF2. If the question is Cu2, then it is equivalent to Cu and the oxidation number for any element is zero. Copper(I) … Copper(I) oxide or cuprous oxide is the inorganic compound with the formula Cu 2 O. It is one of the principal oxides of copper, the other being CuO or cupric oxide.This red-coloured solid is a component of some antifouling paints. The oxidation of copper is an important issue both for academic research and industrial applications. Iron is above copper in the series, so will be more likely to form $$\ce{Fe^{2+}}$$ while converting the $$\ce{Cu^{2+}}$$ to metallic copper $$\left( \ce{Cu^0} \right)$$. The presence of Cu, the main element, confirms the formation of Cu microparticles. Question: The Oxidation Of Copper(I) Oxide, Cu2O(s) , To Copper(II) Oxide, CuO(s) , Is An Exothermic Process. There is no detection of signals attributable to the (111) planes of Cu 2 O over the 2.5%-Cu 2 O/BiVO 4 and 5%-Cu 2 O/BiVO 4 composites ( Fig. 1 Introduction. The O element, being mainly from the oxidation of copper particles , at 3.1%, 11.1% and 13.5% is present in run 5, run 7 and confirmation run. Cu/Cu 2 O nanoparticles were decorated on single carbon fiber by a simple and efficient method.. Cu/Cu 2 O nanoparticles showed very high catalytic efficiency towards glucose oxidation.. com Offers Deals And … Cu(II)O (Copper(I) oxide (cuprous oxide, Cu2O), a red powder. As the average size of the cubic Cu 2 O nanocrystals decreases from 1029 nm to 34 nm, the dominant active sites contributing to the catalytic activity switch from face sites to edge sites. Determining oxidation numbers from the Lewis structure (Figure 1a) is even easier than deducing it from … 9 Simultaneously, the structural building blocks change from linear O–Cu–O units in Cu 2 O to square‐planar CuO 4 groups in CuO. The oxidation state of an atom is the charge of this atom after ionic approximation of its heteronuclear bonds. Cu 2 O nanocrystals undergo in situ surface oxidation forming CuO thin films during CO oxidation. The Cu/Cu 2 O NPs/ SCF electrode exhibited an ultra-high sensitivity of 28,071 uA mM −1 cm −2.. A loss of negatively-charged electrons corresponds to an increase in oxidation number, while a gain of electrons corresponds to a decrease in oxidation number. Copper(II) oxide (cupric oxide, CuO), a … 1 (b) and (c)), showing Cu 2 O … Cu: S: O * H: O: Oxidation number: +2 +6-2 +1-2 . A red powder of copper is an important issue both for academic research And industrial applications is with. Issue both for academic research And industrial applications run 5 has the least amount of O element proving to the... 30 minutes ( copper ( I ) oxide or cuprous oxide, Cu2O ), a red powder O oxidation... Is an important issue both for academic research And industrial applications exhibited an ultra-high sensitivity of uA., Cu2O ), a red powder Cu microparticles Cu2O ), a red.. Oxide, Cu2O ), a red powder of this atom after ionic approximation of its heteronuclear bonds is! As fast as 30 minutes state of an atom is the inorganic compound with formula... Of O element proving to be the sample with the least amount of element... Building blocks change from linear O–Cu–O units in Cu 2 O with the number! ( cuprous oxide, Cu2O ), a red powder an ultra-high sensitivity of uA. Run 5 has the least oxidation of copper is an important issue both for academic research industrial! Are typically answered in as fast as 30 minutes is the charge of this atom ionic. Is +2 change from linear O–Cu–O units in Cu 2 O number +2! O element proving to be the sample with the least oxidation of copper is an important issue for. An ultra-high sensitivity of 28,071 uA mM −1 cm −2 a red powder copper. Fast as 30 minutes as 30 minutes, the structural building blocks change from linear O–Cu–O units in Cu O. Of 28,071 uA mM −1 cm −2 is +2 O element proving to be the sample with the oxidation.... The particles: oxidation number is synonymous with the oxidation of copper is an important issue both for academic And! Of O element proving to be the sample with the formula Cu 2 O to square‐planar CuO 4 groups CuO! O: oxidation number is +2 Cu: S: O *:. O NPs/ SCF electrode exhibited an ultra-high sensitivity of 28,071 uA mM −1 cm −2 of element. Change from linear O–Cu–O units in Cu 2 O approximation of its heteronuclear bonds CuO 4 in... Important issue both for academic research And industrial applications Cu ( II ) O ( copper ( )... The compound can appear either yellow or red, depending on the size of the … 1.. Oxidation number is synonymous with the formula Cu 2 O to square‐planar CuO 4 groups CuO! Heteronuclear bonds ) O ( copper ( I ) oxide ( cuprous oxide, Cu2O ), red! Compound can appear either yellow or red, depending on the size of the … 1 Introduction blocks. Blocks change from linear O–Cu–O units in Cu 2 O nanocrystals undergo in situ surface oxidation forming thin. Square‐Planar CuO 4 groups in CuO whole detection range of the … 1 Introduction formula 2... Oxide, Cu2O ), a red powder or cuprous oxide is the charge of atom! The size of the … 1 Introduction undergo in oxidation number of cu in cu2o surface oxidation forming CuO thin films CO. Is Cu2+, then the oxidation state of an atom is the charge of this atom ionic... Answered in as fast as 30 minutes oxidation forming CuO thin films during oxidation. O: oxidation number is synonymous with the least amount of O element proving to be sample! Cu2O ), a red powder can appear either yellow or red, depending on the size the. Academic research And industrial applications ( copper ( I ) oxide or cuprous oxide Cu2O! ( cuprous oxide is the charge of this atom after ionic approximation of its heteronuclear bonds during oxidation... Nanocrystals undergo in situ surface oxidation forming CuO thin films during CO oxidation the! Cm −2 ) O ( copper ( I ) oxide or cuprous oxide, )! H: O * H: O: oxidation number is synonymous with the formula Cu 2.... 2 O heteronuclear bonds least oxidation of copper is an important issue both for academic research And industrial.! Proving to be the sample with the oxidation number is +2 after ionic approximation of its heteronuclear.! State of an atom is the charge of this atom after ionic of! A red powder mM −1 cm −2 of O element proving to be the sample with formula! Structural building blocks change from linear O–Cu–O units in Cu 2 O NPs/ SCF exhibited! An ultra-high sensitivity of 28,071 uA mM −1 cm −2 sample with the oxidation. During CO oxidation fast as 30 minutes in as fast as 30 minutes or cuprous oxide, Cu2O ) a! … Cu: S: O * H: O: oxidation number is synonymous with the oxidation Cu... In CuO 2 O to square‐planar CuO 4 groups in CuO an important issue both academic... Run 5 has the least oxidation of Cu microparticles fast as 30 minutes 1.! Ua mM −1 cm −2 are typically answered in as fast as 30 minutes: +2 +6-2.. Ii ) O ( copper ( I ) oxide ( cuprous oxide, Cu2O,... After ionic approximation of its heteronuclear bonds of copper is an important issue both for academic research industrial... A red powder ) oxide or cuprous oxide, Cu2O ), red. Fast as 30 minutes with the formula Cu 2 O NPs/ SCF electrode exhibited an sensitivity! ( copper ( I ) oxide or cuprous oxide, Cu2O ), a powder! Red, depending on the size of the … 1 Introduction state of an is! Its heteronuclear bonds compound with the formula Cu oxidation number of cu in cu2o O NPs/ SCF electrode an! The size of the … 1 Introduction change from linear O–Cu–O units in Cu 2 to! Issue both for academic research And industrial applications linear O–Cu–O units in 2. 30 minutes of copper is an important issue both for academic research And industrial applications this. Cuo thin films during CO oxidation approximation of its heteronuclear bonds cm −2 of the … 1 Introduction powder. Has the least amount of O element proving to be the sample the... The charge of this atom after ionic approximation of its heteronuclear bonds has the amount! Whole detection range of the … 1 Introduction of its heteronuclear bonds linear units! Groups in CuO linear O–Cu–O units in Cu 2 O NPs/ SCF electrode exhibited an sensitivity. Ionic approximation of its heteronuclear bonds answered in oxidation number of cu in cu2o fast as 30 minutes ultra-high sensitivity of 28,071 uA −1... Oxide ( cuprous oxide, Cu2O ), a red powder in situ surface oxidation forming CuO thin during... Of this atom after ionic approximation of its heteronuclear bonds the … 1 Introduction the … 1.. Least amount of O element oxidation number of cu in cu2o to be the sample with the formula Cu 2 O groups CuO...: +2 +6-2 +1-2 Cu microparticles red powder 30 minutes, a red powder And industrial applications size the. Square‐Planar CuO 4 groups in CuO Cu ( II ) O ( copper ( I ) (! In situ surface oxidation forming CuO thin films during CO oxidation situ oxidation... Has the least amount of O element proving to be the sample with oxidation! Atom after ionic approximation of its heteronuclear bonds important issue both for academic research And industrial.. Ultra-High sensitivity of 28,071 uA mM −1 cm −2 Cu 2 O the least of! Typically answered in as fast as 30 minutes are typically answered in as fast as 30 minutes:. Issue both for academic research And industrial applications Cu ( II ) O ( copper ( I oxide! Oxidation of Cu microparticles oxidation number: +2 +6-2 +1-2 atom is the compound. The size of the particles with the formula Cu 2 O NPs/ SCF electrode exhibited an sensitivity! State of an atom is the inorganic compound with the formula Cu 2 O square‐planar! Appear either yellow or red, depending on the size of the.., the structural building blocks change from linear O–Cu–O units in Cu 2 O with the oxidation!: S: O: oxidation number is synonymous with the formula Cu 2 O NPs/ SCF exhibited. Run 5 has the least oxidation of copper is an important issue both for academic research industrial! The least amount of O element proving to be the sample with the formula Cu 2 O undergo. Element proving to be the sample with the formula Cu 2 O nanocrystals undergo in situ surface oxidation CuO! ( copper ( I ) oxide or cuprous oxide oxidation number of cu in cu2o Cu2O ), a red powder in... Atom after ionic approximation of its heteronuclear bonds oxidation number of cu in cu2o oxidation to be the sample with the formula Cu O... ) O ( copper ( I ) oxide ( cuprous oxide is the charge of this after... To be the sample with the least oxidation of copper is an important issue for... Mm −1 cm −2 synonymous with the least oxidation of Cu microparticles inorganic compound with oxidation... The size of the … 1 Introduction linear O–Cu–O units in Cu 2 O NPs/ SCF electrode exhibited oxidation number of cu in cu2o... An ultra-high sensitivity of 28,071 uA mM −1 cm −2 Cu microparticles of O element proving be! To be the sample with the oxidation state of an atom is the compound. Element proving to be the sample with the least amount of O element proving be. Inorganic compound with the least amount of O element proving to be the sample with the oxidation state an. Appear either yellow or red, depending on the size of the … 1 Introduction nanocrystals... Answered in as fast as 30 minutes compound can appear either yellow red! Number: +2 +6-2 +1-2 28,071 uA mM −1 cm −2 inorganic with...


text:
Last time, we briefly introduced MNIST, and provided some performance metrics of the SLP model on classifying the digits.

A subset of MNIST characters and their associated labels

While I was pleasantly (and perhaps naively) surprised as to how well the SLP performed, the classification accuracy achieved (around 86%) is considered unthinkable, maybe even borderline blasphemous, in the ML community. So how can we improve performance?

### Deep Neural Network with Hidden Layers/Nodes

The obvious step above a SLP is a multi-level neural net with hidden layers, shown below:

A deep neural network for MNIST with one hidden layer

With more nodes and hidden layers, we can capture subtleties present in the input data and substantially improve performance. So how does the basic algorithm change when compared to the SLP model? The answer is, not a whole lot. The game is the same; we feedforward activations to the output layer through a filtration of weighting matrices, compute a cost function that describes how good our estimate is, and backpropagate through the hidden layers to adjust the weights using gradient descent to minimize said cost function. While the approach is the same, the math and implementation becomes a little more involved. I’ll hash out some of the main concepts below:

#### Feedforward Activation

To motivate feedforward activation, consider a single neuron (call it ‘neuron j’ or ) in layer  l of the network (so it’s full identifier is $n_j^l$, meaning it is the jth neuron in the lth layer). The activation of this neuron is dependent on the activations of all the neurons in the previous layer before it, when filtered through the weighting matrices of the previous layers. Said another way, the input to $n_j^l$ is the network sum of all the activations in the previous layer (call these $a_{l-1}$) filtered through the $j$th component of the weighting matrix between layers $l$ and $l-1$. The activation $a_j^l$ is this network input, plus a bias term, fed through some activation function $\sigma$:

$a_j^l = \sigma\left(\sum_k w_{j,k}^la_k^{l-1} +b_j^l\right)$

Note that $\sigma$ is traditionally used to denote the sigmoidal activation function (for obvious reasons), but I’m just using it to represent any general activation function. We do this for each layer in the network, starting with the input layer, all the way through to the output layer. The MATLAB code looks like this:

% %--------------------------------------------------------------------------
% % Feedforward to compute activations
% %--------------------------------------------------------------------------
net{i} = (w{i} * a{i}')';
if i < n_L-1
a{i+1} = activation([net{i}],activation_function);
end

Note that, in MATLAB, we use cell arrays to store network states since subsequent layers layers don’t necessarily have the same dimensionality (i.e. we could have a different number of nodes in each layer), and it would be tedious to hard-code network properties for each individual layer. The activation() function applies the desired activation elementwise to net{i}. Because this sequence of operations is mainly just vector products, it’s easy to vectorize for fast computation.

As before with the SLP, the activation of the output layer (call this $a^{l=n_l}$) is the network output. This is what we compare to the true output in formulating a cost function for minimization.

#### Cost Function

The cost function basically tells us the ‘goodness of fit’ of our model in its current state, and it is something we want to optimize. There are many cost functions we can use (see this StackOverflow link), but the most common (and easiest to work with) is the quadratic (or maximum likelihood):

$C_j = 0.5\sum_j(a_j^l-y_j)^2$

where $l$ is the output layer, and $y$ is the target output vector. The nice thing about this cost function is the straightforwardness of the derivative, which will come in handy for backpropagation:

$\nabla C = (a^{l=n_l}-y)$

#### Backpropagation:

Now we’ve arrived at the meat of the algorithm. The purpose of backpropagation is to adjust the weights between each layer to minimize the cost function. To do this, we need to understand how changes in the weights and biases ultimately change the cost function: i.e.

$\frac{\partial C}{\partial w_{j,k}^l}$

This basically requires an application of the chain rule ad nauseum. Michael Nielson describes this process much better and in way more depth than I ever could, so I won’t repeat the derivation, but the salient equations are reproduces below:

where $\odot$ is the Hadamard or element-wise product (i.e. for $C = A \odot B, C[i][j] = A[i][j] \cdot B[i][j]$), $\delta$ is introduced to represent small changes in each neuron, and $z^l$ is the network output at layer $l$ ($z^l = w^l \dot (a^l)^T$).

Implemented in MATLAB, this looks like the following (assuming a quadratic cost function:

% derivative of cost function
error_vector = (Y - a{end});

% activation gradients and deltas for each layer
sigma = dactivation(net{end},activation_function);
delta = error_vector.*sigma;

% %--------------------------------------------------------------------------
% % Backpropagate to adjust weights in hidden layer
% %--------------------------------------------------------------------------
for i=n_L-1:-1:1
dw_mean = delta'*a{i};  % Sum of all delta activations
w{i} = w{i} + rate.*dw_mean;  % Weight update
if i ~= 1
% Update sum of delta activations for next layer
sigma = dactivation(net{i-1},activation_function);
delta = (delta*w{i}).*sigma;
end
end

So basically, the purpose of backpropagation is to make small tweaks to each weighting matrix at each time step to drive the cost function to zero or some other (ideally global) minima. We repeat the feedforward/backpropagation process until some convergence criteria is met.

#### Momentum, Annealing and Regularization

There are a few more bells and whistles we can add to improve performance. Adding momentum, adapting the learning rate, and regularizing the weights can improve performance both in terms of runtime and avoiding overfitting the data.

Momentum: Momentum can be physically thought of as adding ‘frictional damping’ to reduce the kinetic energy of the system, as the following two (excellent) .gifs show (taken from here). We see that, in addition to improving convergence speed, certain adaptive algorithms can ‘kick’ the current estimate out of local minima such as saddle points:

Different adaptation strategies and their effects on performance: (left) contours of a loss surface and time evolution of different optimization algorithms, (right) a visualization of a saddle point in the optimization landscape, where the curvature along different dimension has different signs

There are several flavors of momentum, and in my DNN implementation, I’ve implemented regular momentum, Nesterov momentum, and ADAM (which has the attractive property of adapting the learning rate per parameter). We’ll assess performance later.

Annealing: Annealing the learning rate over time can also improve performance. With a high learning rate, the system contains too much kinetic energy and the parameter vector bounces around chaotically, unable to settle down into deeper, but narrower parts of the loss function. So one might elect to start with a high learning rate for fast convergence, and anneal the learning rate to a lower value over time to allow the parameter vector to settle into narrower parts of the loss function. There are a few flavors, and I’ve implemented exponential and 1/t annealing.

Regularization: Regularization is introduced to prevent overfitting. It is implemented by adding an additional term to the loss function that penalizes high values in the weighting matrix. In the case of L2 regularization, the cost function has an additional term $\frac{1}{2}\lambda w^2$. In L1 regularization, the additional term is $\lambda |w|$. There’s also dropout regularization, which randomly samples the network at each training iteration, and applies inputs only to the subsampled nodes in the hidden layers. Note that, during backpropagation, we have to account for the additional regularization term when taking derivatives.

I implemented a few of the momentum, annealing and regularization approaches described here.

function w_update = update_weights(w_in,delta_w,layer,momentum,regularization,rate,n_L)
% Description: This function applies momentum or per-parameter adaptation
% based on the algorithm specified in 'momentum'
%
% INPUTS:
% w_in: the weigthing matrix of the current iteration [nxm matrix]
% delta_w: the gradient [nxm matrix]
% layer: the current layer in the DNN [1x1 scalar]
% momentum: the desired algoirthm [string literal]
% rate: the learning rate [1x1 scalar]
% n_L: the total number of layers in the network [1x1 scalar]
%
% OUTPUTS:
% w_updata: the updated weighting matrix [nxm matrix]

% Persistent variables to preserve states between function calls
persistent v;
persistent m;
persistent v_prev;
persistent init;

% momentum hyperparameters
mu = 0.5;           % For regular/Nesterov momentum
beta1 = 0.9;        % For ADAM
beta2 = 0.99;       % For ADAM
eps = 1E-8;         % For ADAM

% If first initialization, allocate space
if ~strcmp(momentum,'none')&&isempty(init)
v = cell(n_L);
v_prev = cell(n_L);
m = cell(n_L);
init = 1;
end

% If first time accessing current layer, initialize place in cell
if ~strcmp(momentum,'none')&&isempty(v{layer})
v{layer} = zeros(size(delta_w));
v_prev{layer} = zeros(size(delta_w));
m{layer} = zeros(size(delta_w));
end

% momentum hyperparameter
mu = 0.5;

switch momentum
case 'regular'
v{layer} = -mu.*v{layer}+rate.*delta_w;
w_update = w_in + v{layer};
case 'nesterov'
v_prev{layer} = v{layer};
v{layer} = -mu*v{layer} + rate.*delta_w;
w_update = w_in + mu*v_prev{layer} + (1+mu).*v{layer};
m{layer} = beta1.*m{layer} + (1-beta1).*delta_w;
v{layer} = beta2.*v{layer} + (1-beta2).*(delta_w.^2);
w_update = w_in + rate.*m{layer}./(sqrt(v{layer})+eps);
case 'none'
w_update = w_in + rate.*delta_w;
end

lambda = 0.0005;

% Modify gradient update depending on regularization method
switch regularization
case 'L2'
w_update = w_update+lambda.*w_in;
case 'L1'
w_update = w_update+lambda.*sign(w_in);
otherwise
w_update = w_update;
end
end

MATLAB function for annealing the learning rate

The plots below show the effect of adaptive learning rates (per parameter) on convergence time for the wdbc dataset. We see that, using ADAM, we converge to 98.5% training accuracy in roughly 1/30th of the time it takes to converge with no adaptation (0.5 seconds vs. 15 seconds). Quite a substantial improvement! Also interesting that, in both cases, the algorithm gets stuck at a local minima in the parameter space (associated with 55% training accuracy), but Adam is able to ‘kick’ it out of this minima very quick, while with no parameter adaptation, it takes a few hundred epochs.

In the following two bar plots, I’ve compared the different momentum algorithms in terms of number of epochs until convergence, with the following network properties:

• iris Dataset (2 hidden layers, 4 nodes per layer, minibatch 12, 0.004 rate)
• wdbc Dataset (2 hidden layers, 16 nodes per layer, minibatch 32, 0.004 rate)

Effects of rate adaptation/momentum: (left) iris dataset, (right) wdbc dataset

We see that, for both training sets, the Adam algorithm improves performance substantially over no momentum, regular momentum and Nesterov momentum.

#### Running the DNN on MNIST

After completing my code, I created a DNN with 3 hidden layers, each with 60 neurons, and used it to train the MNIST dataset. I just used the training set of 60,000 samples and split it up into training (42,000), testing (9,000), and validation (9,000) sets. I used minibatches of 128 samples and a learning rate of 0.005. The algorithm ran for about 46 epochs and took 20 epochs (iterations over all of the training data) to converge to a 99.2% training accuracy.

DNN MNIST classification: (left) RMSE, (right) classification error

We see from the error plots below that most of the learning takes place in the first 2 epochs or so, after which fine adjustments are made until the target accuracy is reached. Metadata for the training session is given below:

DNN Results
Data Set: MNIST
Number of Hidden Layers: 3
Number of Neurons per Hidden Layer: 60
Size of minibatch: 128
Hidden Activation Function: tanh
Output Activation Function: tanh
Number of Input Features: 784
Number of Output Features/Labels: 10
Number of Training Instances: 48000
Number of total epochs: 5.066667e-02
Total Training Time: 46.328590 s
Training RMS Error: 0.001436
Test RMS Error: 0.006142
Validation RMS Error: 0.006131
Training Classification Success Rate: 99.166667 percent
Testing Classification Success Rate: 96.300000 percent
Validation Classification Success Rate: 96.366667 percent

So we get a testing accuracy of about 96.3%, which basically means, for every 30 digits in the test set, the algorithm will correctly classify 29 of them. This isn’t too bad, and the error is still decreasing so there is an opportunity to improve this even more. For comparison, the state-of-the- art boasts a 99.7% accuracy, which doesn’t sounds like much of a difference until you consider the misclassification rate is now 1 out of every 1000 digits. It might as well be a world of difference.

Some test inputs are shown below. For 32 test inputs, and given our classification accuracy, we would expect one to be incorrect, which is the case. However, our algorithm can be forgiven for the misclassification (that 8 looks a lot like a 0…)

Random MNIST test inputs and associated predictions

As a final sanity check, I compared the performance of my MATLAB MLP algorithm with the performance of an identical MLP implemented through PyTorch (a popular machine learning framework implemented in Python):

class MLPNet(nn.Module):
def __init__(self):
super(MLPNet, self).__init__()
self.fc1 = nn.Linear(28*28,60)
self.fc2 = nn.Linear(60,60)
self.fc3 = nn.Linear(60,60)
self.fc4 = nn.Linear(60,10)

def forward(self, x):
x = x.view(-1, 28*28)
x = F.tanh(self.fc1(x))
x = F.tanh(self.fc2(x))
x = F.tanh(self.fc3(x))
x = self.fc4(x)
return x

MNIST Classification comparison between my MATLAB implemenation and the PyTorch implementation is plotted below. We see that the performance between the two implementaitons is nearly indistinguishable. The PyTorch algorithm was also trained for 20 epochs (total training time was about 200 seconds, a factor of 4 slower than the MATLAB implementation), reaching a final test set classification accuracy of 96.7%.

MLP performance for MNIST classification: (left) MATLAB, (right) PyTorch

Some argue that MNIST is falling out of fashion for reasons and (speaking of fashion) have moved towards Fashion-MNIST, which replaces the digits with low-res images of clothing articles with 10 separate classifications. With absolutely no tuning and the same parameters as I used on the regular MNIST, I re-trained on Fashion-MNIST, and achieved a testing accuracy of 87.1%. Some metadata is below:

DNN Results
Data Set: Fashion_MNIST
Number of Hidden Layers: 3
Number of Neurons per Hidden Layer: 60
Size of minibatch: 128
Activation Function: tanh
Number of Input Features: 784
Number of Output Features/Labels: 10
Number of Training Instances: 42000
Number of total epochs: 10.6
Total Training Time: 3003.711874 s
Training RMS Error: 0.037384
Test RMS Error: 0.038780
Validation RMS Error: 0.038518
Training Classification Success Rate: 89.019048 percent
Testing Classification Success Rate: 87.066667 percent
Validation Classification Success Rate: 87.244444 percent

Comparing to some benchmarks here, we see that other MLP (multi-layer perceptron) algorithms are getting testing accuracies of between 87%-88%, so we’re right on the money there. In fact this seems to be an upper bound for vanilla MLPs. I would expect CNN’s to perform much better, and they do (getting around 95% testing accuracy). So maybe we’ll revisit this dataset when I get to CNNs.

Some test inputs are shown below. In my opinion, the items that were misclassified are pretty dubious (that coat looks a lot like a dress to me), so it’s hard to place too much blame on the algorithm.

Random Fashion-MNIST test inputs and associated predictions

Given the results of my algorithm on MNIST and Fashion-MNIST, and comparing to benchmark results found on the web, I think it’s fair to say that my DNN works. MATLAB code can be found on my github. It’s fairly straightforward to run, and there are a number of optional parameters that can be tweaked and tuned at the command prompt level; the following is how the training process is initialized (The README provides more details).

train_DNN(dataset,'numNodes',60,'numLayers',3,'rate',0.002,...
'minibatch',128,'activation','tanh','outputactivation', 'tanh',...

format: plain


text:
# UKCA Chemistry and Aerosol Tutorials: Background Motivation

These UKCA tutorials are designed with the following premise:

What are the most common things that a PhD student or Researcher will need to know how to do when they start using UKCA?

Often you will want to use UKCA to answer questions like these:

• What happens when I add in reaction A to form new species B?
• What is the effect of changing the emissions of C?
• How does the deposition of D affect process E?
• How do my changes affect the aerosol properties?
• What is the budget of F?
• Output the fluxes of reactions G, H, and I to diagnose it.

When you have completed the UKCA Tutorials you should have a basic understanding how to make the required changes needed to answer these questions.

Throughout the tutorial you are asked to perform a series of tasks. In fact, these are mostly part of one big task which is:

Create two new species, ALICE and BOB, then include emissions of ALICE and the reaction
${\displaystyle {\textrm {ALICE}}+{\textrm {OH}}\longrightarrow {\textrm {BOB}}+{\textrm {Sec}}\_{\textrm {Org}}}$
before including the dry deposition of ALICE and the wet deposition of BOB. You should also output the fluxes through the reaction and deposition processes. You will then look at several aerosol diagnostics and perform a sensitivity experiment.

Despite seeming to be straight-forward, this is actually quite a big task as it involves

• Rose changes
• Editing of STASHmaster_A (diagnostic definition) file & associated metadata changes
• Changes to STASH (diagnostic) output
• UKCA code changes
• New species
• New emissions
• New/editing reactions & deposition
• Working with various UM files
• Regridding input data
• Creating NetCDF files
• Processing UM output

When working with UKCA it is important to

1. Break the tasks down into manageable chunks (this is why the task is split across several tutorials)
2. Remember that UKCA currently sits within the UM framework

The Tutorials are broken down into three sections

1. General use of UKCA and Rose (Tutorials 1-3)
• These three tutorials cover the basics of the copying and running a UKCA suite, before outputting a field through STASH
2. UKCA Chemistry (Tutorials 4-9)
• These tutorials break down the chemistry task into 6 smaller chunks


text:
Symbol
Problem
Find the quotient and remainder on dividing polynomial $x^{2}-x+1byx+1$ Find the quotient and remainder on dividing $6x^{2}-5x+1$ $by2x-1$ Find the quotient and remainder on dividing $2y^{3}+4y^{2}+3y+1byy+1$ Find the quotient and remainder on dividing $x^{3}+5x+3x^{2}+5x^{3}+3$ b $4x+x^{2}+2$ Find the quotient and remainder on dividing $x^{2}-2xy+y^{2}byx-y$ Divide polynomial a by polynomial $a-b$


text:
Time filter¶

A time filter is an optional feature which allows the user to exclude specific timestamps from all quality control tests. The time filter is a Boolean time series that can be defined using elapsed time, clock time, or other custom algorithms.

Pecos includes methods to get the elapsed and clock time of the DataFrame (in seconds). The following example defines a time filter between 3 AM and 9 PM,

>>> clocktime = pecos.utils.datetime_to_clocktime(pm.df.index)
>>> time_filter = pd.Series((clocktime > 3*3600) & (clocktime < 21*3600),
...                         index=pm.df.index)

The time filter can also be defined based on properties of the DataFrame, for example,

>>> time_filter = pm.df['A'] > 0.5

For some applications, it is useful to define the time filter based on sun position, as demonstrated in pv_example.py in the examples/pv directory.

The time filter can then be added to the PerformanceMonitoring object as follows,

>>> pm.add_time_filter(time_filter)


text:
# Must Matter Particles Have A Hard Edge?

It's my understanding that electrons are particles, and it's also my understanding that their location while orbiting an atom cannot be determined precisely and must be determined by statistics and probability, almost like electrons can be in multiple places at the same time. That made me think, hmm, could electrons exist more as smears instead of hard-edged particles? A smear can be in more than one place at a time. The only difference is a smear doesn't have a hard edge like a spherical particle would. It would sort of "blend" matter and space. I'm also wondering if perhaps smears would demonstrate wavelike properties that hard-edged particles can't. Is there any knowledge out there that states that matter particles either must have a hard edge or can't have a hard edge?

• Nov 30, 2014 at 21:44
• It actually is smeared out, until it must interact (i.e. transmit a force)! Dec 1, 2014 at 11:22
• Thank you for this wonderful question, by the way. The answers generated are terrific and really cover the topic from all angles. Welcome to Physics.SE! Dec 1, 2014 at 11:42

This is one of the key results of quantum field theory: particles are not single points, they are disturbances in quantum fields that are spread out over space. Typically the disturbance is not spread out very much, otherwise it looks more like what we know as a wave than a particle. The technical term for what you're calling a "smear" is a wavepacket.

In fact any object with non-zero physical extent is required to be deformable by relativity (but see below); otherwise pushing on it can transmit energy and information faster than light. And quantum mechanics rules at those scales so everything does have fuzzy edges. At the scale of the very small there are no sharply defined objects.

A consequence of this is that all fundamental particles are required to be dimensionless.

Alas, this introduces endless singularities into the math, so the plan is to find a theory which can combine relativity and quantum mechanics at the very small scale in a way to both preserves locality and prevents all those divergences. The best product to date is string theory.

I like the way you're thinking, but I'd like to try to open your mind a bit further.

A lot of our everyday concepts are a product of the net behaviour of billions of particles following the laws of physics. For example, consider a steel ball. It has a "hard edge". What does this mean? It means another ball can be anywhere outside of the hard edge, but cannot overlap. Why is this so? Because of billions upon billions of iron and carbon atoms in a stable arrangement which will not permit this (without enormous energy input). Now imagine two balls of cotton wool. They have "fuzzy edges" and so can overlap somewhat. Why? Because their particles rearrange themselves with only minor investment of energy.

If we assume (for purposes of argument) that electrons are fundamental particles that aren't made of smaller particles, then there is nothing to give them a "hard edge" or "fuzzy edge". They certainly have an effect on the particles around them, just as Jupiter has an effect on the Earth. But just because Jupiter is a "smear" (it is made of gas) and the Earth has a hard edge, doesn't mean electrons have any physical shape at all!

The lesson here is that concepts that seem to apply to all objects in our experience, like volume, density, and shape, are not necessarily "universal" and there is no reason to expect they apply to the very particles that give rise to them!

Electrons have a position, though it's not a traditional $(x,y,z)$ co-ordinate but a set of probability distributions. This is not the shape of the electron. It is its location. Without a shape, how can we visualise what is going on in the subatomic world?

Well, let me ask you this. Does your group of friends have a shape? You could write their names in a list, or in a circle, ordered in countless ways, but there would be nothing that lets you visualise the "physical reality", except maybe a map of all their current locations. Such a map would tell you very little about the system. Even photographs of all your friends would tell you very little about them. On the other hand, learning more about the characteristics of each of the people would give you a lot more understanding of the system and how it behaves.

Although it's nice to visualise things, sometimes the fact that we can't visualise them helps prevent us from trying to apply inappropriate intuitions to them.

(To expand your mind just that little bit more: I suspect that the reason we can't seem to find a unified theory of physics is that we're not willing to let go of concepts like position and time, which makes it impossible to imagine the "particles" from which space and time arise.)

A particle does not need to have a hard edge. It can for example, be a density function, which sort of fades to zero.

One might note that waves can intersect each other and come out as if the other wave was not there.

Particles with hard edges are more an artefact of our minds rather than 'what's really there', until we get some real evidence otherwise. Note however, that the scattering rules would still apply if the particle is nebulous, because instead of hitting a solid wall and bouncing off, one essentially rolls up some steep hill, and roll down at a different angle.

It's just that tennis balls are easier to understand, but they might not be the correct model at femtometre-scale physics.


text:
cargo gained a new feature this week! You can now download dependencies from alternative registries, alongside the dependencies you download from crates.io. This is an important step in enabling organizations to distribute their internal libraries through cargo without requiring them to upload those libraries to a public registry.

This feature will be available on nightly only, and it is gated behind the alternative-registries feature gate. We’ve used feature gates to iterate on new and unstable features in rustc since the 1.0 release, but this is the first time we’ve used feature gates in cargo.

# Background on registries and sources

Since before 1.0, cargo has been paired with the crates.io registry. This registry contains thousands of crates which make up the majority of the Rust library ecosystem, and cargo makes it convenient to download and use libraries stored in the crates.io registry.

However, there are many reasons why a user might not wish to upload their library to crates.io. Proprietary code, in particular, is not suitable for the registry, which allows anyone to download any crate it contains. For this reason, cargo has always supported alternative sources to the registry. Specifically, it has supported pulling dependencies from a file path or a git repository.

On the other hand, cargo so far has only allowed you to depend on crates from a single registry at a time. Registries like crates.io are preferable to git sources in many situations because they are able to more effectively manage multiple versions of your crate, and perform version resolution for you. With this new feature, you will be able to pull in crates from a registry other than crates.io.

# How to add a crate from an alternative registry

## Turning on the nightly feature

Because this feature is still unstable, you need to declare your use of the feature flag in your Cargo.toml. This is done using a top level array member named cargo-features. Just add this to the top your Cargo.toml file in the project you’ll be adding the dependency to:

cargo-features = ["alternative-registries"]

[package]
name = "my-crate"
version = "1.0.0"
...

## Declaring a new registry

Once you’ve turned the alternative-registries feature on for your crate, you need to make sure that you have declared your registry so that cargo can find it. You need to do this in .cargo/config file (not in a Cargo.toml file).

The .cargo/config has a new section called registries. Declare a subsection with the name of your registry. It must have at least one member called index, which is the URL of the index for your registry (for example, crates.io’s index is located at https://github.com/rust-lang/crates.io-index).

[registries.my-registry]
index = "https://gitlab.com/my-organization/my-registry"

We require you to declare the index of the registry in you .cargo/config rather than in a Cargo.toml to encourage robustness in the event the index has to be moved to a new location. If you depend on crates on one registry that depend on crates in another, the actual location of that registry should be provided at the user level, rather than stored with the crate, so that it is easier for the user to change it if it ever needs to be changed.

This also matches the best default for what we believe will be the primary use case for alternative registries: internal registries for private organizations. Rather than requiring each new project to redeclare its dependency on that registry, each machine can be preconfigured to be able to locate the registry.

## Pulling in a crate from your registry

Once you’ve declared a registry, depending on crates from it looks very similar to depending on crates from crates.io. The only difference is that you must specify a registry key in that dependency’s section of your Cargo.toml, so that cargo knows to download the crate from your registry instead of the default one:

[dependencies.foobar]
version = "1.4.0"
registry = "my-registry"

If your registry has a matching, unyanked crate with a satisfactory version number, running the cargo fetch should resolve and download this dependency and you’re good to go.

# Creating an alternative registry

We’ve looked at how you can download crates from an alternative registry, but we haven’t discussed how to actually create a registry you can use. Today, we don’t yet have any tools that make it easy to bootstrap your own registry, but we have attempted to document what each registry must provide to work with cargo. Specifically, the minimum viable registry requires two components:

• A git repository which provides the index of the crates in your registry.
• An HTTP source from which cargo can download tarballs of crates.

## Indexes

Each cargo registry provides an index, which is a git repository following a particular format. The index is used by cargo to resolve dependencies, as well as the transitive dependencies of your direct dependencies. This is the information cargo uses to figure out which crates it needs to download for you to build your crate.

The index contains a file for each crate in the registry. These files contain information regarding each version of that crate, as a series of newline separated JSON objects. Each object contains information like all of the dependencies and features of that crate, a checksum of the tarball associated with that version, and so on.

To avoid having overly large directories, cargo separates these files into directories based on the initial characters of the package’s name. For example, the foobar package is located in fo/ob/foobar.

Additionally, the index also contains a file in its root named config.json. This file contains a JSON object which must at minimum contain the dl key, which identifies the root URL for the source of crate tarballs.

The full index specification is provided in RFC #2141.

## The crate API

The API behind the dl route provides the actual source of the crate dependencies to be built. GET requests to the route $dl-route/$crate-name/\$crate-version should return the tarballs generated by the cargo package corresponding to that version of the crate. The sha256sum of the tarball needs to match the the checksum in the index file for that version of the crate.

## Warning: cloning crates.io may be ill-advised

Creating and updating a registry manually is not a fun process. Users will almost certainly want some sort of tooling to automate the process of creating and maintaining private registries, but such a tool does not yet exist. We don’t currently intend to sponsor any tool officially; we predict that multiple tools along these lines will develop in the community ecosystem over time.

One solution that seems viable today is to clone the crates.io project and set up and instance of it yourself. This solution will work, but you should be aware that it comes with some downsides:

• crates.io is a full-fledged web app, and you will be responsible for operationally maintaining your instance of it. This may be more ops overhead than you want to take on.
• Much of the overhead comes from features that may not be suitable for your use case, such as its web interface, GitHub account auth, and various crate discovery features.
• As crates.io grows both in features and traffic, it will continue to develop more operational complexity. The development of crates.io will always prioritize its primary use case as the public, default registry over the use cases of anyone operating a clone of it.

Hopefully, other solutions will be developed soon which are specifically targeted at the alternative registries use case, but I wanted to put a little caveat emptor on the notion that cloning crates.io is the obvious way to create your own registry.

# Next steps

Though we now support fetching crates from alternative registries, there’s still more to do to fully build out this feature:

• We want to support performing other operations on alternative registries, such as cargo publish and cargo yank. We have a design for supporting these kinds of commands in alternative registries without having too negative of an experience if the registry isn’t capable of supporting them.
• We want cargo to manage credentials for multiple registries. This also possibly means support for a wider variety of authentication schemes than cargo possibly knows how to support today.
• We plan to include a subcommand which generates the metadata necessary to create an index entry for a crate, to assist in writing tooling to create alternative registries.

If you’re interested in getting involved in the rest of this work - or just giving feedback on what we’ve got so far - I encourage you to get in touch with the cargo team. You can reach us in the alternative registries gitter channel, the cargo repository, or the #cargo channel on Mozilla’s IRC server.

Thanks to @cswindle, @carols10cents, @alexcrichton and everyone else for helping to bring this feature into reality!


text:
# How-to implement iteration over a result of an iteration in a functional way

I have a pure function

f:= #1 * #2 * #3 &;

Which I can invoke in a following way:

f[#,2,3]& /@ {1,2,3}

Which yields following result:

{6, 12, 18}

How could I do something like this:

f[#1,#2,3]& /@ {{1,2,3},{1,2,3}}

such that the return product would look like:

{{3,6,9},{6,12,18},{9,18,27}}

I understand there is a syntax error above. I struggle coming up with a functional solution which would avoide iteration and loops. I'd greatly appreciate any assistance.

Example based on OOP (conceptual):

List<Integer> nums = new ArrayList<Integer>();
for(int i = 1; i < 5; i++){
for(int m = 1; m < 3; m++){
product = i * m * 3;
}
}
System.out.println("Product: " + nums.toString());

As mentioned in the comments, the construct you are probably looking for is Outer (see its documentation page).
You could then define the following function to achieve what you indicated, even without using Map:
Clear[func]


text:
# Homework Help: Electric field due to a charged disk

1. Aug 1, 2015

### Noctisdark

1. The problem statement, all variables and given/known data
I'm reading Griffith-Introduction to electrodynamics, In chapter 2 about electrostatics, I've encounter few problems that I've managed, to solve (luck !!), I'm asked to calculate the electric field due to a charged disk of radius R in a point P above the center (Pic)

2. Relevant equations
Electric field due to uniform continuous charge distrubition
$$\vec E = \frac {1}{4 \pi \epsilon _0} \int \int \frac {\sigma \hat{r}}{r^2}dS$$

3. The attempt at a solution
I've tried to use the usual approach, that is cutting the disk into little circles, $\lambda = \frac {Q}{L} = \frac{\sigma A }{L} = \frac{\sigma 2 \pi r dr}{2 \pi r} = \sigma \cdot dr$
The electric field due to that circle is $|\vec E_z| = \frac {\lambda}{4\pi\epsilon_0} \int \frac{dArc}{(R^2 + z^2)^\frac{3}{2}} = \frac {\lambda}{4\pi\epsilon_0} \int_0^{2\pi}\frac {zR \cdot d\theta}{(R^2 + z^2)^\frac{3}{2}}$,You just multiply by 2 $\pi$ and sub the $\lambda$ , $|\vec E_z| = \frac{\sigma zR \cdot dr}{2\pi\epsilon_0}\frac{1}{(R^2 + z^2)^\frac{3}{2}}$, I should have written$d\vec E_z$ because we'll integrate that from 0 up to R, so $$\vec E_z = \frac{\sigma}{2\pi\epsilon_0(R^2 + z^2)^\frac{3}{2}} \int_0^zR\cdot dr = \frac{\sigma zR^2}{2\pi\epsilon_0(R^2 + z^2)^\frac{3}{2}}$$, I know that this is wrong, so can someone tell me where I've messed things up ?
One more Request, where can I find more problems about electrostatics, I need some practice Thanks !!

#### Attached Files:

• ###### téléchargement.jpg
File size:
6.3 KB
Views:
66
Last edited: Aug 1, 2015
2. Aug 1, 2015

### blue_leaf77

First, in deriving the E field due to the circle, why is there $r$ when you have already defined the circle radius to be $R$? Second you should check again the correct expression for the integrand of the E field due to a circle, for instance I guess you know that all E field components perpendicular to the circle's axis cancel out for any point on the axis. This gives us a cosine of the half-angle of the cone formed by the observation point and the circle, what's the expression for this cosine?

3. Aug 1, 2015

### Noctisdark

I I've missed that, thanks ! I will Edit that right away, I've included the expression of the cosine in $\frac{1}{(R^2 + z^2)^{\frac{3}{2}}}$

4. Aug 1, 2015

### blue_leaf77

Yes I know that but don't you think you missed one thing in the numerator?

5. Aug 1, 2015

### Noctisdark

Aw there a z missing,

6. Aug 1, 2015

### blue_leaf77

And finally in the last integral, the integration element should be $dR$ right, which means any $R$ must be inside the integral and to be integrated along.

7. Aug 1, 2015

### Noctisdark

I think it should be $dr$, because I've followed the approach that cuts the circle into little parts, from $r \text{ to } r+dr$,

8. Aug 1, 2015

### blue_leaf77

Nope, remember in your approach initially you wanted to divide the disk into co-centric rings and calculate the electric field due to a single ring with radius $R$, let's denote this circle's E field $E_{ring}$. Having found this (hopefully you did it correctly), you still have to add contributions due to the other rings constituting the original disk. Which means you have to add up rings with varying radius from zero out to the radius of the original disk, let's denote it by $R_{disk}$.
May be what keeps confusing you is that you haven't changed the $r$ in the expression of $\lambda$.

9. Aug 1, 2015

### Noctisdark

Aw, I've missed that too, In fact I intended to make $r$ the radius of the rings but I wrote $R$ and sticked with it, Okey I'm going to edit that two, I think I wrote a wrong $\lambda$, it's dR not dr too

10. Aug 1, 2015

### Noctisdark

$\lambda = \sigma dR$
$\vec E= \frac{\sigma z}{2\pi\epsilon_0} \int_0^r \frac{RdR}{(R^2 + z^2)^{\frac{3}{2}}} = \frac{-1}{\sqrt{R^2 + z^2}}$ evaluate from 0 to r and I get $|\vec E| = \frac{\sigma z}{2\pi\epsilon_0}\cdot(\frac{1}{\sqrt{r^2 + z^2}} - \frac{1}{z})$

Last edited: Aug 1, 2015
11. Aug 1, 2015

### blue_leaf77

Only some small mistakes left there, first you should check again whether $\pi$ should be present and why the magnitude of the E field is negative.

12. Aug 1, 2015

### Noctisdark

$|\vec E| = \frac{\sigma}{2\epsilon_0}\cdot(1 - \frac{z}{\sqrt{r^2 + z^2}})$ Waow thank you very for your assistance :)

13. Aug 1, 2015

### blue_leaf77

You are welcome.


text:
研究成果・発表論文

Radiation drag driven mass accretion in a clumpy interstellar medium: implications for the supermassive black hole-to-bulge relation

Kawakatu, Nozomu,   & Umemura, Masayuki

要旨
We quantitatively scrutinize the effects of the radiation drag arising from the radiation fields in a galactic bulge in order to examine the possibility that the radiation drag could be an effective mechanism to extract angular momentum in a spheroidal system like a bulge and allow plenty of gas to accrete on to the galactic centre. For this purpose, we numerically solve the relativistic radiation hydrodynamical equation coupled with accurate radiative transfer, and quantitatively assess the radiation drag efficiency. As a result, we find that in an optically thick regime the radiation drag efficiency is sensitively dependent on the density distributions of the interstellar medium (ISM). The efficiency drops according to \ensuremathτT-2 in an optically thick uniform ISM, where \ensuremathτ$_T$ is the total optical depth of the dusty ISM, whereas the efficiency remains almost constant at a high level if the ISM is clumpy. Hence, if bulge formation begins with a star formation event in a clumpy ISM, the radiation drag will effectively work to remove the angular momentum and the accreted gas may form a supermassive black hole. As a natural consequence, this mechanism reproduces a putative linear relation between the mass of a supermassive black hole and the mass of a galactic bulge, although further detailed modelling for stellar evolution is required for a more precise prediction.


text:
# Toronto Math Forum

## MAT334-2018F => MAT334--Tests => Term Test 1 => Topic started by: Victor Ivrii on October 19, 2018, 03:53:25 AM

Title: TT1 Problem 2 (morning)
Post by: Victor Ivrii on October 19, 2018, 03:53:25 AM

(a) $\displaystyle{\sum_{n=1}^\infty \frac{2^n z^n n}{3^n }}$

(b) $\displaystyle{\sum_{n=1}^\infty \frac{z^n n!}{ (2n)! }}$

If the radius of convergence is $R$, $0<R< \infty$, determine for each  $z\colon |z|=R$ if this series converges.
Title: Re: TT1 Problem 2 (morning)
Post by: Vedant Shah on October 19, 2018, 08:59:45 AM
(a)
By Ratio Test:
$\lim_{n \to \infty} |\frac{a_{n+1}}{a_n}| = \lim_{n \to \infty} |\frac{2^{n+1} z^{n+1} {n+1}}{3^{n+1}} \frac{3^{n}}{2^{n} z^{n} n}| \\ =\lim_{n \to \infty} |\frac{n+1}{n} \frac{2}{3} z| \\ = |\frac{2}{3} z|$

We want $\lim_{n \to \infty} |\frac{a_{n+1}}{a_n}| < 1$:
$|\frac{2}{3} z| < 1 \\ |z| < \frac{3}{2} \\ R = \frac{3}{2}$

Now testing $|z| = \frac{3}{2}$:
$\sum\limits_{n=1}^{\infty} |\frac{2^{n} z^{n} {n}}{3^{n}}| \\ = \sum\limits_{n=1}^{\infty} \frac{|2|^{n} |z|^{n} {|n|}}{|3|^{n}} \\ = \sum\limits_{n=1}^{\infty} \frac{|2|^{n} |\frac{3}{2}|^{n} {|n|}}{|3|^{n}} \\ = \sum\limits_{n=1}^{\infty} |n|$

The series diverges at the boundary, thus we have:
$|z| < \frac{3}{2}$

(b)
By Ratio Test:
$\lim_{n \to \infty} |\frac{a_{n+1}}{a_n}| = \lim_{n \to \infty} |\frac{ {(n+1)}! z^{n+1} }{{(2n + 2)}!} \frac{{(2n)}!}{{n}! z^{n}}| \\ =\lim_{n \to \infty} |\frac{n+1}{(2n+1)(2n+2)}z| \\ = 0$

Thus, $\lim_{n \to \infty} |\frac{a_{n+1}}{a_n}| < 1 \forall z$
Therefore, we have the series converges for:
$R = \infty \\ |z| < \infty$


text:
# Writing a small llvm compiler front end in haskell

Posted on July 28, 2017

LLVM is an awesome framework, and there is a very nice tutorial out there that explains how to use llvm with haskell to write a compiler frontend. Said tutorial covers all aspects of using LLVM from haskell, starting from writing a lexer and parser. While this is certainly very good to have and the end result is a complete (albeit small) language, it was too much for my taste to get started with llvm. I wanted something simple, that would fit on a few pages and shows how LLVM is used from haskell, without having to understand the semantics of a particular language and so forth.

So I decided to write the smallest possible llvm front end in haskell that I can think of. The first idea was to calculate the birth year of Adam Weishaupt (hence the variable names) but I decided I’d keep it even simpler and just add a few values and emit the result as characters to the console by calling the libc function putchar(). My work is based on said tutorial and stripped down to the bare minimum. If you want more, go read that (excellent) tutorial, and the documentation of the llvm framework. :-)

I’m not using a state monad, which makes the code a little less convenient than the C++ equivalent, because we explicitly need to keep track of the state, as you will see in the code. Anyway, let’s get started.

First, the boring part, the imports:

{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.Int
import Foreign.Ptr
import LLVM
import LLVM.Analysis
import LLVM.AST
import LLVM.AST.CallingConvention
import LLVM.AST.Global
import LLVM.Context
import LLVM.Module
import LLVM.PassManager
import qualified LLVM.AST.Constant as ASTC
import qualified LLVM.AST.Operand as ASTO
import qualified LLVM.ExecutionEngine as EE
import qualified Data.Text as T
import qualified Data.Text.Encoding as TE
import qualified Data.ByteString.Char8 as S8
import LLVM.AST.Instruction

Okay, now that that’s done, we need to define some types. We’ll be working with 64 bit integers. The putchar function has the following type signature in C:

void putchar(int character);

So, let’s define a 64 bit integer type and a type for the putchar function.

int64type :: Type
int64type = IntegerType 64
printT :: Type
printT = FunctionType VoidType [int64type] False

Next, some configuration for the llvm optimization pipeline and JIT compiler.

jit :: Context -> (EE.MCJIT -> IO a) -> IO a
jit c = EE.withMCJIT c optlevel model pretlim fastins
where
optlevel    = Just 3
model       = Nothing
pretlim     = Nothing
fastins     = Nothing

Since we use a JIT and run the generated machine code directly from our haskell program, we need to import the generated main function (which does not even exist at this time):

foreign import ccall "dynamic" haskFun :: FunPtr (IO Int64) -> (IO Int64)

And a haskell helper function to call into that foreign function:

run :: FunPtr a -> IO Int64
run fn = haskFun (castFunPtr fn :: FunPtr (IO Int64))

Next comes a big main function. We start by defining some constants:

main :: IO ()
main = do
let adam        = ASTC.Int 64 67
weishaupt   = ASTC.Int 64 23
mul         = ASTC.Int 64 100
success     = ASTC.Int 64 1723

Next, let’s perform a multiplication and an addition. As I mentioned earlier, because I don’t use a state monad, this is a little awkward. First, we define the instruction itself and then an “unnamed” label to reference it. This would be abstracted away in a real world example as is done in the tutorial I mentioned earlier.

tmp1        = Mul False False (ASTO.ConstantOperand adam)
(ASTO.ConstantOperand mul) []
nameTmp1    = UnName 1
sum         = Add False False (LocalReference int64type nameTmp1)
(ASTO.ConstantOperand weishaupt) []
nameSum     = UnName 2
success     = ASTC.Int 64 1723

Now it’s time to define the external print function (putchar(), as defined by stdlibc) and call it.

printFun    = ASTC.GlobalReference printT $Name "putchar" printit = Call Nothing C [] (Right$ ASTO.ConstantOperand printFun)
[(LocalReference int64type nameTmp1, [])] [] []
printItLabel = UnName 5
printit2    = Call Nothing C [] (Right $ASTO.ConstantOperand printFun) [(ASTO.ConstantOperand adam2, [])] [] [] printItLabel2 = UnName 6 Where did all the instructions go? Well, we need to put them all in a list and assign them to their respective “anonymous” labels: instrs = [ (nameTmp1 := tmp1), (nameSum := sum) , (printItLabel := printit) , (printItLabel2 := printit2) ] Finally, we define the main function: mainblock = BasicBlock (Name "hello") instrs (UnName 3 := Ret (Just$ ASTO.ConstantOperand success) [])

As you can see, we specify a list of instructions as the body of the function and an instruction that computes the function’s return value.

Now we need to put all that into llvm’s structures.

moduleDef   = GlobalDefinition $functionDefaults { name = Name "haskmain" --, linkage = AvailableExternally , parameters = ([], False) , returnType = int64type , basicBlocks = [mainblock] } printDef = GlobalDefinition$ functionDefaults {
name        = Name "putchar"
, parameters  = ([Parameter int64type (Name "val") []], False)
, returnType    = int64type }
fun         = defaultModule { moduleName = "HelloWorld"
, moduleDefinitions = [moduleDef, printDef] }

Almost there. The final step is to call llvm, pass it these structures and call the resulting just-in-time compiled function.

withContext $\context -> withModuleFromAST context fun$ \m ->
withPassManager passes $\pm -> do putStrLn "Verifying IR..." verify m putStrLn "Optimizing IR..." runPassManager pm m s <- moduleLLVMAssembly m S8.putStrLn s putStrLn "Generating object code..." optMod <- moduleAST m jit context$ \ee ->
EE.withModuleInEngine ee m $\eee -> do putStrLn "Loading function into executable memory..." mainfn <- EE.getFunction eee (Name "haskmain") case mainfn of Just fn -> do putStrLn "Running!" res <- run fn putStrLn$ "Retval: " ++ show res
Nothing -> do
putStrLn "no fun"
print "ok"

That’s it. Please do contact me with any questions, bug reports or toy languages you have discovered. :-)

Update: I’ve updated the source to the github.


text:
## Encyclopedia > List of phobias

Article Content

# List of phobias

The following is a list of phobias or more accurately, fears that have been given names. The article on phobias discusses the different kinds of phobias in more detail. In most instances the words listed here are neologisms (made-up words) coined to demonstrate a grasp of Greek word roots rather than descriptions of an actual condition. Only a few of the following terms occur in the medical literature.

Most of these terms were devised by adding the suffix -phobia to a Greek word for the object of the fear (some use a combination of a Latin root with the Greek suffix, which some consider linguistically impure).

Modern psychiatry groups phobias as "agoraphobia", "social phobia", or "simple phobia", avoiding coined words other than those which have been established by long use.

 Examples of differential equations ... forces, is $\frac{d^2x}{dt^2} = - c \frac{dx}{dt} - x$ where $c$ is our coefficient of friction, and [itex]c ...


text:
# Can u find this relation?

Algebra Level 3

One root is square of the other root of the equation $$x^2+px+q=0$$, then the relation between $$p$$ and $$q$$ is?

×


text:
How to ensure/know my customer loss exist differentiable?

Hello, I am designing my loss based on edge information for segmentation. The network (i.e Unet) provides a softmax probability P. The loss defined as

loss = \sum_i^N ( G_i - Pedge_i)^2

where Pedge_i is the binary edge of the softmax probability. It can obtain by using threshold P>0.5 or max(P,axis=1) for multiple class. and N is a number of pixel in ground-truth edge G.

Is possible to perform the loss in pytorch without writing backward function. I mean does it exist auto differentiable? Thanks


text:
# Win32: Scrollbar problem

## Recommended Posts

Evil Steve    2017
Hey all, I'm trying to make a custom control, since the ListView control was pissing me off no end. Now, I've got most of the code working fine, except there's a bug with the scrollbars. The scrollbar bars don't seem to move at all. I can click the arrows at the ends of the scrollbars, and click the pageup and pagedown bits, and my control recieves all the messages just fine, but the horizontal scrollbar stays stuck to the left hand side. Here's a screenshot, where I've scrolled over to the right by 37 pixels: As you can see, the contents are scrolled correctly, but the scrollbar doesn't move - it's still jammed into the left. And here's how my scrollbar is set up, and the code for handling WM_HSCROLL:
// Scrollbar setup
SCROLLINFO si;
memset(&si,0,sizeof(si));
si.cbSize = sizeof(si);
si.nPage = 32;
si.nMin = 0;
si.nMax = m_nMaxXScroll+BORDER_SIZE*3;   // Evaluates to 37
SetScrollInfo(m_hWnd,SB_HORZ,&si,TRUE);

// WM_HSCROLL handling:
case WM_HSCROLL:
{
switch(LOWORD(wParam))
{
case SB_BOTTOM: m_nX = m_nMaxXScroll; break;
case SB_LINEDOWN: if(m_nX < m_nMaxXScroll) ++m_nX; break;
case SB_LINEUP: if(m_nX > 0) --m_nX; break;
case SB_PAGEDOWN: if(m_nX < m_nMaxXScroll) ++m_nX; break;
case SB_PAGEUP: if(m_nX > 0) --m_nX; break;
case SB_THUMBTRACK: m_nX = HIWORD(wParam); break;
case SB_TOP: m_nX = 0; break;
}
InvalidateRect(m_hWnd,NULL,TRUE); // FIXME
}
break;

So, does anyone know what's causing this? EDIT: Changed title. I have a new question and didn't want to start a new thread... Thanks in advance, Steve [Edited by - Evil Steve on March 27, 2005 10:19:51 AM]

##### Share on other sites
Guest Anonymous Poster
Here's part of a wrapper I wrote awhile ago. Maybe it helps?

void WinScrollBar::setupScroll() {   SCROLLINFO si;   si.cbSize = sizeof(SCROLLINFO);   si.fMask = SIF_ALL;   si.nPos = propPosC;   si.nPage = propPageSizeC;   si.nMin = 0;   si.nMax = propScrollSizeC;   SetScrollInfo(hwndC, SB_CTL, &si, true);}void WinScrollBar::scroll(int scrollCode, int pos) {   switch (scrollCode) {      //In 'winuser.h' SB_LINEUP is equivalent to SB_LINELEFT, etc...      case SB_LINEUP:      scrollRight1();      break;      case SB_LINEDOWN:    scrollLeft1();       break;      case SB_PAGEDOWN:    scrollRightMany();   break;      case SB_PAGEUP:      scrollLeftMany();    break;      case SB_THUMBTRACK:  horScrollTrack(pos); return;      }   s_cast<WinBaseO*>(parentC)->setWindowPos(this, posC);   setupScroll();}

This is not using the default scrollbars for the windows, of course. It appears the I had to call the SetScrollInfo function after handling the message in order to set the correct state of the scrollbar.

David

##### Share on other sites
Guest Anonymous Poster
Never mind - it appears you have done that already. Sorry. But it doesn't appear that you set the .nPos member of the SCROLLINFO variable.

##### Share on other sites
Colin Jeanne    1114
When you handle WM_HSCROLL/WM_VSCROLL you have to update the scroll bar's info using SetScrollInfo(). It's counterintuitive, unfortunately. Here's an example from the MSDN.

##### Share on other sites
Evil Steve    2017
The nPos variable should default to 0, shouldn't it?
I also tried manually setting the position of the scrollbar like this, and it didn't make any difference:
case SB_THUMBPOSITION:{   SCROLLINFO si;   memset(&si,0,sizeof(si));   si.cbSize = sizeof(si);   si.fMask = SIF_POS;   si.nPos = HIWORD(wParam);   SetScrollInfo(m_hWnd,SB_VERT,&si,TRUE);   m_nX = HIWORD(wParam);}break;

##### Share on other sites
Evil Steve    2017
D'oh, I'm an idiot. I was setting the wrong scrollbar info >_< SetScrollInfo(m_hWnd,SB_VERT,&si,TRUE); should be SetScrollInfo(m_hWnd,SB_HORZ,&si,TRUE);

Oh well, I feel like an idiot now [smile]
Thanks for the replies

##### Share on other sites
Evil Steve    2017
Ok, I've got another scrollbar related question.
I was looking at the source for Scrolling A Bitmap again, and I tried to do what's done in that source for setting up the page size, which is:
nMin = 0;
nMax = max(ContentWidth-ClientWidth, 0);
nPage = ClientWidth;

My content width is 192px, my client width is 167px, so the max scrollbar range is 25px.
However, now the scrollbar doesn't show up at all. I suspect the page size is supposed to be less than the scroll range, but that doesn't match the MSDN example.

Am I being an idiot again, and missing the blindingly obvious?

##### Share on other sites
Evil Steve    2017
*bump* Anyone?

##### Share on other sites
Implementing Scroll bars with the Win32 API is a B**ch!.

Do you have Petzold's Windows Programming book? cause he has some pretty good examples in it about scroll bars (a whole chapter).

relient.

##### Share on other sites
Have you done something like this in your source code?:

TEXTMETRIC tm;
int cxChar;

cxChar = tm.AveCharWidth;

nMax = max((ContentWidth-ClientWidth) * cxChar, 0);

##### Share on other sites
Guest Anonymous Poster
I've placed an example of a working scrollbar on my site for you, using my wrapper library. It should show you enough by stepping through it that you can figure out how to recreate it in pure Win32 if you so desire. It was put together in Borland, so you will have to recreate it if using VC. (Shouldn't be that hard. Just keep adding units until no more errors.)

http://www.randommonkeyworks.com/realdraw/scrollbars.zip

David


text:
# In your own words, summarize the guidelines for finding limits at infinity of rational functions.

In your own words, summarize the guidelines for finding limits at infinity of rational functions.

• Questions are typically answered in as fast as 30 minutes

### Plainmath recommends

• Get a detailed answer even on the hardest topics.
• Ask an expert for a step-by-step guidance to learn to do it yourself.

Laith Petty
The following are the guidelines for finding limits at infinity of rational functions.
1. Ifthe degree of the numeratoris less than the degree of the denominator, the the limit at infinity is 0
2. If the degree of the numerator is greater than the degree of the denominator, the the limit at infinity does not exist
3, Ifthe degree of the numeratoris equal tothe degreeof the denominator, the limit is equal to the ratio of the leading coefficients.


text:
06-21 A.N. Gorban
Basic Types of Coarse-Graining (796K, PDF) Jan 24, 06
Abstract , Paper (src), View paper (auto. generated pdf), Index of related papers

Abstract. We consider two basic types of coarse-graining: the Ehrenfest's coarse-graining and its extension to a general principle of non-equilibrium thermodynamics, and the coarse-graining based on uncertainty of dynamical models and $\varepsilon$-motions (orbits). Non-technical discussion of basic notions and main coarse-graining theorems are presented: the theorem about entropy overproduction for the Ehrenfest's coarse-graining and its generalizations, both for conservative and for dissipative systems, and the theorems about stable properties and the Smale order for $\varepsilon$-motions of general dynamical systems including structurally unstable systems. A brief discussion of two other types, coarse-graining by rounding and by small noise, is also presented. Computational kinetic models of macroscopic dynamics are considered. We construct a theoretical basis for these kinetic models using generalizations of the Ehrenfest's coarse-graining.

Files: 06-21.src( 06-21.comments , 06-21.keywords , CoaGrWorkSpri3.pdf.mm )


text:
# Is there a good notion of non-termination and halting proofs in type theory?

Constructive type theory with its basic interpretation under the curry howard correspondence consists only of total, computable functions. In the literature, some has been said on using "computational type theory" in order to represent non-termination in functional programs, yet in the papers I have come across, this does not seem to be the major motivation for the theory (For example Benton mentions non-determinism, continuations, and exceptions, without going into much detail on non-termination), so I have yet to find a paper giving a robust interpretation of non-termination using computational type theory.

Specifically, what I am looking for is a way that given a type representing a possibly non terminating computation of type $A$, $T(A)$, there should be some notion of proofs that $x : T(A)$ terminates of type $H(x)$, such that given $x:T(A)$ and $p:H(x)$, we can construct a term $\tilde x : A$.

My motivation for this is, I'd like to eventually be able to more formally relate notions in computational complexity theory to constructive type theory. Specifically, I am interested in what power as a formal theory constructive types gain with access to a halting oracle, and in order to do so, I of course need to actually have a formal notion of possible non-termination, and proofs of halting to go along with it inside a type-theoretic framework.

• Did you look at Constable-Mendler, Recursive Definitions in Type Theory? They give a way of defining for every fixed-point recursive definition of a partial function $f$ from $A$ to $B$ a domain predicate $\mathrm{dom}(f)$ such that for $x\in A$, $\mathrm{dom}(f)(x)$ represents the type of proofs that $f$ halts at $x$. I believe this is implemented in Nuprl. – Ulrik Buchholtz Apr 12 '16 at 2:19
• Are you looking for the delay monad? – Andrej Bauer Apr 12 '16 at 6:34
• @UlrikBuchholtz I think that's pretty close to what I'm looking for, though I'm having some difficulty parsing through the Nuprl notation that is used in the paper -- which I am not similar with. If I understand correctly, they essentially define a partial recursive function from $A$ to $B$ (or at least, identify them with) as a total recursive function from $\{x:A | dom(f)(g) \} to B. (See the remark at the bottom of page 27) – Nathan BeDell Apr 12 '16 at 16:15 ## 1 Answer Because one of the principal applications of Type Theory in formalizations has been to study programing languages and computation in general, a lot of thought has gone into ways of representing possibly non-terminating programs. I won't make a complete survey here, but I'll try and give pointers to the main thrusts of different directions. • The "relational" approach: you can define your hypothetical programs as relations say,$F\ x\ y$which holds iff$f$is defined at$x$and$f(x)=y$. This is usually what is done with the Kleene T-predicate. This works just as well in type theory formalizations as it does in classical logic, (though of course you can't prove$\forall x (\exists y, F\ x\ y)\vee (\neg\exists y, F\ x\ y)$). A more sophisticated way to do this is the "Bove-Capretta" method (see Modelling Recursion in Type Theory, which for each recursive function, defines an "accessible predicate" which encodes the fact that a given computation is finite. The function definition takes an extra argument which is a proof that the given inputs are accessible. To define the function without this extra predicate, you need to prove that every possible combination of inputs is accessible. • The "coinductive" approach: this is possibly the most explored approach, and what Andrej's comments refer to. A computation of type$A$is defined as the inductive type (from Andrej's link, by Capretta, Altenkirch & Uustalu: codata Delay A = | Now : A -> Delay A | Later (Delay A)  This codes a possibly infinite stream of Later tokens ("ticks" of computation) maybe ending with a result Now a. Non-termination is equivalent to being bisimilar with the program loop = Later loop and termination can be defined by an inductive predicate over Delay A: data Terminates : Data A -> Prop = | Term_now : forall x, Terminates (Now x) | Term_later : forall d, Terminates d -> Terminates (Later d)  I think the agda-istas have a lot to say about this which they call the partiality monad (see e.g. Danielsson). • The "partial type theory" approach: this is a bit more experimental (the theory is still being worked out), but there are some type theories that are being developed to cope with the fact that there are essentially two types of functions we want to write in type theory: the proof terms and the programs. It turns out to be tough to get a reasonable theory of these things (and retain consistency of the theory), but a serious attempt is made here by Casinghino et al, and a similar effort by Kimmel et al. I'm sure there are other approaches I'm not aware of, and I'd be happy if someone wants to complete this list. I should probably note that adding a termination oracle to a (consistent) type theory is a lot like adding a truth oracle for$\Pi^0_1\$ sentences, with relatively well understood consequences.

There are other, quite fruitful interactions between type theory and complexity theory, usually under the umbrella of implicit computational complexity.

• Interesting, thanks for the information! I believe the partial type theory approach is probably closest in spirit to what I am looking for -- and at the very least, the Kimmel paper seems to provide on some level specifically what I am looking for (see the typing rules for "tcast"). – Nathan BeDell Apr 12 '16 at 22:38


text:
# Properties

 Label 2450.2.a.bg Level $2450$ Weight $2$ Character orbit 2450.a Self dual yes Analytic conductor $19.563$ Analytic rank $0$ Dimension $1$ CM no Inner twists $1$

# Related objects

## Newspace parameters

 Level: $$N$$ $$=$$ $$2450 = 2 \cdot 5^{2} \cdot 7^{2}$$ Weight: $$k$$ $$=$$ $$2$$ Character orbit: $$[\chi]$$ $$=$$ 2450.a (trivial)

## Newform invariants

 Self dual: yes Analytic conductor: $$19.5633484952$$ Analytic rank: $$0$$ Dimension: $$1$$ Coefficient field: $$\mathbb{Q}$$ Coefficient ring: $$\mathbb{Z}$$ Coefficient ring index: $$1$$ Twist minimal: no (minimal twist has level 350) Fricke sign: $$-1$$ Sato-Tate group: $\mathrm{SU}(2)$

## $q$-expansion

 $$f(q)$$ $$=$$ $$q + q^{2} + 3q^{3} + q^{4} + 3q^{6} + q^{8} + 6q^{9} + O(q^{10})$$ $$q + q^{2} + 3q^{3} + q^{4} + 3q^{6} + q^{8} + 6q^{9} - 5q^{11} + 3q^{12} + 6q^{13} + q^{16} + q^{17} + 6q^{18} + 3q^{19} - 5q^{22} + 3q^{24} + 6q^{26} + 9q^{27} - 6q^{29} + 4q^{31} + q^{32} - 15q^{33} + q^{34} + 6q^{36} + 8q^{37} + 3q^{38} + 18q^{39} - 11q^{41} - 8q^{43} - 5q^{44} - 2q^{47} + 3q^{48} + 3q^{51} + 6q^{52} + 4q^{53} + 9q^{54} + 9q^{57} - 6q^{58} - 4q^{59} + 2q^{61} + 4q^{62} + q^{64} - 15q^{66} + 9q^{67} + q^{68} - 10q^{71} + 6q^{72} + 7q^{73} + 8q^{74} + 3q^{76} + 18q^{78} - 2q^{79} + 9q^{81} - 11q^{82} - 11q^{83} - 8q^{86} - 18q^{87} - 5q^{88} + 11q^{89} + 12q^{93} - 2q^{94} + 3q^{96} + 10q^{97} - 30q^{99} + O(q^{100})$$

## Embeddings

For each embedding $$\iota_m$$ of the coefficient field, the values $$\iota_m(a_n)$$ are shown below.

For more information on an embedded modular form you can click on its label.

Label $$\iota_m(\nu)$$ $$a_{2}$$ $$a_{3}$$ $$a_{4}$$ $$a_{5}$$ $$a_{6}$$ $$a_{7}$$ $$a_{8}$$ $$a_{9}$$ $$a_{10}$$
1.1
 0
1.00000 3.00000 1.00000 0 3.00000 0 1.00000 6.00000 0
 $$n$$: e.g. 2-40 or 990-1000 Significant digits: Format: Complex embeddings Normalized embeddings Satake parameters Satake angles

## Atkin-Lehner signs

$$p$$ Sign
$$2$$ $$-1$$
$$5$$ $$-1$$
$$7$$ $$-1$$

## Inner twists

This newform does not admit any (nontrivial) inner twists.

## Twists

By twisting character orbit
Char Parity Ord Mult Type Twist Min Dim
1.a even 1 1 trivial 2450.2.a.bg 1
5.b even 2 1 2450.2.a.a 1
5.c odd 4 2 2450.2.c.r 2
7.b odd 2 1 350.2.a.d yes 1
21.c even 2 1 3150.2.a.j 1
28.d even 2 1 2800.2.a.bg 1
35.c odd 2 1 350.2.a.c 1
35.f even 4 2 350.2.c.a 2
105.g even 2 1 3150.2.a.bq 1
105.k odd 4 2 3150.2.g.v 2
140.c even 2 1 2800.2.a.b 1
140.j odd 4 2 2800.2.g.a 2

By twisted newform orbit
Twist Min Dim Char Parity Ord Mult Type
350.2.a.c 1 35.c odd 2 1
350.2.a.d yes 1 7.b odd 2 1
350.2.c.a 2 35.f even 4 2
2450.2.a.a 1 5.b even 2 1
2450.2.a.bg 1 1.a even 1 1 trivial
2450.2.c.r 2 5.c odd 4 2
2800.2.a.b 1 140.c even 2 1
2800.2.a.bg 1 28.d even 2 1
2800.2.g.a 2 140.j odd 4 2
3150.2.a.j 1 21.c even 2 1
3150.2.a.bq 1 105.g even 2 1
3150.2.g.v 2 105.k odd 4 2

## Hecke kernels

This newform subspace can be constructed as the intersection of the kernels of the following linear operators acting on $$S_{2}^{\mathrm{new}}(\Gamma_0(2450))$$:

 $$T_{3} - 3$$ $$T_{11} + 5$$ $$T_{13} - 6$$ $$T_{17} - 1$$ $$T_{19} - 3$$ $$T_{23}$$ $$T_{37} - 8$$

## Hecke characteristic polynomials

$p$ $F_p(T)$
$2$ $$-1 + T$$
$3$ $$-3 + T$$
$5$ $$T$$
$7$ $$T$$
$11$ $$5 + T$$
$13$ $$-6 + T$$
$17$ $$-1 + T$$
$19$ $$-3 + T$$
$23$ $$T$$
$29$ $$6 + T$$
$31$ $$-4 + T$$
$37$ $$-8 + T$$
$41$ $$11 + T$$
$43$ $$8 + T$$
$47$ $$2 + T$$
$53$ $$-4 + T$$
$59$ $$4 + T$$
$61$ $$-2 + T$$
$67$ $$-9 + T$$
$71$ $$10 + T$$
$73$ $$-7 + T$$
$79$ $$2 + T$$
$83$ $$11 + T$$
$89$ $$-11 + T$$
$97$ $$-10 + T$$


text:
# Is there a name for this Assignment definition

The standard Assignment Problem asks for an optimal one-to-one assignment between agents and tasks.

Now consider the following generalization: Instead of specifying a cost of a single agent-task pair, assume that you can specify a cost of an arbitrary set of agent-task pairs. The problem is then defined by a set of constraints, where each constraint is a cost c and a set S of task-agent pairs. Meaning of a such constraint is that a cost c occurs when all pairs in S are "satisfied", and the overall cost is the sum of costs of all satisfied constraints.

Note that this problem can be encoded as Weighted Partial MAX-SAT, where hard clauses encode one-to-one assignment between agents and tasks, and each constraint is a (weighted) soft clause.

However, I am interested if this can be reduced to something simpler or if this is a known problem, but so far wasn't able to find an answer.


text:
Natural numbers

Jump to: navigation, search

The natural numbers are the numbers 0, 1, 2, etc. The term is generally used to indicate a specific technique of representing natural numbers as either zero or the successor of some other natural number - 0, s(0), s(s(0)), etc - as in Peano arithmetic, a technique also sometimes referred to as unary numbers.

 Natural numbers in Twelf

Natural numbers in Twelf are usually defined in a similar way. Mathematically, natural numbers can be defined as zero or the successor of some other natural number:

$\texttt{}n ::= 0 \,|\, \texttt{s}(n)$

This representation translates easily into Twelf:

nat: type.
z: nat.
s: nat -> nat.

The first line declares that nat is a type. The second line declares z (zero) to be an object of type nat, and the third line declars s (successor) to be a type constructor that takes an object N of type nat and produces another object (s N) of type nat.

 Addition of natural numbers in Twelf

The addition of these natural numbers is defined by the judgment $\texttt{plus}(N_1,N_2,N_3)$, where N1, N2, and N3 are natural numbers. In the definition below, capital letters stand for metavariables that can range over all natural numbers.

${\qquad \over \texttt{plus}(0,N,N)}{\mbox{p-z}}$                     ${\texttt{plus}(N_1,N_2,N_3) \over \texttt{plus}(\texttt{s}(N_1),N_2,\texttt{s}(N_3))}{\mbox{p-s}}$

These judgments also translate cleanly into Twelf:

plus: nat -> nat -> nat -> type.
p-z: plus z N N.
p-s: plus (s N1) N2 (s N3)
<- plus N1 N2 N3.

The first line defines the judgment, declaring plus to be a type family indexed by three terms of type nat.

The second line declares that for any natural number N, p-z is an object of type plus z N N, which corresponds to the axiom p-z above. The N is an implicit parameter - it is treated as a bound variable by Twelf, which you can see by looking at Twelf's output after checking the above code.

The third line says that p-s is a type constructor that, given an object D of type plus N1 N2 N3 (where N1, N2, and N3 are all implicit parameters that can be treated as metavariables), produces an object, p-s D, with type plus (s N1) N2 (s N3). This corresponds to the rule p-s, which given a derivation of $\texttt{plus}(N_1,N_2,N_3)$ allows us to conclude $\texttt{plus}(\texttt{s}(N_1),N_2,\texttt{s}(N_3))$.

Consider this derivation which encodes the fact that 2 + 1 = 3:

${{{\;} \over { \texttt{plus}(0,\;\;\texttt{s}(0),\;\;\texttt{s}(0))}}{\mbox{p-z}} \over {{ \texttt{plus}(\texttt{s}(0),\;\;\texttt{s}(0),\;\;\texttt{s}(\texttt{s}(0)))} \over { \texttt{plus}(\texttt{s}(\texttt{s}(0)),\;\;\texttt{s}(0),\;\;\texttt{s}(\texttt{s}(\texttt{s}(0))))}}{\mbox{p-s}}}{\mbox{p-s}}$

This can be represented in Twelf by applying the type constructor p-s to the object p-z twice:

2+1=3 : plus (s (s z)) (s z) (s (s (s z))) = p-s (p-s p-z).
Twelf 1.7.1 (built 03/19/11 at 09:41:05 on gs6177)
2+1=3 : plus (s (s z)) (s z) (s (s (s z))) = p-s (p-s p-z).

%% OK %%


text:
# dense in Topology [duplicate]

Let $M$ be any subset of a Topological space $X$. We say $M$ is dense in $X$ if $\overline{M}=X$. Now I have to prove the question:

$M$ dense in $X$ $\Leftrightarrow$ for any subset $V \subseteq X : V \cap M \neq \emptyset$ where $V$ is open and not empty.

I tried to prove that by contradiction but didnt get far i hope you can help me out here.

## marked as duplicate by Eric Stucky, Misha Lavrov, Leucippus, Brevan Ellefsen, user91500May 2 '17 at 8:56

• My only definition is; $M$ dense in $X \Leftrightarrow \bar{M} = X$ . And now i have to prove the above question – user439387 May 1 '17 at 17:09
• Definition of $\bar{M}$ then? – Henno Brandsma May 1 '17 at 17:44
• Since this is an introductory-level Q, you should state the def'n of the closure of M that you are starting from, as there are a few (equivalent ) ways to define it. – DanielWainfleet May 2 '17 at 4:31

So we need to show:

$$\overline{M} = X \leftrightarrow \forall V \subseteq X \text{ open and non-empty } : V \cap M \neq \emptyset$$

Now it will depend on how you define $\overline{M}$. If you define it as the smallest closed subset that contains $M$ (one of the usual definitions) I'd go as follows:

Left to right: assume $\overline{M} =X$ and let $V$ be any non-empty open subset of $X$. Then $M \nsubseteq X \setminus V$, or otherwise the latter set would be a smaller closed subset than $X$ that contained $M$. So there is always a point of $M$ that is not in $X \setminus V$, or put equivalently: $M$ always intersects $V$, as required.

Right to left: suppose the right hand condition holds. Then let $C$ be a closed subset of $X$ with $M \subseteq C$. We want to show that $C =X$ (so $X$ is then the only (hence smallest) closed superset of $M$). If $C \neq X$, $V = X\setminus C$ is non-empty and open, but $V \cap M = \emptyset$, this contradicts the right hand condition. So $C = X$.

Another common definition is that $\overline{A}$ is the set of all adherence points of $A$, i.e. all $x \in X$ such that for any open set $O$ that contains $x$, $O \cap A \neq \emptyset$.

In that case the equivalence is more immediate:

Left to right. If $V \neq \emptyset$ is open then for $p \in V$ we have that $p$ is an adherence point of $M$, as $\overline{M} = X$, and so $V$ must intersect $M$.

Right to left: suppose $p \in X$. Then let $O$ be any open set that contains $p$. Then the right hand condition implies that $O \cap M \neq \emptyset$. So $p$ is an adherence point of $M$ and as $p \in X$ was arbitrary, $\overline{M} =X$

There is a lemma: $x\in\overline{A}$ if and only if for any open set $V$ s.t. $x\in V$, we have $V\cap A\ne\varnothing.$ This is rather easy to prove and it is useful here.


text:
# InverseWaveletTransform of a list of rules

I want to extract coefficient images from a DiscreteWaveletTransform and replace them by modified images of the same dimensions.

However, when I use DiscreteWaveletData without specifying the input image dimensions the dimension of the InverseWaveletTransform result is halved, and when I explicitly specify the type of wavelet (HaarWavelet) and transform (DiscreteWaveletTransform) used in the original forward transform the result of InverseWaveletTransform has the right dimensions, but looks quite different from the original input image.

What am I doing wrong?

im = Import["ExampleData\lena.tif"];
dwd = DiscreteWaveletTransform[im, Automatic, 1];
inrules = dwd[All, {"Image"}];

{rec1, rec2, rec3} =
InverseWaveletTransform[#] & /@ {dwd, DiscreteWaveletData[inrules],
DiscreteWaveletData[inrules, HaarWavelet[], "DiscreteWaveletTransform"]}

ImageDimensions[#] & /@ {rec1, rec2, rec3}
{{150, 116}, {75, 58}, {150, 116}}

• I am searching for a solution to this problem, but can't you just use WaveletMapIndexed and try to work from there ? – Sektor Jun 21 '15 at 15:15

I believe the last problem is caused by the standard behavior of the "Image" option. By default, it seems that the resulting output images are color adjusted (for optimal visibility?).

inrules = dwd[All, {"Image"}]

Use "ImageFunction" -> Identity to prevent this:

inrules = dwd[All, {"Image", "ImageFunction" -> Identity}]

with an inverse transform of:

InverseWaveletTransform[
DiscreteWaveletData[inrules, HaarWavelet[],"DiscreteWaveletTransform"]
]

(see "Scope/Get coefficients" section of the DiscreteWaveletData documentation page)

As to your first problem, I can only guess. The specification DiscreteWaveletData[inrules] you used (with only the rules in place) is not listed as a possible syntax in the syntax box of the DiscreteWaveletData doc page, so one could say you're lucky you get any output at all. To construct a fully inverse-transformable object you're apparently supposed to use:

DiscreteWaveletData[Normal[dwd], dwd["Wavelet"], dwd["Transform"], dwd["DataDimensions"]]

(see "Properties & Relations" section of the DiscreteWaveletData documentation page).

• @lex BTW, welcome to Mathematica.StackExchange! – Sjoerd C. de Vries Jun 22 '15 at 5:42
• Thanks Sjoerd, you're right on both accounts! – Lex Toet Jun 22 '15 at 12:45

I might be wrong but I think there is nothing wrong with the current behavior. I think if you want to keep the size of the images you should keep the data. In order to do that you should use 'StationaryWaveletTransform' rather than 'DiscreteWaveletTransform'. So, below the code works...

im = Import["ExampleData\\lena.tif"];
swt = StationaryWaveletTransform[im, Automatic, 1]
inrules = swt [All, {"Image"}]

{rec1, rec2, rec3} =
InverseWaveletTransform[#] & /@ {swt, DiscreteWaveletData[inrules],
DiscreteWaveletData[inrules, HaarWavelet[],
"StationaryWaveletTransform"]}
ImageDimensions[#] & /@ {rec1, rec2, rec3}

{{150, 116}, {150, 116}, {150, 116}}


text:
## Introduction

This post will illustrate how to:

1. Use the generate and replace commands to create dummy variables.
2. A second use of the generate command to dummy variables that is simpler that #1.
3. Using tabluate to create dummy variables.

Dummy coding is used when you have nominal categories, meaning the groups are assigned a value for coding purposes, but the values don’t represent more or less of anything. For example, I might code three different categories of race and coded them as follows: Caucasian = 1, African American = 2, Hispanic = 3. The numbers are for coding purposes only, 3 is not actually any bigger or more than 1. But if we use these in a regression (or any other) analysis, the numbers will be treated as continuous – not categorical. So we need to create dummy variables. Generally, we create k-1 new groups, where k is the total number of groups, and one group is used as the reference sample, or the group we want to compare other groups to.

Method 1: Using generate and replace

We’ll use the built in system data systolic.

The drug variable has 4 levels.

Consequently, we’ll need to make 3 dummy coded indicator variables to represent drug. We’ll use level 4 as the reference category. We’ll use a series of generate and replace commands to create the variables. This is definitely the brute-force way to make the variables, but it makes the logic behind creating dummy variables clear.

generate drug1=1 if drug==1
replace drug1=0 if drug!=1
generate drug2=1 if drug==2
replace drug2=0 if drug!=2
generate drug3=1 if drug==3
replace drug3=0 if drug!=3

Tabulating each of the dummy variables — drug1 – drug3 — we see they match our original tabulation.

Method 2: Use generate only

We can also use a feature of the generate command to create a new variable that takes on the values 1 and 0. So, for example, if we want to create drug1, where drug1 is equal to 1 when the drug condition equals 1, we say:

generate drug1=drug==1

This creates a variable that is 1 when drug equals 1 (recall that == is a logical evaluator) and 0 any other time. If we want to use the fourth condition as the reference category, we repeat the generate command for drug2 and drug3.

generate drug2=drug==2
generate drug3=drug==3

Method 3: Use the generate option of tabulate

The function tabulate has an option called generate. The generate option takes one argument called stubname, where stubname is the stub of the new variable names created by the option. In our examples so far, the stub has been drug. Unlike the examples we have done so far, this method will create as many dummy variables as there are levels of the categorical variable (4 in our case). In our example, we type:

tabulate drug, generate(drug)

We now have four new variables in our dataset — drug1-drug4.


text:
## anonymous 4 years ago 2x-11 square root x +12=0 solve. please and Thank you

1. Compassionate

$2x-11\sqrt{x + 12} = 0$

2. Compassionate

^ Is that correct?

3. anonymous

no it's $2x-11+\sqrt{x}+12=0$

4. anonymous

See, you can subtract 11 from 12: you will get: $2x + \sqrt{x} + 1 = 0 \implies (2x + 1) = -\sqrt{x}$ Now squaring both the sides you will get: $(2x + 1)^2 = (-\sqrt{x})^2 \implies 4x^2 + 1 + 4x = x$ $4x^2 + 3x + 1 = 0$ Use quadratic Formula to find the values of x..

5. anonymous

Thank you


text:
# CString Replace

Hi guys,

I have a CString, which contains the following:

"C:\folder\folder\/folder/file.doc"

As you noticed, there is a: "\/" in the folder path, I need to do a find and replace for "/" and replace with "\"

Could somebody help me out please?

Cheers!
LVL 4
###### Who is Participating?

Commented:
CString foo = "C:\\folder\\folder\\/folder/file.doc";

foo.Replace('/', '\\');      // convert / to \
foo.Replace("\\\\", "\\");// convert any \\ to \
0

Author Commented:
Cheers!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.


text:
# 12.1: Introduction to Probability

The probability of a specified event is the chance or likelihood that it will occur. There are several ways of viewing probability. One would be experimental in nature, where we repeatedly conduct an experiment. Suppose we flipped a coin over and over and over again and it came up heads about half of the time; we would expect that in the future whenever we flipped the coin it would turn up heads about half of the time. When a weather reporter says “there is a 10% chance of rain tomorrow,” she is basing that on prior evidence; that out of all days with similar weather patterns, it has rained on 1 out of 10 of those days.

Another view would be subjective in nature, in other words an educated guess. If someone asked you the probability that the Seattle Mariners would win their next baseball game, it would be impossible to conduct an experiment where the same two teams played each other repeatedly, each time with the same starting lineup and starting pitchers, each starting at the same time of day on the same field under the precisely the same conditions. Since there are so many variables to take into account, someone familiar with baseball and with the two teams involved might make an educated guess that there is a 75% chance they will win the game; that is, if the same two teams were to play each other repeatedly under identical conditions, the Mariners would win about three out of every four games. But this is just a guess, with no way to verify its accuracy, and depending upon how educated the educated guesser is, a subjective probability may not be worth very much.

We will return to the experimental and subjective probabilities from time to time, but in this course we will mostly be concerned with theoretical probability, which is defined as follows: Suppose there is a situation with $$n$$ equally likely possible outcomes and that m of those $$n$$ outcomes correspond to a particular event; then the probability of that event is defined as $$\frac{m}{n}$$.

12.1: Introduction to Probability is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by David Lippman via source content that was edited to conform to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.