text:
# CHNGFUNC - Editorial

#1

### CONTEST PANEL

Author: Prateek Gupta
Tester: Praveen Dhinwa
Editorialist: Prateek Gupta

Easy-Medium

### PRE-REQUISITES

Math, Number Theory

### PROBLEM

Find the number of integral pairs (x,\ y) such that (x^{2}\ +\ y) is a perfect square where x varies from [1,\ A] and y varies from [1,\ B].

### EXPLANATION

Let us iterate over both the approaches for smaller and bigger constraints.

### Approach for A, B ≤ 10^3

Here, we can easily do a brute force to check for each pair (x, y) such that x\ ≤\ A and y\ ≤\ B and see if that pair fits into the equation. Let us see the pseudo code for this brute approach.

ans = 0

for x = 1 to A
for y = 1 to B
if ( perfect_square(x*x + y) ) ans = ans + 1

print(ans)

Overall complexity for this solution will be O(A*B) which is at-most 10^{6} operations in worst case scenario. But, this solution is too slow for the bigger constraints where we will need to think little differently.

### Approach for A, B ≤ 10^6

Let F(x, y) = k where k is any integer.

\implies x^{2} + y = k

Now, according to the question, k should be a perfect square.

\implies k = p^{2}
\implies x^{2} + y = p^{2}

Converting the above equation into more simpler form, it can be re-written as

y = p^{2} - x^{2}
OR
y = (p + x)(p - x)

Hence, $y$ can be written as a product of two integers i.e $(p + x)$ and $(p - x)$. It is now easier to formulate the solution based on this.

Since, y \in [1, B], for each such y, we can find it’s divisors {m_{i}, y/m_{i}} and try to match it with (p + x) and (p - x). More formally,

p + x = m_{i}
p - x = y/m_{i}

The above two equations can be solved to get the value of p and x. Both p and x obtained should be integral values and x should \in range [1, A]. Since, you will need to iterate over all divisors of each y from 1 to B, O(B*sqrt(B)) will turn out to be a little slow in the given time limit. The best way out here is to precompute the divisors using Sieve of Eratosthenes.

Let us now have a look at the pseudo code.

precompute(B)
{
for i = 1 to B
j = i
while j <= B
divisors[j].push_back(i)
j = j + i

}

However, this is still a little slow to get fit within the time limit. The above algorithm takes O(B*log(logB)) time for pre-computation.The sieve implementation to store the divisors for each number can be optimized further to achieve best possible results. We do not really need to iterate uptill B to precompute the divisors upto B. Infact, iterating till sqrt(B) is sufficient. Why?
You might think that we can miss divisors > sqrt(B) for some numbers. But, you will never miss those since you will always have a divisor sqrt(B) from which you can always find it’s counterpart by dividing the divisor from the number itself.

Now, let us have a look at the pseudo code to make things clear.

precompute(B)
{
for i = 1 to sqrt(B)
j = i
while j <= B
divisors[j].push_back(i)
if ( j/i != i && j/i > sqrtB ) divisors[j].push_back(j/i)
j = j + i

}

This allows us to achieve the complexity of O(sqrtB*log(logB)). Now, you can put the value of m_{i}, once as divisor[y]* and y/divisor[y]* next, in the above equation to find if there exist possible valid values of p and x. You go on doing this for each divisor[y]* and for each y from 1 to B.

For more and precise details on the implementation, please refer to the setter’s or tester’s solution

### SOLUTIONS

Author’s solution can be found here.
Tester’s solution can be found here.

#2

Nice question. Took a while to figure it out. But then it became one of the best submissions. I did it as follows with much less code but very efficient.

#include <stdio.h>
#define gc getchar_unlocked

