Use responsive images inline
There is indeed a way to construct the projection-operators, when you only know the operator itself and its eigenvalues. The derivation can be found in Julian Schwingers "Quantum Mechanics: Symbolism of Atomic Measurement" and leads to
$$ P_j = \prod_{i\neq j} \frac{A-a_i}{a_j - a_i}, $$
where the product goes over all distinct eigenvalues $a_i$ of $A$. It is quite easy to see, that it indeed fulfills
$$P_i |\psi_j\rangle = \delta_{ij}|\psi_j\rangle,$$ where no summation is implied.
It you apply this to your problem, you get the (correct) projectors
$$ P_{+} = \frac{\vec v \cdot \vec \sigma -(-1)}{1-(-1)} = \frac{I+\vec v \cdot\vec \sigma}2\\ P_- = \frac{\vec v \cdot \vec \sigma - 1}{(-1)-1} = \frac{I-\vec v \cdot \vec \sigma}{2}$$
It is perfectly okay to have a system without that file. Which is why it can't be found on any bare bones system. That file is copied from /etc/skel
into the new user's home folder upon user creation and it will be in the home folder because of that fact or because someone put it there manually.
The reason you'd want to have a .bashrc
(or .bash_profile
or both) is so that during login Bash will execute whatever commands (and custom settings) you desire.
Keep in mind that even Bash itself is optional. While some POSIX-compliant shell has to exist, it needn't be Bash.
You can use count_user_posts() function to get the number of total posts for specific author. With looping through all posts by the specific author, you can get the number of likes on each post and store it/add it in one variable. Here is a function for that.
<?php
function avg_num_of_likes() {
$author = get_user_by( 'id', get_query_var( 'author' ) );
$author_id = $author->ID;
$number_of_posts = count_user_posts( $author_id );
$sumLikes = 0;
$avgLikes = 0;
$args = array(
'author' => $author_id
);
$author_query = new WP_Query( $args );
if( $author_query->have_posts() ) : while( $author_query->have_posts() ) : $author_query->the_post();
$sumLikes += get_post_meta( get_the_ID(), 'cv_posts_view', true );
endwhile; endif;
wp_reset_postdata();
$avgLikes = $number_of_posts / $sumLikes;
return $avgLikes;
}
?>
Call avg_num_of_likes() in the place where you want the average number of likes to be displayed on the author's page.
@Harman Preet
You can use an additional function for that. And change $avgLikes = $number_of_posts / $sumLikes;
to $avgLikes = custom_number_format( $number_of_posts / $sumLikes );
.
function custom_number_format($n, $precision = 1) {
if($n < 1000 ) {
$n_format = number_format($n);
}
else if ($n < 1000000) {
// Anything less than a million
$n_format = number_format($n / 1000, $precision) . 'K';
} else if ($n < 1000000000) {
// Anything less than a billion
$n_format = number_format($n / 1000000, $precision) . 'M';
} else {
// At least a billion
$n_format = number_format($n / 1000000000, $precision) . 'B';
}
return $n_format;
}
Ref: https://stackoverflow.com/questions/4371059/shorten-long-numbers-to-k-m-b