int rin() { char c = gc(); while(c<'0' || c>'9') c = gc(); int ret = 0; while(c>='0' && c<='9') { ret = 10 * ret + c - 48; c = gc(); } return ret; }
int main() {
int A = rin(), B = rin(),x,y, ans = 0,i, a, flag = 0;

for(a = 1;;a++){
flag = 0;
for(x =1;x<=A;x++){
y = 2*a*x + a*a;
if(y<=B) ans++, flag = 1;
else {
break;
}
}
if(!flag) break;
}
printf("%d

", ans);

return 0;
}

#3

Actually there is also a O(A) solution: for each a between 1 and A, you find how many integers say c_a between $\sqrt{a^2+1} and \sqrt{a^2+B}. The answer is \sum_{a=1}^{A}c_a$.

#4

@phben exactly!!

The editorial’s solution seems a bit complicated. There is a beautiful O(A) solution possible if we use concepts of A.P. and quadritic equation!!

My code for reference-

https://www.codechef.com/viewsolution/14650629

Image of derivation-

#5

When you notice you got WA just because of int instead of long long ;_;

#6

Can anybody please explain that how the time complexity of last algorithm given in the editorial is $\sqrt{B}$lg(lg(B))?

I came up with the following analysis for time complexity:
$\sum_{i=1}^{\sqrt{B}}\frac{B}{i} = B$log(\sqrt{B})

#7

Many of the solutions whose time complexity is O(a*b) have been accepted.They have been given partial points.
All the solutions to this questions should be rejudged.

#8

Can anybody point out what is wrong with my approach??

Since we have to make x^2+y as a perfect square, so, we can write y=(n^2-1)x^2 where n>=2. We try to find out that for a particular value of x^2, how many n^2-1 terms are possible or can say how many n are possible. Since maximum value of y is B, so, n=\sqrt{B/{x^2}+1}-1. (B/x^2 is real number division not integer division) Here n has -1 term because n starts from 2 not from 1.So, for each value of x^2 we try to find no. of values of y.
Here is my code.

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>

#define pb push_back
using namespace std;

int main() {
ios_base::sync_with_stdio(0);
long long a,b,i,ans=0;
cin>>a>>b;
for(i=1;i<=a;i++)
ans+=(long long)sqrt(((double)b/(i*i))+1)-1;
cout<<ans<<"

";
return 0;
}

#9

Here is my solution (and its quite simple to understand ) -

As x^2 + y = p^ 2 thus y = p^2 - x^2 ,for x to be in [1,A] and y in [1,B]. (where p^2 is a perfect square)

As y can’t be zero or negative then, p should be greater than x+1. Thus p can take up any integer from x+1 to infinity such that p^2 - x^2 <= B.

Thus we need to find for each x in [1,A] the number of integral points of p which are greater than or equal to x+1 and satisfies the equation p^2 - x^2 <= B.

Here is my code - https://www.codechef.com/viewsolution/14658471

If you like my solution , feel free to give a thumbs up, I need some Karmas .

#10

@chan55555 Here is how i would like to explain the bug in your solution.

As you have assumed y=(n^2 - 1)x^2 … this implies y = (n * x)^2 - (x)^2

i.e x^2 + y = (n * x)^2

Thus according to you the perfect squares can be only those squares whose square roots are multiples of x while there was no such restriction in the problem statement itself. This assumption will leave a lot possible perfect squares whose square roots are not multiples of x. An example would explain this more clearly . if A=4 and B=6 then there would be a case of (x,y) as (2,5) i.e 2^2 + 5 = 9 ., as you can see that the 9 isn’t a multiple of 2 , thus your program wont take 9 into consideration and hence would leave out a possible (x,y) pair , thus the ans produced by your code will be less than (or in some special cases equal to ) the correct answer . The correct answer for A=10000 B=100000 is 291528 but ur code produces 1591 … thus leaving out a lot of possible cases.

I Hope this makes it clear . You can refer to my solution in the comments above.

If you like my comment , feel free to give a thumbs up , I need some Karmas .

#11

It can also be done by precomputing all perfect squares and then doing upper bound for each element .

Here is link to the solution : https://www.codechef.com/viewsolution/14654083

#12

i used binary search for this!
x^2 + y = a^2
=> y = a^2 - x^2;

now , i used binary search to find the upper bound of a (satisfying the constraint on y) and do the same for all x .

my solution got accepted but if anyone thinks any bug in approach then please let me know

#13

Wait Wait! The approach actually worked? In my case it didn’t seem to do so. (Yes, I use Java)

The optimal solution is O(A * log B)

https://www.codechef.com/viewsolution/14651473

The other O(a*b) feels kinda unfair tho

#14

The editorial solution didnt work fr me… I am gettng TLE…

import java.io.*;
import java.util.*;
class PerfectFunction {
public static int countSquares(int a, int b){
Map<Integer,List<Integer>> divisors = precomputeDivisors(b);
int count = 0;
for(int y = 1; y <= b; y++){
List<Integer> list = divisors.get(y);
for(int i : list){
int m = i;
int n = y/m;
if(m < n)
continue;
float p = (m+n)/2f;
float x = (m-n)/2f;
if(((p - (int)p) == 0) && ((n - (int)n) == 0) &&
(x >=1) && (x <= a)){
count++;
}
}
}
return count;
}
public static Map<Integer,List<Integer>> precomputeDivisors(int b){
Map<Integer,List<Integer>> divisors = new HashMap<>(b+1);
for(int i = 1; i*i <= b; i++ ){
for(int j = i; j <= b; j+=i){
List<Integer> list = divisors.get(j);
if(list == null){
list = new ArrayList<>();
divisors.put(j, list);
}
if(j/i != i && j/i > Math.sqrt(b))
}
}
return divisors;
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
int b = scan.nextInt();
int count=countSquares(a,b);
System.out.println(count);
}
}

#15

i submitted my solution during contest, it throws TLE at that time.
But when i copy pasted my code(exactly same) in practice section it gave me AC.can anyone explain why this happened?
https://www.codechef.com/viewsolution/14675999
https://www.codechef.com/viewsolution/14656596

#16

i submitted my solution during contest, it throws TLE at that time.
But when i copy pasted my code(exactly same) in practice section it gave me AC.can anyone explain why this happened?
https://www.codechef.com/viewsolution/14675999
https://www.codechef.com/viewsolution/14656596

#17

My solution is a bit different.At first, I pre-computed all squares of numbers up to 10000002.Then for each square number let say x less than A*A,I searched how many square numbers are there in the region x+B.Here is my solution link.link text

#18

In #Author’s solution why do we check for (k_plus_x + k_minus_x)%2==0 && (k_plus_x - k_minus_x)%2==0???

#19

### CHNGFUNC In #Author’s solution why do we check for (k_plus_x + k_minus_x)%2==0 && (k_plus_x - k_minus_x)%2==0 ???

#20

i think this one is easy and simple to understand my solution which i tried after contest Time complexity: O(A) https://www.codechef.com/viewsolution/14762782


text:
# Does anyone can help me with signal processing problem?

(c)A linear time-invariant system with impulse response $h(t)=e^{-\alpha t} u(t)$ is driven by the input $x(t)=e^{-\beta t} u(t)$ . It is assumed that $\alpha, \beta > 0$.

• (i) Using frequency domain analysis, find the output of the system. [Hint: $Y(f) = X(f) H(f)$]

I'm finding in trouble trying to resolve this exercise. I have to calculate the convolution of this signal:

well I applied the formula that says that the convolution of this two signal as state by the hint, equal to

$Y(f)=X(f)H(f)$ where $H(f)$ is the fourier transform of the impulse response and $X(f)$ is the fourier transform of input signal.

well fourier transform of $h(t)=e^{−bt}u(t)$ is $H(f)=1/(b+j2πf)$. fourier transform of input signal $x(t)=e^{−at}u(t)$ is $X(f)=1/(a+j2πf)$

Thus,

$Y(f)=X(f)H(f)$

$$Y(f)=\frac{1}{a+j2πf}\cdot \frac{1}{b+j2πf}$$

is this a correct step ?

• This looks like some homework. What techniques did you already try? What is your specific problem? – Maximilian Matthé Feb 14 '17 at 8:34
• For this kind of problem (homework-style), you normally show what you yourself have done, your effort into it, then tell us where you're stuck. Then people here can see how to give you some hints so you can understand the problem and eventually find the solution. – Gilles Feb 14 '17 at 8:34
• Such a dreadful problem to suggest for frequency-domain analysis when time-domain analysis is so much simpler. It is truly said: when all you have is a hammer, everything looks like a nail. – Dilip Sarwate Feb 15 '17 at 22:56

## 1 Answer

It is indeed correct to say that

$$Y(j\omega)=\frac{1}{\alpha+j\omega}\cdot\frac{1}{\beta+j\omega}=\frac{1}{(\alpha+j\omega)(\beta+j\omega)}$$

You could write the answer just in that why. The problem with that is that it would be a bit hard to antitransform and come back to the time-domain to find $y(t)$. So let's manipulate that expression a little bit. Using the partial-fraction expansion we get:

$$Y(j\omega)=\frac{1}{(\alpha+j\omega)(\beta+j\omega)}=\frac{A}{\alpha+j\omega}+\frac{B}{\beta+j\omega}$$

where we want to calculate the constants $A$ and $B$. Rewriting those two fractions as one we get that:

$$\frac{A}{\alpha+j\omega}+\frac{B}{\beta+j\omega}=\frac{A(\beta+j\omega)+B(\alpha+j\omega)}{(\alpha+j\omega)(\beta+j\omega)}=\frac{A\beta+jA\omega+B\alpha+jB\omega}{(\alpha+j\omega)(\beta+j\omega)}$$

So:

$$\frac{1}{(\alpha+j\omega)(\beta+j\omega)}=\frac{A\beta+jA\omega+B\alpha+jB\omega}{(\alpha+j\omega)(\beta+j\omega)}$$

That equality holds only if

$$1=A\beta+jA\omega+B\alpha+jB\omega=(A\beta+B\alpha)+j\omega(A+B)$$

As the left side of the equation is purely real, then the imaginary part of the right side must equal zero and we can calculate our constants as functions of $\alpha$ and $\beta$:

$$A=-B \implies 1 = A\beta - A\alpha \implies A =\frac{1}{\beta-\alpha} \implies B=-\frac{1}{\beta-\alpha}$$

So we can write the transform of the output as proposed in the beginning:

$$Y(j\omega)= \frac{A}{\alpha+j\omega}+\frac{B}{\beta+j\omega}= \frac{\frac{1}{\beta-\alpha}}{\alpha+j\omega}-\frac{\frac{1}{\beta-\alpha}}{\beta+j\omega}$$

Therefore our output is:

$$Y(j\omega) = \frac{1}{\beta-\alpha}\left(\frac{1}{\alpha+j\omega}-\frac{1}{\beta+j\omega}\right)$$

And now you only have to antitransform that (I believe you can do that) and that's your output in the time domain.

format: plain


text:
# Calculate the slip in an induction motor 4 pole 50 Hz rotating at 1400 rpm

This question was previously asked in
ISRO (VSSC) Technician (Electrician) Sept 2016 Official Paper
View all ISRO Technical Assistant Papers >
1. 6.6%
2. 6.0%
3. 5.5%
4. 5.0%

Option 1 : 6.6%

## Detailed Solution

Concept:

Synchronous speed in rpm of a three-phase induction motor is given by,

$${N_s} = \frac{{120f}}{P}$$

Where f is the frequency in Hz

P is the number of poles

A rotor of a three-phase induction motor rotates at a speed close to the synchronous speed but not equal to the synchronous speed.

The difference between the synchronous speed and the rotor speed is known as slip speed. It is given by

Slip speed = Ns - Nr

Slip is defined as the ratio of slip speed to the rotor speed.

Mathematically, Percentage slip, $$\% \;s = \left[ {\frac{{{N_s}\;-\;N}}{{{N_s}}}} \right] \times 100$$

Or fractional slip, $$s = \frac{{{N_s}\;-\;N}}{{{N_s}}}$$

Where s is the slip

f is the supply frequency

Calculation:

We know that $${N_s} = \frac{{120f}}{P} = \frac{{120 \times 50}}{4} = 1500\;rpm$$

Given that $${N_r} = 1400\;rpm$$

Slip (s) $$= \frac{{{N_s} - {N_r}}}{{{N_s}}} \times 100 = \frac{{1500 - 1400}}{{1500}} \times 100 = 6.67\%$$


text:
# Suppose 2 J of work is needed to stretch a spring from its natural length of 30 cm to a length of 42 cm.Then how far beyond its natural length will a force of 30 N keep the spring stretched?

$\begin{array}{1 1}\large\frac{27}{10}\\\large\frac{29}{10}\\27\\\large\frac{17}{10}\end{array}$

Answer : $\large\frac{27}{10}$
From Hooke's law : $F=kx$ where $x$ is the distance the sprin is stretched from its natural length,and k is the (usually unknown) spring constant.
The spring's length is 30cm,so it is stretched 12cm from its natural length,we can use
$W=\int dW$
$\;\;\;\;=\int Fdx$
$2J=\int_0^{.12m} kxdx$
$\quad\;=\large\frac{k}{2}$$x^2\bigg|_0^{.12m} \quad\;=\large\frac{k}{2}$$(0.0144m^2)$
$k =\large\frac{4Nm}{0.0144m^2}$
$\;\;\;=\large\frac{100}{9}$N/m
Once we have $k$,we can calculate the distance,since we know that $F=30N$ :
$F=kx$
$30=\large\frac{100}{9}$$x$
$x=\large\frac{27}{10}$


text:
Thomas Kalinowski
The algorithmic complexity of the minimization of the number of segments in multileaf collimator field segmentation
Preprint series: Preprints aus dem Fachbereich Mathematik, Universität Rostock
MSC:
92C50 Medical applications (general)
Abstract: Intensity maps are nonnegative matrices describing the
intensity modulation of beams in radiotherapy. In order to
use a multileaf collimator in the static mode for the
realization of the intensity modulation one has to
determine a segmentation, i.e. a representation of an
intensity map as a positive combination of special matrices
corresponding to fixed positions of the multileaf collimator,
called segments. We consider the problem to construct
segmentations with the minimal total number of monitor units
and the minimal number of segments. Neglecting machine--
dependent constraints like the interleaf collision constraint
and assuming that the entries of the intensity map are
bounded by a constant, we prove that a segmentation with
minimal number of segments under the condition that the
number of monitor units is minimal, can be determined in
time polynomial in the matrix dimensions. The results of
our algorithm are compared with Engel's \cite{Eng02}
heuristic for the reduction of the number of segments.
Keywords: leaf sequencing, radiation therapy optimization, intensity modulation, multileaf collimator, IMRT


text:
• ### Coding sets with asymmetric information(1707.04875)

July 27, 2018 cs.IT, math.IT, cs.NI, cs.DS
We study the following one-way asymmetric transmission problem, also a variant of model-based compressed sensing: a resource-limited encoder has to report a small set $S$ from a universe of $N$ items to a more powerful decoder (server). The distinguishing feature is asymmetric information: the subset $S$ is comprised of i.i.d. samples from a prior distribution $\mu$, and $\mu$ is only known to the decoder. The goal for the encoder is to encode $S$ obliviously, while achieving the information-theoretic bound of $|S| \cdot H(\mu)$, i.e., the Shannon entropy bound. We first show that any such compression scheme must be {\em randomized}, if it gains non-trivially from the prior $\mu$. This stands in contrast to the symmetric case (when both the encoder and decoder know $\mu$), where the Huffman code provides a near-optimal deterministic solution. On the other hand, a rather simple argument shows that, when $|S|=k$, a random linear code achieves near-optimal communication rate of about $k\cdot H(\mu)$ bits. Alas, the resulting scheme has prohibitive decoding time: about ${N\choose k} \approx (N/k)^k$. Our main result is a computationally efficient and linear coding scheme, which achieves an $O(\lg\lg N)$-competitive communication ratio compared to the optimal benchmark, and runs in $\text{poly}(N,k)$ time. Our "multi-level" coding scheme uses a combination of hashing and syndrome-decoding of Reed-Solomon codes, and relies on viewing the (unknown) prior $\mu$ as a rather small convex combination of uniform ("flat") distributions.
• ### Hybrid Scheduling in Heterogeneous Half- and Full-Duplex Wireless Networks(1801.01108)

Jan. 3, 2018 cs.NI
Full-duplex (FD) wireless is an attractive communication paradigm with high potential for improving network capacity and reducing delay in wireless networks. Despite significant progress on the physical layer development, the challenges associated with developing medium access control (MAC) protocols for heterogeneous networks composed of both legacy half-duplex (HD) and emerging FD devices have not been fully addressed. Therefore, we focus on the design and performance evaluation of scheduling algorithms for infrastructure-based heterogeneous networks (composed of HD and FD users). We develop the hybrid Greedy Maximal Scheduling (H-GMS) algorithm, which is tailored to the special characteristics of such heterogeneous networks and combines both centralized GMS and decentralized Q-CSMA mechanisms. Moreover, we prove that H-GMS is throughput-optimal. We then demonstrate by simple examples the benefits of adding FD nodes to a network. Finally, we evaluate the performance of H-GMS and its variants in terms of throughput, delay, and fairness between FD and HD users via extensive simulations. We show that in heterogeneous HD-FD networks, H-GMS achieves 5-10x better delay performance and improves fairness between HD and FD users by up to 50% compared with the fully decentralized Q-CSMA algorithm.
• ### An Improved Bound for Minimizing the Total Weighted Completion Time of Coflows in Datacenters(1704.08357)

April 26, 2017 cs.DM, cs.DS
In data-parallel computing frameworks, intermediate parallel data is often produced at various stages which needs to be transferred among servers in the datacenter network (e.g. the shuffle phase in MapReduce). A stage often cannot start or be completed unless all the required data pieces from the preceding stage are received. \emph{Coflow} is a recently proposed networking abstraction to capture such communication patterns. We consider the problem of efficiently scheduling coflows with release dates in a shared datacenter network so as to minimize the total weighted completion time of coflows. Several heuristics have been proposed recently to address this problem, as well as a few polynomial-time approximation algorithms with provable performance guarantees. Our main result in this paper is a polynomial-time deterministic algorithm that improves the prior known results. Specifically, we propose a deterministic algorithm with approximation ratio of $5$, which improves the prior best known ratio of $12$. For the special case when all coflows are released at time zero, our deterministic algorithm obtains approximation ratio of $4$ which improves the prior best known ratio of $8$. The key ingredient of our approach is an improved linear program formulation for sorting the coflows followed by a simple list scheduling policy. Extensive simulation results, using both synthetic and real traffic traces, are presented that verify the performance of our algorithm and show improvement over the prior approaches.
• ### Maximizing Broadcast Throughput Under Ultra-Low-Power Constraints(1610.04203)

April 26, 2017 cs.NI
Wireless object tracking applications are gaining popularity and will soon utilize emerging ultra-low-power device-to-device communication. However, severe energy constraints require much more careful accounting of energy usage than what prior art provides. In particular, the available energy, the differing power consumption levels for listening, receiving, and transmitting, as well as the limited control bandwidth must all be considered. Therefore, we formulate the problem of maximizing the throughput among a set of heterogeneous broadcasting nodes with differing power consumption levels, each subject to a strict ultra-low-power budget. We obtain the oracle throughput (i.e., maximum throughput achieved by an oracle) and use Lagrangian methods to design EconCast - a simple asynchronous distributed protocol in which nodes transition between sleep, listen, and transmit states, and dynamically change the transition rates. EconCast can operate in groupput or anyput modes to respectively maximize two alternative throughput measures. We show that EconCast approaches the oracle throughput. The performance is also evaluated numerically and via extensive simulations and it is shown that EconCast outperforms prior art by 6x - 17x under realistic assumptions. Moreover, we evaluate EconCast's latency performance and consider design tradeoffs when operating in groupput and anyput modes. Finally, we implement EconCast using the TI eZ430-RF2500-SEH energy harvesting nodes and experimentally show that in realistic environments it obtains 57% - 77% of the achievable throughput.
• ### Adaptive TTL-Based Caching for Content Delivery(1704.04448)

April 14, 2017 cs.NI
Content Delivery Networks (CDNs) deliver a majority of the user-requested content on the Internet, including web pages, videos, and software downloads. A CDN server caches and serves the content requested by users. Designing caching algorithms that automatically adapt to the heterogeneity, burstiness, and non-stationary nature of real-world content requests is a major challenge and is the focus of our work. While there is much work on caching algorithms for stationary request traffic, the work on non-stationary request traffic is very limited. Consequently, most prior models are inaccurate for production CDN traffic that is non-stationary. We propose two TTL-based caching algorithms and provide provable guarantees for content request traffic that is bursty and non-stationary. The first algorithm called d-TTL dynamically adapts a TTL parameter using a stochastic approximation approach. Given a feasible target hit rate, we show that the hit rate of d-TTL converges to its target value for a general class of bursty traffic that allows Markov dependence over time and non-stationary arrivals. The second algorithm called f-TTL uses two caches, each with its own TTL. The first-level cache adaptively filters out non-stationary traffic, while the second-level cache stores frequently-accessed stationary traffic. Given feasible targets for both the hit rate and the expected cache size, f-TTL asymptotically achieves both targets. We implement d-TTL and f-TTL and evaluate both algorithms using an extensive nine-day trace consisting of 500 million requests from a production CDN server. We show that both d-TTL and f-TTL converge to their hit rate targets with an error of about 1.3%. But, f-TTL requires a significantly smaller cache size than d-TTL to achieve the same hit rate, since it effectively filters out the non-stationary traffic for rarely-accessed objects.
• ### Scheduling Storms and Streams in the Cloud(1502.05968)

Feb. 20, 2015 cs.DC, cs.NI, math.OC
Motivated by emerging big streaming data processing paradigms (e.g., Twitter Storm, Streaming MapReduce), we investigate the problem of scheduling graphs over a large cluster of servers. Each graph is a job, where nodes represent compute tasks and edges indicate data-flows between these compute tasks. Jobs (graphs) arrive randomly over time, and upon completion, leave the system. When a job arrives, the scheduler needs to partition the graph and distribute it over the servers to satisfy load balancing and cost considerations. Specifically, neighboring compute tasks in the graph that are mapped to different servers incur load on the network; thus a mapping of the jobs among the servers incurs a cost that is proportional to the number of "broken edges". We propose a low complexity randomized scheduling algorithm that, without service preemptions, stabilizes the system with graph arrivals/departures; more importantly, it allows a smooth trade-off between minimizing average partitioning cost and average queue lengths. Interestingly, to avoid service preemptions, our approach does not rely on a Gibbs sampler; instead, we show that the corresponding limiting invariant measure has an interpretation stemming from a loss system.
• ### Serving Content with Unknown Demand:the High-Dimensional Regime(1412.6463)

Dec. 19, 2014 cs.NI
In this paper we look at content placement in the high-dimensional regime: there are n servers, and O(n) distinct types of content. Each server can store and serve O(1) types at any given time. Demands for these content types arrive, and have to be served in an online fashion; over time, there are a total of O(n) of these demands. We consider the algorithmic task of content placement: determining which types of content should be on which server at any given time, in the setting where the demand statistics (i.e. the relative popularity of each type of content) are not known a-priori, but have to be inferred from the very demands we are trying to satisfy. This is the high- dimensional regime because this scaling (everything being O(n)) prevents consistent estimation of demand statistics; it models many modern settings where large numbers of users, servers and videos/webpages interact in this way. We characterize the performance of any scheme that separates learning and placement (i.e. which use a portion of the demands to gain some estimate of the demand statistics, and then uses the same for the remaining demands), showing it is order-wise strictly suboptimal. We then study a simple adaptive scheme - which myopically attempts to store the most recently requested content on idle servers - and show it outperforms schemes that separate learning and placement. Our results also generalize to the setting where the demand statistics change with time. Overall, our results demonstrate that separating the estimation of demand, and the subsequent use of the same, is strictly suboptimal.
• ### Queue-Based Random-Access Algorithms: Fluid Limits and Stability Issues(1302.5945)

Feb. 24, 2013 cs.IT, math.IT, math.PR, cs.NI
We use fluid limits to explore the (in)stability properties of wireless networks with queue-based random-access algorithms. Queue-based random-access schemes are simple and inherently distributed in nature, yet provide the capability to match the optimal throughput performance of centralized scheduling mechanisms in a wide range of scenarios. Unfortunately, the type of activation rules for which throughput optimality has been established, may result in excessive queue lengths and delays. The use of more aggressive/persistent access schemes can improve the delay performance, but does not offer any universal maximum-stability guarantees. In order to gain qualitative insight and investigate the (in)stability properties of more aggressive/persistent activation rules, we examine fluid limits where the dynamics are scaled in space and time. In some situations, the fluid limits have smooth deterministic features and maximum stability is maintained, while in other scenarios they exhibit random oscillatory characteristics, giving rise to major technical challenges. In the latter regime, more aggressive access schemes continue to provide maximum stability in some networks, but may cause instability in others. Simulation experiments are conducted to illustrate and validate the analytical results.
• ### Flow-Level Stability of Wireless Networks: Separation of Congestion Control and Packet Scheduling(1209.5464)

Sept. 25, 2012 cs.NI
It is by now well-known that wireless networks with file arrivals and departures are stable if one uses alpha-fair congestion control and back-pressure based scheduling and routing. In this paper, we examine whether ?alpha-fair congestion control is necessary for flow-level stability. We show that stability can be ensured even with very simple congestion control mechanisms, such as a fixed window size scheme which limits the maximum number of packets that are allowed into the ingress queue of a flow. A key ingredient of our result is the use of the difference between the logarithms of queue lengths as the link weights. This result is reminiscent of results in the context of CSMA algorithms, but for entirely different reasons.
• ### Opinion Dynamics in Social Networks: A Local Interaction Game with Stubborn Agents(1208.5076)

Aug. 24, 2012 cs.SI, cs.GT
The process by which new ideas, innovations, and behaviors spread through a large social network can be thought of as a networked interaction game: Each agent obtains information from certain number of agents in his friendship neighborhood, and adapts his idea or behavior to increase his benefit. In this paper, we are interested in how opinions, about a certain topic, form in social networks. We model opinions as continuous scalars ranging from 0 to 1 with 1(0) representing extremely positive(negative) opinion. Each agent has an initial opinion and incurs some cost depending on the opinions of his neighbors, his initial opinion, and his stubbornness about his initial opinion. Agents iteratively update their opinions based on their own initial opinions and observing the opinions of their neighbors. The iterative update of an agent can be viewed as a myopic cost-minimization response (i.e., the so-called best response) to the others' actions. We study whether an equilibrium can emerge as a result of such local interactions and how such equilibrium possibly depends on the network structure, initial opinions of the agents, and the location of stubborn agents and the extent of their stubbornness. We also study the convergence speed to such equilibrium and characterize the convergence time as a function of aforementioned factors. We also discuss the implications of such results in a few well-known graphs such as Erdos-Renyi random graphs and small-world graphs.
• ### On the Design of Efficient CSMA Algorithms for Wireless Networks(1003.1364)

March 6, 2010 math.PR, cs.NI
Recently, it has been shown that CSMA algorithms which use queue length-based link weights can achieve throughput optimality in wireless networks. In particular, a key result by Rajagopalan, Shah, and Shin (2009) shows that, if the link weights are chosen to be of the form log(log(q)) (where q is the queue-length), then throughput optimality is achieved. In this paper, we tighten their result by showing that throughput optimality is preserved even with weight functions of the form log(q)/g(q), where g(q) can be a function that increases arbitrarily slowly. The significance of the result is due to the fact that weight functions of the form log(q)/g(q) seem to achieve the best delay performance in practice.


text:
Need help with suggested-notation-for-machine-learning?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

mazhengcn
197 Stars 35 Forks 101 Commits 1 Opened issues

#### Description

This introduces a suggestion of mathematical notation protocol for machine learning.

!
?

# 198,211
natural...
natural...
python3
TeX
6 commits

# Suggested Notation for Machine Learning

## Introduction

This introduces a suggestion of mathematical notation protocol for machine learning.

The field of machine learning has evolved rapidly in recent years. Communication between different researchers and research groups has become increasingly important. A key challenge for communication arises from inconsistent notation usages among different papers. This proposal suggests a standard for commonly used mathematical notation for machine learning. In this first version, only some notations are mentioned and more notations are left to be done. This proposal will be regularly updated based on the progress of the field. We look forward to more suggestions to improve this proposal in future versions.

## Dataset

Dataset is sampled from a distribution over a domain .

• is the instances domain (a set)
• is the label domain (a set)
• is the example domain (a set)

Usually, is a subset of and is a subset of , where is the input dimension, is the ouput dimension.

is the number of samples. Without specification, and are for the training set.

## Function

A hypothesis space is denoted by . A hypothesis function is denoted by or with .

denotes the set of parameters of .

If there exists a target function, it is denoted by or satisfying for .

## Loss function

A loss function, denoted by , measures the difference between a predicted label and a true label, e.g.,

• loss: , where . can also be written as for convenience.

Empirical risk or training loss for a set is denoted by or or or ,

The population risk or expected loss is denoted by or ,

where follows the distribution .

## Activation function

An activation function is denoted by .

Example 1. Some commonly used activation functions are

## Two-layer neural network

The neuron number of the hidden layer is denoted by , The two-layer neural network is

where is the activation function, is the input weight, is the output weight, is the bias term. We denote the set of parameters by

## General deep neural network

The counting of the layer number excludes the input layer. An -layer neural network is denoted by

where , , , , is a scalar function and "" means entry-wise operation. We denote the set of parameters by

This can also be defined recursively,

## Complexity

The VC-dimension of a hypothesis class is denoted as VCdim().

The Rademacher complexity of a hypothesis space on a sample set is denoted by or . The complexity is random because of the randomness of . The expectation of the empirical Rademacher complexity over all samples of size is denoted by

## Training

Gradient Descent is often denoted by GD. Stochastic Gradient Descent is often denoted by SGD.

A batch set is denoted by and the batch size is denoted by .

The learning rate is denoted by .

## Fourier Frequency

The discretized frequency is denoted by , and the continuous frequency is denoted by .

## Convolution

The convolution operation is denoted by .

## Notation table

| symbol | meaning | Latex | simplied | | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------- | ------------------ | --------------------- | | | input |

\bm{x}
|
\mathbf{x}
| | | output, label |
\bm{y}
|
\vy
| | | input dimension |
d
| | | | output dimension |
d_{\rm o}
| | | | number of samples |
n
| | | instances domain (a set) |
\mathcal{X}
|
\fX
| | | labels domain (a set) |
\mathcal{Y}
|
\fY
| | | example domain |
\mathcal{Z}
|
\fZ
| | | hypothesis space (a set) |
\mathcal{H}
|
\mathcal{H}
| | | a set of parameters |
\bm{\theta}
|
\mathbf{\theta}
| | | hypothesis function |
\f_{\bm{\theta}}
|
f_{\mathbf{\theta}}
| | or | target function |
f, f^*
| | | loss function |
\ell
| | | distribution of |
\mathcal{D}
|
\fD
| | | sample set | | , , , | empirical risk or training loss | | | population risk or expected loss | | | activation function |
\sigma
| | | input weight |
\bm{w}_j
|
\mathbf{w}_j
| | | output weight |
a_j
| | | bias term |
b_j
| | or | neural network |
f_{\bm{\theta}}
|
f_{\mathbf{\theta}}
| | | two-layer neural network | | ) | VC-dimension of | | , | Rademacher complexity of on | | | Rademacher complexity over samples of size | | | gradient descent | | | stochastic gradient descent | | | a batch set |
B
| | | | batch size |
b
| | | | learning rate |
\eta
| | | discretized frequency |
\bm{k}
|
\mathbf{k}
| | | continuous frequency |
\bm{\xi}
|
\mathbf{xi}
| | | | convolution operation |
*
|

## L-layer neural network

| symbol | meaning | Latex | simplied | | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------- | ------------------ | | | input dimension |

d
| | | | output dimension |
d_{\rm o}
| | | | the number of -th layer neuron, , |
m_l
| | | the -th layer weight |
\bm{W}^{[l]}
|
\mathbf{W}^{[l]}
| | | the -th layer bias term |
\bm{b}^{[l]}
|
\mathbf{b}^{[l]}
| | | entry-wise operation |
\circ
| | | activation function |
\sigma
| | | , parameters |
\bm{\theta}
|
\mathbf{\theta}
| | | | | | , -th layer output | | | , -layer NN |

# How to cite

 @misc{beijing2020Suggested,
title = {Suggested Notation for Machine Learning},
author = {Beijing Academy of Artificial Intelligence},
howpublished = {\url{https://github.com/Mayuyu/suggested-notation-for-machine-learning}},
year=2020
}

# Acknowledgements

Chenglong Bao (Tsinghua), Zhengdao Chen (NYU), Bin Dong (Peking), Weinan E (Princeton), Quanquan Gu (UCLA), Kaizhu Huang (XJTLU), Shi Jin (SJTU), Jian Li (Tsinghua), Lei Li (SJTU), Tiejun Li (Peking), Zhenguo Li (Huawei), Zhemin Li (NUDT), Shaobo Lin (XJTU), Ziqi Liu (CSRC), Zichao Long (Peking), Chao Ma (Princeton), Chao Ma (SJTU), Yuheng Ma (WHU), Dengyu Meng (XJTU), Wang Miao (Peking), Pingbing Ming (CAS), Zuoqiang Shi (Tsinghua), Jihong Wang (CSRC), Liwei Wang (Peking), Bican Xia (Peking), Zhouwang Yang (USTC), Haijun Yu (CAS), Yang Yuan (Tsinghua), Cheng Zhang (Peking), Lulu Zhang (SJTU), Jiwei Zhang (WHU), Pingwen Zhang (Peking), Xiaoqun Zhang (SJTU), Chengchao Zhao (CSRC), Zhanxing Zhu (Peking), Chuan Zhou (CAS), Xiang Zhou (cityU).


text:
Existence of Limits of Vector-Valued Functions

# Existence of Limits of Vector-Valued Functions

Let $(S, d_S)$ be any arbitrary metric space and consider the metric space $(\mathbb{R}^n, d)$ where $d$ is the usual Euclidean metric defined for all $\mathbf{x} = (x_1, x_2, ..., x_n), \mathbf{y} = (y_1, y_2, ..., y_n) \in \mathbb{R}^n$ by:

(1)
\begin{align} \quad d(\mathbf{x}, \mathbf{y}) = \| \mathbf{x} - \mathbf{y} \| = \sqrt{(x_1 - y_1)^2 + (x_2 - y_2)^2 + ... + (x_n - y_n)^2} \end{align}

If $A \subseteq S$, $p \in S$ is an accumulation point of $A$, and $\mathbf{f} : A \to \mathbb{R}^n$ then the function $\mathbf{f}(x) = (f_1(x), f_2(x), ..., f_n(x))$ (where $f_j : A \to \mathbb{R}$ for each $j \in \{1, 2, ..., n \}$) is a vector-valued function, and additional theorems can be proved as a result of the basic properties of vectors (similarly to how we proved some additional theorems for complex-valued functions).

We begin by proving that the limit of $\mathbf{f}$ as $x \to p$ exists if and only if the limits of the components $f_j$ for $j \in \{1, 2, ..., n \}$ exist as $x \to p$.

 Theorem 1: Let $(S, d_S)$ and $(\mathbb{R}^n, d)$ be metric spaces where $d$ the usual Euclidean metric on $\mathbb{R}^n$ defined for all $\mathbf{x} = (x_1, x_2, ..., x_n), \mathbf{y} = (y_1, y_2, ..., y_n) \in \mathbb{R}^n$ by $d(\mathbf{x}, \mathbf{y}) = \| \mathbf{x} - \mathbf{y} \|$. Furthermore let $A \subseteq S$, $p \in S$ is an accumulation point of $A$, $\mathbf{f} : A \to \mathbb{R}^n$. Then $\lim_{x \to p} \mathbf{f}(x) = \mathbf{a}$ if and only if $\lim_{x \to p} f_j(x) = a_j$ for all $j \in \{1, 2, ..., n \}$.

Here the function $f_j : A \to \mathbb{R}$ is the $j^{\mathrm{th}}$ component of $\mathbf{f}$, and similarly, $a_j$ is the $j^{\mathrm{th}}$ component of $\mathbf{a}$.

• Proof: $\Rightarrow$ Suppose that $\lim_{x \to p} \mathbf{f}(x) = \mathbf{a}$. Then for all $\epsilon > 0$ there exists a $\delta^* > 0$ such that if $x \in D(\mathbf{f}) \setminus \{ p \} = A \setminus \{ p \}$ and $d_S(x, p) < \delta^*$ then:
(2)
\begin{align} \quad d(\mathbf{f}(x), \mathbf{a}) = \| \mathbf{f}(x) - \mathbf{a} \| < \epsilon \quad (*) \end{align}
• Expanding the inequality above gives us:
(3)
\begin{align} \quad \| \mathbf{f}(x) - \mathbf{a} \| = \sqrt{(f_1(x) - a_1)^2 + (f_2(x) - a_2)^2 + ... + (f_n(x) - a_n)^2} < \epsilon \end{align}
• For each $j \in \{ 1, 2, ..., n \}$ we have that then $\mid f_j(x) - a_j \mid < \| \mathbf{f}(x) - \mathbf{a} \| < \epsilon$. Taking $\delta = \delta^*$ and we see that if $x \in D(f) \setminus \{ p \} = A \setminus \{ p \}$ and $d_S(x, p) < \delta$ then $(*)$ holds and $\mid f_j(x) - a_j \mid < \epsilon$, so $\lim_{x \to p} f_j(x) = a_j$.
• $\Leftarrow$ Let $\epsilon > 0$ be given. Suppose that $\lim_{x \to p} f_j(x) = a_j$ for all $j \in \{1, 2, ..., n \}$. Then for $\epsilon_j = \frac{\epsilon}{n} > 0$ there exists a $\delta_j > 0$ such that if $x \in D(\mathbf{f}) \setminus \{ p \} = A \setminus \{ p \}$ and $d_S(x, p) < \delta_j$ then:
(4)
\begin{align} \quad \mid f_j(x) - a_j \mid < \epsilon_j = \frac{\epsilon}{n} \quad (*) \end{align}
• Let $\delta = \min \{ \delta_1, \delta_2, ..., \delta_n \}$. If $d_S(x, p) < \delta$ then $(*)$ holds for each $j \in \{1, 2, ..., n \}$ and so:
(5)
\begin{align} \quad d(\mathbf{f}(x), \mathbf{a}) = \| \mathbf{f}(x) - \mathbf{a} \| = \sqrt{(f_1(x) - a_1)^2 + (f_2(x) - a_2)^2 + ... + (f_n(x) - a_n)^2} \leq \sum_{j=1}^{n} \mid f_j(x) - a_j \mid < \sum_{j=1}^{n} \epsilon_j = \sum_{j=1}^{n} \frac{\epsilon}{n} = \epsilon \end{align}
• So for all $\epsilon > 0$ there exists a $\delta > 0$ such that if $x \in D(f) \setminus \{ p \} = A \setminus \{ p \}$ and $d_S(x, p) < \delta$ then $d(\mathbf{f}(x), \mathbf{a}) < \epsilon$, so $\lim_{x \to p} \mathbf{f}(x) = \mathbf{a}$. $\blacksquare$


text:
# Thread: Epsilon - Delta proof help

1. ## Epsilon - Delta proof help

I've tried this problem to the best of my ability and still cannot finish it. Can someone please show me how to work it? Thanks

My problem
http://i13.photobucket.com/albums/a2...isc/img368.jpg


text:
# Primary Mathematics/Multiplying numbers

Primary Mathematics
 ← Subtracting numbers Multiplying numbers Dividing numbers →

## The Teaching of Multiplication

### Manipulatives and Models

In the early and middle primary grades, the operation of multiplication is first denoted by the symbol "x", and is normally first taught as repeated addition, where multiplying the numbers "3" and "5" (3 x 5) is the same as adding the number three a total of five times: 3 + 3 + 3 + 3 + 3 = 15, so 3 x 5 = 15. Modern curriculums initially teach this concept with manipulatives, or toys and objects that serve to model, and enable students to visualize what multiplication is. For instance, a teacher might model the problem 4 x 6 by putting 4 jelly beans each in 6 bags. Subsequent models become more abstract, but the model that all students eventually learn to understand and use is called an area rectangle:

The above area rectangle models the problem 9 x 4, which equals 36. Note that there are 4 rows and 9 columns and that the height of the rectangle is 4 units and the width (or base) is 9 units. Students find that when they count the 9 unit rows four times, they will count a total of 36 units. Soon, they come to the realization that if they were to count the 4 unit columns nine times, they arrive at the same answer. This becomes one of the ways that they learn the commutative property: a x b = b x a (See:Wikipedia:Commutativity) Eventually, students should memorize all of combinations of multiplying single digit numbers, but it should be noted that just because a student has memorized their multiplication facts that they necessarily understand at an abstract level what multiplication represents. Note that the above rectangle has a total of 36 square units, which serves to introduce students to the geometric axiom that area of a rectangle is equal to the base (9 in this case) times the height(4).

By working with area rectangles, students make connections to geometry that serve to strengthen their understanding of multiplication. Eventually students no longer need to see the interior square units and soon come to the understanding that one or both of the lengths of these area rectangles can be expressed as the sum of two lengths. The following area diagram models the problem 16 x 3 :

Because 16 = 10 + 6, students can visualize that the length of the above rectangle is still 16. They then can see that the larger rectangle can be expressed as the sum of the two smaller area rectangles: (3 x 10) + (3 x 6).

In upper elementary grades students are introduced to a more standard mathematical nomenclature where the mulitpication symbol "x" is no longer necessary, permitting them to notate an equation for this model as: 3(16) = 3(10) + 3(6). This is the primary model used to teach the distributive property: a(b + c) = a(b) + a(c) (See: Wikipedia:Distributivity)

The area model can be used to show the distributive property at an even more complex level. Consider the problem 155x360:

### The Use of Different Algorithms to Solve Multiplication Problems

Note that in the above model, the height and width (base) of the larger area rectangle has been broken up into smaller area rectangles based on the place holder of each digit in each number, making it a representation of the standard algorithm for multiplication:

This standard algorithm can be further modified to make it more efficient.

{\displaystyle {\begin{aligned}360\\\star 155\\\hline \\1800\\1800\ \\360\ \ \ \\\hline \\55800\end{aligned}}}

In the example above, multiplication is the same, but uses carried digits and integrates them into the same row.

### The Lattice Method

Some students find an algorithm known as the lattice method easier to use because it involves the use of lines that guide the eventual values of the final place holders. It should be noted that students using this algorithm generally take more time to complete a problem. Additionally, this algorithm tends to become confusing for students when it is used with problems involving decimals. For these reasons, the use of the lattice method can become a liability in later grades. It is recommended that as soon as this model is mastered by the student, it becomes advisable to teach and encourage them to use the standard model.

In the left image, the two numbers are arranged at the edges of a grid. In each cell of the grid, the two numbers in the row/colum are multiplied together to get a two digit number; the tens place is placed in the upper-left triangle in the grid, and the ones in the bottom-right corner.

In the right image, each diagonal is summed to produce a number on the bottom; digits are carried to the diagonal on the left.

### Multiplication with decimals

When decimals appear in a multiplication problem, they can be hidden during the multiplication. For example, when looking at the problem 21.4 x 5.63 you would ignore the decimals and perform the operation for 214 x 563. When the computation is complete and you have the answer of 120482, count the digits (or place values) to the right of the decimal in each of the original two factors. The first factor, 21.4, has one digit to the right of the decimal and the second factor 5.63 has two digits to the right of the decimal. Next, take the total of these two counts, which in this case is 3, and include the same number of digits to the right of the decimal point within the product. This makes the answer 120.482

Another way to determine where the decimal point belongs in your answer is to make an estimate. For example if you once again have the problem 21.4 x 5.63 you could make a quick estimate of 20 x 5 which is 100, so you know your answer will have to be near 100. If you complete the multiplication computation, once again ignoring the decimals (214 x 563), your answer will be 120482. The only reasonable place to insert the decimal point, based on our estimate of 100, is between the 0 and 4, making the answer 120.482

Primary Mathematics
 ← Subtracting numbers Multiplying numbers Dividing numbers →


text:
# A problem from Finite Dimensional vector spaces

Problem : If $M$ and $N$ are two subspaces of the vector space $V$ such that $\forall v \in V$ , $v \in M$ or $v \in$ (or both) . Prove that at least one of the is equal to $V$

My Approach Assume that $M \neq V$ , we are required to prove $N = V$ .

Assume contrary, let $\dim N < \dim V$.

We assume that $M \cap N = \phi$ , in case the intersection is not null, we delete the elements from $N$ . Now, $$\dim(M+N) + \dim (M\cap N) = \dim M + \dim N$$

Since $\dim(M\cap N) = 0$ and $M+N = V$. Let $\dim M =m , \dim N = n . \dim V = v$. Therefore we get $n+m = v$ We know there is an isomorphism between $V$ and $\mathbb F^v$.

Consider the vectors in $\mathbb V$ corresponding to $(1,0,0,\dots) , (0,1,0,0,\dots), \dots$ in $\mathbb F^v$.

Exactly $n$ of these belong to $N$ (which form a basis) and exactly m of these belong to $M$ (which again form a basis).WLOG we can assume that

$(1,0,0,\dots) , (0,1,0,\dots) , \dots , (0,0,\dots,1, 0,\dots)$ are the vectors present in $N$ ...$(*)$

Now consider the vector corresponding to $(1,1,1,\dots)$. It must belong to either $N$ or $M$ . WLOG assume it belongs to $N$ . Then we can get a set of $n+1$ linearly independent vectors in $N$. $n$ vectors as described at $(*)$ and one of the form $(0,0,0,\dots , 1,1,1,\dots)$ But since we know that number of elements in basis is greater or equal to the number of elements in an independent set, we arrive at a contradiction since $n+1 > n$

My proof inherently assumes that the vector space given is a finite dimensional vector space. And also I feel that my proof is really clumsy. Is there a better way to prove it ?

• "in case the intersection is not null, we delete the elements from \mathbb{N}" : You can't delete elements from $\mathbb{N}$ and have $\mathbb{N}$ remain a subspace. – Morgan Rodgers Aug 24 '15 at 6:27
• @Hirshy What about the vector (1,1) . It belongs to neither $W_1$ nor $W_2$ – Soham Aug 24 '15 at 6:29
• @MorganRodgers and Lucyfer, of course, you're absolutely right. I shouldn't write something before having coffee. Just pretend that I said nothing... – Hirshy Aug 24 '15 at 6:30
• @MorganRodgers I can delete elements and their span from N , then it would remain a subspace, right ? – Soham Aug 24 '15 at 6:31
• @LucyferZedd No, for example think of taking a two-dimensional subspace and remove a one-dimensional subspace, you no longer have a subspace. – Morgan Rodgers Aug 24 '15 at 6:33

If $M, N \neq V$, then pick $v_1 \in V \setminus M$ and $v_2 \in V \setminus N$. Since $v_1 \notin M$, $v_1 \in N$ by assumption. Similarly $v_2 \in M$. Let $v = v_1 + v_2$. Then $v \notin M$ for otherwise $v_1 = v + (-v_2) \in M$. Similarly $v \notin N$. Contradiction to the assumption.
Added: I would like to emphasize $V \setminus M$ is NOT a subspace. It may be easier if you look at a picture: removing the $x$-axis from the $x-y$ plane does not give you a subspace. In fact, $V \setminus M$ could never be a subspace since it does not contain the zero vector of $V$. In the context of vector spaces, disjoint union $M$ and $V \setminus M$ is not the way we are interested in decomposing a vector space $V$. Instead we are more interested in (direct) sums of vector spaces.


text:
Physics

# Key Terms

PhysicsKey Terms
$W + W +$ boson
positive carrier particle of the weak nuclear force
$W − W −$ boson
negative carrier particle of the weak nuclear force
$Z 0 Z 0$ boson
neutral carrier particle of the weak nuclear force
annihilation
the process of destruction that occurs when a particle and antiparticle interact
antimatter
matter constructed of antiparticles; antimatter shares most of the same properties of regular matter, with charge being the only difference between many particles and their antiparticle analogues
baryon
hadrons that always decay to another baryon
Big Bang
a gigantic explosion that threw out matter a few billion years ago
bottom quark
a quark flavor
carrier particle
a virtual particle exchanged in the transmission of a fundamental force
charmed quark
a quark flavor, which is the counterpart of the strange quark
colliding beam
head-on collisions between particles moving in opposite directions
color
a property of quarks the relates to their interactions through the strong force
cyclotron
accelerator that uses fixed-frequency alternating electric fields and fixed magnets to accelerate particles in a circular spiral path
down quark
the second lightest of all quarks
Electroweak Epoch
the stage before 10−11 back to 10−34 seconds after the Big Bang
electroweak theory
theory showing connections between EM and weak forces
Feynman diagram
a graph of time versus position that describes the exchange of virtual particles between subatomic particles
flavor
quark type
gluons
exchange particles of the nuclear strong force
Grand Unification Epoch
the time period from 10−43 to 10−34 seconds after the Big Bang, when Grand Unification Theory, in which all forces except gravity are identical, governed the universe
Grand Unified Theory
theory that shows unification of the strong and electroweak forces
graviton
hypothesized particle exchanged between two particles of mass, transmitting the gravitational force between them
particles composed of quarks that feel the strong and weak nuclear force
Higgs boson
a massive particle that provides mass to the weak bosons and provides validity to the theory that carrier particles are identical under certain circumstances
Higgs field
the field through which all fundamental particles travel that provides them varying mass through the transport of the Higgs boson
Inflationary Epoch
the rapid expansion of the universe by an incredible factor of 10−50 for the brief time from 10−35 to about 10−32 seconds
lepton
fundamental particles that do not feel the nuclear strong force
meson
pair production
the creation of a particle and antiparticle, commonly an electron and positron, due to the annihilation of a photon
particle physics
the study of and the quest for those truly fundamental particles having no substructure
pion
particle exchanged between nucleons, transmitting the strong nuclear force between them
Planck Epoch
the earliest era of the universe, before 10–43 seconds after the Big Bang
positron
a particle of antimatter that has the properties of a positively charged electron
quantum chromodynamics
the theory of color interaction between quarks that leads to understanding of the nuclear strong force
quantum electrodynamics
the theory of electromagnetism on the particle scale
quark
an elementary particle and fundamental constituent of matter that is a substructure of hadrons
Quark Era
the time period from 10–11 to 10–6 seconds at which all four fundamental forces are separated and quarks begin to exit
Standard Model
an organization of fundamental particles and forces that is a result of quantum chromodynamics and electroweak theory
strange quark
the third lightest of all quarks
superforce
the unification of all four fundamental forces into one force
synchrotron
a version of a cyclotron in which the frequency of the alternating voltage and the magnetic field strength are increased as the beam particles are accelerated
Theory of Everything
the theory that shows unification of all four fundamental forces
top quark
a quark flavor
up quark
the lightest of all quarks
weak nuclear force
fundamental force responsible for particle decay
Order a print copy

As an Amazon Associate we earn from qualifying purchases.


text:
Free Version
Easy

# Perceived Effect of the Amplitude of Light Waves

APPSY-6GYXBL

Which of the following refers to the perceived effect of the amplitude of light waves?

A

Hue.

B

Color.

C

Afterimage.

D

Saturation.

E

Brightness.


text:
# Conductivity, altered by a magnetic field?

Conductivity, altered by a magnetic field???

Hi

Im a highschool student studying physics.

I conducted an experiment that measured the conductivity of KCl electrolytic solution vs. a change in concentration.

Anyway, i had a magnetic stirrer stirring the solution in a beaker when the conductivity probe from a EDT Series 3 RE387Tx Conductivity meter was inserted to take a reading.

Now the question is,
Does the magnetic field created by the magnetic stirrer also affect the Current flowing between the conductivity meters electrodes and therefore the CONDUCTIVITY!?
(plz say no ! )

PS: The conductity meter puts a small amount of AC through the solution.

Staff Emeritus
Gold Member
My bet would be yes. Sorry! :)

The rotating magnet also creates a AC field, it is not clear how the conductivity meter would separate contributions due to the field it generates vs that created by the rotating magnet.

I am currently working on a process which uses conductivity to control the concentration of a chemical (TMAH), we have found that when our heaters are on we have a higher conductivity reading. So you are not alone in being messed up by outside effects on conductivity.

Homework Helper
Since the magnetic stirrer is rotating, it would create an ac potential in the solution, but I would think that the frequency of rotation of the stirrer would have to be synchronized with the conductivity tester in order to produce a steady reading.

Am I wrong here?

IF you could, see if changing the speed of rotation changes the reading. My inclination (without knowing specifics) is that the stirrer would not contribute much significant current unless you are operating with very precise equipment

Staff Emeritus


text:
+0

# Geometry problem

0
93
4

A unit square ABCD is such that M and N are the midpoints of BC and CD respectively. A straight line is drawn from A  to N and another from D to M. This two lines AN and DM meet at O which is inside square ABCD. Find the area of $$ADO$$

Apr 15, 2022

#1
+2455
+1

I solved this problem using co-ordinate geometry.

Let the bottom-right corner be the origin. The equations for lines $$AN$$ and $$DM$$ are $$y = {1 \over 2}x$$ and $$y=-2x+1$$

Letting these 2 equations equal each other, we have: $$0.5x=-2x+1$$.

Solving, we find $$x = 0.4$$

Thus, the area of $$\triangle AMO$$ is $$1 \times {2 \over 5} \div 2 = \color{brown}\boxed{1 \over 5}$$

Here is the diagram:

Apr 15, 2022
#3
+124598
+1

You beat me to it, BuilderBoi  !!!!!   {LOL!!!}

CPhill  Apr 15, 2022
#4
+2455
+1

lol, at least we have the same answers :)

BuilderBoi  Apr 15, 2022
#2
+124598
+2

Let A  = (0,0)   D = (0,1)  N= (.5, 1)   M  = (1,.5)

The slope of the line sebment AN  =  [1 -0] / [ .5 - 0 ]  =  2

The equation of the line containing this segment is

y = 2x

The slope of the line segment DM =  [ .5 - 1 ] / [ 1 - 0 ]  =   -.5 =  -1/2

The equation of the line containing this segment is

y = (-1/2)(x - 1) + .5

y = (-1/2)x + 1

Setting the equations = and solving for x will give us the x coordinate of O = the height of ADO

2x = (-1/2)x + 1

2.5x = 1

x = 1/2.5  = 10/25  =  .4

So....the area of ADO  =  (1/2) AD * .4  =   (1/2) (1) (.4)  =  .2  units

Here's a pic :

Apr 15, 2022


text:
Volume 398 - The European Physical Society Conference on High Energy Physics (EPS-HEP2021) - T06: QCD and Hadronic Physics
LHCb Fixed-target results and prospects
S. Mariani
Full text: Not available
Abstract
Among the LHC experiments, LHCb has, starting from 2015, the unique possibility to exploit the injection of noble gases into the LHC accelerator to acquire in fixed-target configuration the collisions between protons or lead ions and gas atoms. These give access to poorly-constrained kinematic regions and provide an example of extending the diversity of the LHC physics reach, stressed as a key requirement for the future in the 2020 update of the European strategy for Particle Physics. Two examples of analyses also motivated by open problems in the cosmic rays community and the respective ongoing extensions are reviewed: the first charm production measurement at fixed-target LHC in the pHe and pAr systems with $\sqrt{s_{\text{NN}}}=87$ GeV and $\sqrt{s_{\text{NN}}} =110$ GeV nucleon-nucleon centre-of-mass energies, respectively, and the first determination of the prompt antiproton production cross-section in \pHe collisions at $\sqrt{s_{\text{NN}}}=110$ GeV.
The fixed-target system is now being upgraded with the installation of a confinement cell for the gas upstream the nominal beam-beam interaction point. The gas areal density will be increased by up to two orders of magnitude, also non-noble gases like oxygen and hydrogen could be injected and the separation between the beam-beam and beam-gas collision regions will open the possibility to simultaneously operate the LHCb detector in collider and fixed-target mode. All of this will result in a unique laboratory for QCD studies at the LHC.
How to cite

Metadata are provided both in "article" format (very similar to INSPIRE) as this helps creating very compact bibliographies which can be beneficial to authors and readers, and in "proceeding" format which is more detailed and complete.

Open Access


text:
Two unbiased coins are tossed. What is probability of getting at most one tail ?

$\frac{1}{2}$

$\frac{1}{3}$

$\frac{3}{2}$

$\frac{3}{4}$

Please do not use chat terms. Example: avoid using "grt" instead of "great".


text:
# supersingular elliptic curve in char. 2 or 3

Let $p=2$ or 3, and let $k$ be an algebraically closed field of char. $p.$ Let $E$ be the supersingular elliptic curve over $k$ (with $j=0$). Let $G$ be the automorphism group of $E,$ which has order 12 (resp. 24) when $p=3$ (resp. 2). Then the $\ell$-adic cohomology $H^1(E,\mathbb Q_{\ell})$ is a 2-dimensional representation of $G.$ Is it irreducible?

Since we know the group structure of $G$ (cf. Silverman's AEC, Appendix A, exercise..), does anyone have a reference for its character table?

-

If you have a supersingular curve in general, the $\ell$-adic cohomology is a faithful representation of the endomorphism ring, which is a quaternion order that splits over $\mathbb{Q}_\ell$. In the case of characteristic 2 and 3, the automorphism groups are non-abelian (in particular, isomorphic to $SL_2(\mathbb{F}_3)$ and $\mathbb{Z}/3\mathbb{Z} \rtimes \mathbb{Z}/4\mathbb{Z}$, respectively). For non-abelian groups, any faithful two dimensional representation (away from characteristic dividing the order) is automatically irreducible. You can find character tables of the groups in GAP, using commands like:

g := SpecialLinearGroup(2,3);
tbl := CharacterTable(g);
Display(tbl);

In SAGE, you can add "gap" to the beginnning of things:

g = gap.SpecialLinearGroup(2,3)
tbl = gap.CharacterTable(g)
gap.Display(tbl)

There might be a better way to do this.

-
When $p = 2$, the group $G$ is the group of units in the Hurwitz order in the Hamilton quaternions $\mathbb H$ over $\mathbb Q$, i.e. the group $\{\pm 1,\pm i,\pm j,\pm k,(\pm 1 \pm i \pm j\pm k)/2\}$. It is a central extension of $A_4$ by a group of order $2$.
The $\ell$-adic cohomology is given by the standard two-dimensional representation of $M_2(\mathbb Q_{\ell}) := \mathbb H \otimes_{\mathbb Q} \mathbb Q_{\ell}$. This is an irrep. of $G$.
I can't write down the $p = 3$ case off the top of my head like this, but it will be similar, and the representation on $H^1(\mathbb Q_{\ell})$ should again be irreducible.


text:
# Proper name for a thermodynamic process with constant internal energy $U$

Back in the day I learned that a few special thermodynamical processes have special names.

For example, if one keeps $P$ constant, the process is called isobaric, if one keeps $T, V$ or $S$ constant, one gets, correspondingly, isothermic, isochoric or isentropic processes. Similarly, if one keeps $\dfrac{\mathrm{d} \ln P}{\mathrm{d} \ln \rho}$ constant during the process, it is called polytropic, and if $\delta Q = 0$ at any time, the process is called adiabatic.

Now, the question: what is the process called, if one keeps internal energy $U$ constant?

• @Danu, "isentropic" is typically used for hydrodynamical flows, rather than processes. Though I do agree that adiabatic is a bit more general (I add a specification). – Alexey Bobrick Nov 11 '13 at 18:42
• When the energy is kept constant, the process is called isoenergetic (or, if you prefer, iso-energetic). – Georg Sievelson Nov 11 '13 at 19:16
• Notice that if there is some subtlety and you keep a constant internal energy $U=\text{cte}$ but not a constant energy $E=U+E_{\text{m}}$, by modifying the mechanical energy $E_{\text{m}}$, you should refrain from using standard names like isoenergetic and explain precisely what happens. – Georg Sievelson Nov 11 '13 at 19:21
• Dear @GeorgSievelson, thank you, this is exactly what I have been looking for! For completeness, would the term be suitable for flows, which keep specific internal energy constant (remembering your other comment, though)? – Alexey Bobrick Nov 11 '13 at 19:25
• I would also gladly consider it as an answer, if you can apply a comment->answer transformation to your reply. – Alexey Bobrick Nov 11 '13 at 19:26

Notice that if there is some subtlety and you keep a constant internal energy $U=\text{cte}$ but not a constant energy $E=U+E_{\text{m}}$, by modifying the mechanical energy $E_{\text{m}}$, you should refrain from using standard names like isoenergetic and explain precisely what happens.


text:
## FANDOM

155 Pages

Cosmic strings are hypothetical entities that might have been created in the Big Bang. They are thought to distort space in the following way: the ratio between the circumference and the radius of a circle drawn around such a string in the plane perpendicular to it will be less than $2 \pi \,$. The difference in angle is often referred to as angle deficit, denoted $\Delta$. This angle can be related to the mass density per unit length $\mu$ of the string using gravitational lensing arguments

$\Delta \approx \frac{G \mu}{c^2}$

where $G$ is the universal constant of gravity, and $c$ is the speed of light.


text:
# Flooding dynamics of diffusive dispersion in a random potential

Michael Wilkinson, Marc Pradas, Gerhard Kling

Research output: Contribution to journalArticlepeer-review

## Abstract

We discuss the combined effects of overdamped motion in a quenched random potential and diffusion, in one dimension, in the limit where the diffusion coefficient is small. Our analysis considers the statistics of the mean first-passage time $T(x)$ to reach position $x$, arising from different realisations of the random potential: specifically, we contrast the median $\bar T(x)$, which is an informative description of the typical course of the dispersion, with the expectation value $\langle T(x)\rangle$, which is dominated by rare events where there is an exceptionally high barrier to diffusion. We show that at relatively short times the median $\bar T(x)$ is explained by a 'flooding' model, where $T(x)$ is predominantly determined by the highest barriers which is encountered before reaching position $x$. These highest barriers are quantified using methods of extreme value statistics.
Original language English Journal of Statistical Physics Accepted/In press - 7 Feb 2021

## Keywords

• disfusion
• ornstein-Uhlenbeck process


text:
# mdtraj.geometry.squareform¶

mdtraj.geometry.squareform(distances, residue_pairs)

Reshape the contact distance to square contact maps

Parameters
distancesnp.ndarray, shape=(n_frames, n_pairs)

Distances between pairs of residues, as computed by mdtraj.geometry.compute_contacts.

residue_pairsnp.ndarray, shape=(n_pairs, 2)

The indices of the residues involved in each pair, as returned by mdtraj.geometry.compute_contacts

Returns
contact_mapsnp.ndarray, shape=(n_frames, n_residues, n_residues)

Reshaped version of distances, such that the distance, in the kth frame of the trajectory from residue i to residue j is given by contact_maps[k, i, j]. All entries in contact_maps corresponding to the distance between residues that were not part of residue_pairs are 0.0.

See also

mdtraj.compute_contacts

Compute the array of contact distances


text:
# Objects & Graphics 1¶

## A graphics.py Tutorial¶

First, import the correct classes from the graphics module.

In [ ]:
from graphics import Point, GraphWin

We intend to draw a couple of very simple Points to a window, so let's first make our points from the Point class. The one below is positioned at $x=50$ and $y=60$.

In [ ]:
p = Point(50, 60)

Print out some helpful information about the instance of the Point class ("the Point object") we just made.

In [ ]:
print(p.getX())
print(p.getY())
print(p)
print(type(p))

We can make our shapes and use them before we even draw them. At some point when we want to draw them, we need to first make a window and have it appear.

In [ ]:
win = GraphWin()

We then ask a graphics-made object to draw itself to a window. We use the .draw(win) method. This is the action (a function, which in this context of an object is called a method) that belongs to the data of this object (the $x$ and $y$ coordinates.)

In [ ]:
p.draw(win)

Below we make a second point and then quicy draw it.

In [ ]:
p2 = Point(140,100)
p2.draw(win)


text:
# Relationship between lesser Green's function and greater Green's function in Keldysh formalism

I wonder if there is any general relationship between lesser Green's function $G^<(t,t')$ and $G^>(t,t')$ in the non equilibrium case, which means they not only depend on the relative time but also the average time. The time evolution kernel becomes a Dyson Series.

TL;DR In general, no.

A longer but possibly irrelevant discussion follows. Consulting the classic review RevModPhys.58.323 by Rammer and Smith, the quantities you are considering are defined as (Eq. 2.5):

$$G^{<}(\boldsymbol x_1,t_1,\boldsymbol x_{1'},t_{1'})=\mp i\langle \psi^\dagger_{\mathcal H}(\boldsymbol x_{1'},t_{1'}) \psi_{\mathcal H}(\boldsymbol x_1,t_1)\rangle,$$

$$G^{>}(\boldsymbol x_1,t_1,\boldsymbol x_{1'},t_{1'})=- i\langle \psi_{\mathcal H}(\boldsymbol x_1,t_1) \psi^\dagger_{\mathcal H}(\boldsymbol x_{1'},t_{1'}) \rangle,$$

where $\mathcal H$ implies the Heisenberg picture, while $(\boldsymbol x_1,t_1)$ and $(\boldsymbol x_{1'},t_{1'})$ are at this point completely general.

In thermal equilibrium these functions depend only on the relative variables, i.e., $t_1 - t_{1'}$ and $\boldsymbol x_1 - \boldsymbol x_{1'}$. A well known consequence of this is the relationship concerning the Fourier transforms of the lesser and greater Green's functions, Eq. 2.65, $$\tilde G^{<}(E) = e^{-\beta E}\tilde G^{>}(E).$$ This relationship holds basically since the Hamiltonian at different times commutes with itself in an equilibrium state (also known as the Kubo-Martin-Schwinger boundary condition).

However, if the Hamiltonian does not commute with itself, which depends on the kind of perturbation considered, this relation is obviously not valid any more.

Depending on the perturbation, it should be possible to find similar relations (which now should depend on the average variables $t_1 + t_{1'}$ etc.), even though I've failed to find a reference to illustrate this point. In any case, such relations would involve a perturbative expansion, and no simple general relation exists as far as I know.

• In your first equation, in the definition for the lesser Green's function, shouldn't the creation operator have the primed variable? Jun 16 '17 at 20:44
• @ArnabBarmanRay totally true. Will edit right away, thanks!
– jarm
Jun 18 '17 at 15:31

For the record, there is a "general relationship" between $G^{<}(t,t')|_{t'=t}$ and $G^{>}(t,t')|_{t'=t}$, that is, when they are evaluated "at equal times". It reads $$G^{R}(t,t) - G^{A}(t,t) = G^{>}(t,t) - G^{<}(t,t) = -i,$$ and is essentially a consequence of the non-commutating operators, since $G^{>}(t,t) - G^{<}(t,t) = -i\langle a a^{\dagger} - a^{\dagger}a \rangle$. It is quite important to bear this relation in mind when deriving equations of motion for the Green functions. Note that $G^{R}(t,t') - G^{A}(t,t') = G^{>}(t,t') - G^{<}(t,t')$ always holds.


text:
% Casting Between Types

Rust, with its focus on safety, provides two different ways of casting different types between each other. The first, as, is for safe casts. In contrast, transmute allows for arbitrary casting, and is one of the most dangerous features of Rust!

# Coercion

Coercion between types is implicit and has no syntax of its own, but can be spelled out with [as](#explicit-coercions).

Coercion occurs in let, const, and static statements; in function call arguments; in field values in struct initialization; and in a function result.

The most common case of coercion is removing mutability from a reference:

• &mut T to &T

An analogous conversion is to remove mutability from a raw pointer:

• *mut T to *const T

References can also be coerced to raw pointers:

• &T to *const T

• &mut T to *mut T

Custom coercions may be defined using [Deref](deref-coercions.md).

Coercion is transitive.

# as

The as keyword does safe casting:

let x: i32 = 5;

let y = x as i64;

There are three major categories of safe cast: explicit coercions, casts between numeric types, and pointer casts.

Casting is not transitive: even if e as U1 as U2 is a valid expression, e as U2 is not necessarily so (in fact it will only be valid if U1 coerces to U2).

## Explicit coercions

A cast e as U is valid if e has type T and T coerces to U.

## Numeric casts

A cast e as U is also valid in any of the following cases:

• e has type T and T and U are any numeric types; numeric-cast
• e is a C-like enum (with no data attached to the variants), and U is an integer type; enum-cast
• e has type bool or char and U is an integer type; prim-int-cast
• e has type u8 and U is char; u8-char-cast

For example

let one = true as u8;
let at_sign = 64 as char;
let two_hundred = -56i8 as u8;

The semantics of numeric casts are:

• Casting between two integers of the same size (e.g. i32 -> u32) is a no-op
• Casting from a larger integer to a smaller integer (e.g. u32 -> u8) will truncate
• Casting from a smaller integer to a larger integer (e.g. u8 -> u32) will
• zero-extend if the source is unsigned
• sign-extend if the source is signed
• Casting from a float to an integer will round the float towards zero
• Casting from an integer to float will produce the floating point representation of the integer, rounded if necessary (rounding strategy unspecified)
• Casting from an f32 to an f64 is perfect and lossless
• Casting from an f64 to an f32 will produce the closest possible value (rounding strategy unspecified)

## Pointer casts

Perhaps surprisingly, it is safe to cast raw pointers to and from integers, and to cast between pointers to different types subject to some constraints. It is only unsafe to dereference the pointer:

let a = 300 as *const char; // a pointer to location 300
let b = a as u32;

e as U is a valid pointer cast in any of the following cases:

• e has type *T, U has type *U_0, and either U_0: Sized or unsize_kind(T) == unsize_kind(U_0); a ptr-ptr-cast

• e has type *T and U is a numeric type, while T: Sized; ptr-addr-cast

• e is an integer and U is *U_0, while U_0: Sized; addr-ptr-cast

• e has type &[T; n] and U is *const T; array-ptr-cast

• e is a function pointer type and U has type *T, while T: Sized; fptr-ptr-cast

• e is a function pointer type and U is an integer; fptr-addr-cast

# transmute

as only allows safe casting, and will for example reject an attempt to cast four bytes into a u32:

let a = [0u8, 0u8, 0u8, 0u8];

let b = a as u32; // four eights makes 32

This errors with:

error: non-scalar cast: [u8; 4] as u32
let b = a as u32; // four eights makes 32
^~~~~~~~

This is a ‘non-scalar cast’ because we have multiple values here: the four elements of the array. These kinds of casts are very dangerous, because they make assumptions about the way that multiple underlying structures are implemented. For this, we need something more dangerous.

The transmute function is provided by a compiler intrinsic, and what it does is very simple, but very scary. It tells Rust to treat a value of one type as though it were another type. It does this regardless of the typechecking system, and completely trusts you.

In our previous example, we know that an array of four u8s represents a u32 properly, and so we want to do the cast. Using transmute instead of as, Rust lets us:

use std::mem;

unsafe {
let a = [0u8, 0u8, 0u8, 0u8];

let b = mem::transmute::<[u8; 4], u32>(a);
}

We have to wrap the operation in an unsafe block for this to compile successfully. Technically, only the mem::transmute call itself needs to be in the block, but it's nice in this case to enclose everything related, so you know where to look. In this case, the details about a are also important, and so they're in the block. You'll see code in either style, sometimes the context is too far away, and wrapping all of the code in unsafe isn't a great idea.

While transmute does very little checking, it will at least make sure that the types are the same size. This errors:

use std::mem;

unsafe {
let a = [0u8, 0u8, 0u8, 0u8];

let b = mem::transmute::<[u8; 4], u64>(a);
}

with:

error: transmute called with differently sized types: [u8; 4] (32 bits) to u64
(64 bits)

Other than that, you're on your own!

commit 6ba9520


text:
# A nonreflexive module isomorphic to its double dual

I know that the definition of reflexive module is that the $R$-module $M$ should be isomomorphic to its double dual $M^{**}$ via the canonical map $M\rightarrow M^{**}$.

I'd like to know an example of an $R$-module $M$ such that it's isomorphic to $M^{**}$ but the canonical map $M\rightarrow M^{**}$ is not an isomorphism. Do you have such an example?

(I know that for Banach spaces such example exists, but I don't know it.)

(I put also the tag banach-spaces, maybe it's helpful to know the example for Banach spaces.)

-
For Banach spaces, one example is James's Construction: See mathoverflow.net/questions/43986/… – kneidell Sep 20 '11 at 21:18

This is a community wiki answer posted with the goal of getting this question off the unanswered list

This question was crossposted to mathOverflow and received an answer there by GMark: http://mathoverflow.net/a/76019/19965

I'm reproducing the solution here, in case this link is somehow broken:

-


text:
## Life is Good

From: andrew cooke <andrew@...>

Date: Tue, 18 Aug 2009 13:01:24 -0400

Feeling good at the moment (the last few weeks confirm my suspicions I
am slightly manic depressive, so thank god I am back on the up).
Anyway, for I am feeling good for the following reasons:

- Dire Straits.  Yeah, I'm old and uncool.

- I am working on a Linux computer, that's emulating a Windows
computer, that's got windows open on a Linux computer in Vienna,
running code.  And it's usably fast.  The stuff that's happening in
the background for that to work...

- I had a bug in my code - was calling model constructors like
Parameter(value=incoming.value, date=incoming.date...)
where "incoming" was read from XMLRPC and Parameter is ORMed to an
underlying database.  The problem was that where the incoming data had
None (because values were unknown) I didn't want to store NULL in the
database, but the default table value (it turns out Oracle does this
anywya, but SQLite doesn't - and I think SQLite is correct).
What made me happy was that all I need to do to fix this, for all my
code, was add this class method to a common base of my ORM classes
(it's Python2.4, so more verbose than I would normally write):

@classmethod
def no_nulls(cls, **kargs):
'''
A constructor that removes None values from arguments.  This avoids
us specifying None where we want the default value.
'''
new_args = {}
for key in kargs:
if kargs[key] is not None:
new_args[key] = kargs[key]
return cls(**new_args)

and then change calls like the above to:

Parameter.no_nulls(value=incoming.value, date=incoming.date...)

(I could have over-written the constructor, but I'd like to leave this
explicit).

Anyway, point being that being able to use Python at work is a real pleasure.

Andrew