Alternative to many IF statements in python?
Replacements for switch statement in Python?
How do I tell if matrices are similar? I have two $2\times 2$ matrices, $A$ and $B$, with the same determinant. I want to know if they are similar or not.  I solved this by using a matrix called $S$: $$\left(\begin{array}{cc} a&amp; b\\ c&amp; d \end{array}\right)$$ and its inverse in terms of $a$, $b$, $c$, and $d$, then showing that there was no solution to $A = SBS^{-1}$. That worked fine, but what will I do if I have $3\times 3$ or $9\times 9$ matrices? I can't possibly make system that complex and solve it.  How can I know if any two matrices represent the "same" linear transformation with different bases?  That is, how can I find $S$ that change of basis matrix?  I tried making $A$ and $B$ into linear transformations... but without the bases for the linear transformations I had no way of comparing them.  (I have read that similar matrices will have the same eigenvalues... and the same "trace" --but my class has not studied these yet. Also, it may be the case that some matrices with the same trace and eigenvalues are not similar so this will not solve my problem.)  I have one idea. Maybe if I look at the reduced col. and row echelon forms that will tell me something about the basis for the linear transformation? I'm not really certain how this would work though? Please help. If I go to pickpocket a person who's recently caught me, I get an error saying I can't do it because they've already caught me.  How long does this last?  Is it indefinite, or will they "forget" after a certain amount of time? I have to prove this : "$n^7-n$ is a multiple of 7". This is what I have done this so far :  $P(n):n^7-n$ On putting $n=1,$ $P(1):1^7-1=0$, which is a multiple of 7. So, $P(1)$ is true. Let $P(k)$ be a multiple of 7. So, $k^7-k$ is a multiple of 7. So, $k^7-k=7m$, where $m$ is any natural number. Let $P(k+1)$ be true, Hence, $(k+1)^7-(k+1)$ is a multiple of 7.  Now, how do I evaluate $(k+1)^7$ without using the binomial theorem ? Or is there some other way to do it ? Delete one of the OS via Ubuntu I'm currently running on dual boot (win 7 and ubuntu). I'd like to know how to delete my Windows 7 OS using ubuntu How do I check if an element is hidden in jQuery? Is it possible to toggle the visibility of an element, using the functions .hide(), .show() or .toggle()?  How would you test if an element is visible or hidden? wrong positioning of figure with tabular in xelatex I recently updated MikTex and it seems Xelatex is not able to place figures correctly anymore. Before updating all figures were shown correctly. I work with Texworks and Miktex 2.9  Here it is the code that I run:  \documentclass[10pt,a4paper]{report} \usepackage{graphicx} \graphicspath{{method1/}{method2/}{dpfig/}}  \begin{document}  \begin{figure}[!htbp] \centering \begin{tabular}{cc} \includegraphics[trim=6cm 2.5cm 6cm 2.5cm,clip=true,width=0.33\textwidth]{figure1.eps}&amp; \includegraphics[trim=6cm 2.5cm 6cm 2.5cm,clip=true,width=0.33\textwidth]{figure2.eps}\\ \end{tabular} \caption{Two figures} \end{figure} \end{document} \end{figure}   With this code, figures are correctly trimmed and the relative position between figure 1 and figure 2 is maintained. However, the position in the document is wrong: figure are placed upper and more right than expected (as the bottom-left corner of the table was placed in the middle of the page). The unusual thing is that this does not happen in draft mode and picture are shown centered as it would be.  I usually compile with Xelatex, Makeindex and Bibtex.  I hope to have been clear.. bye!  EDIT: Sorry, I forgot to add the images I prepared from the file that run that script: Users lookup in chat search breaks with JavaScript error When using the  and trying to filter by user, I get this after typing several letters:        Two letters work fine, third or fourth letter breaks the lookup.  Can this please be fixed? How to do relative imports in Python? Texture is missing in Cycles? Because I am pretty new to blender I watched the tutorial  from BlenderCookie.com.  I loaded  onto a sphere but then in all views the texture is just some kind of blurry with no details. Usually a probability distribution over discrete variables is described using a probability mass function (PMF):  When working with continuous random variables, we describe probability distributions using a probability density function (PDF) rather than a probability mass function. -- Deep Learning by Goodfellow, Bengio,  and Courville  However,  is using PDF to describe the probability distribution over discrete variables:    Is this a mistake? or it does not much matter? A thin-walled container of mass $m$ floats vertically at the separation surface of the two liquids of density $ρ_1$ and $ρ_2$  . The whole mass of the container is concentrated in the part of height $h$.  The question is to determine the immersion depth $h'$of the container in the lower liquid if the bottom of the container has a thickness $h$ and an area $S$ and if the container itself is filled with the liquid of density $ρ_1$.    I applied the fundamental principle of the statics on the container  $Balance$ $Sheet$:  The weight of the container ($-mg$)  The buoyancy force applied by the fluid with density $ρ_2$ ($ρ_2gSh$)  The weight of the fluid with density  $ρ_1$  (-$ρ_2gSh'$)  I summed up the forces and set them to zero and find my $h'$  but then  realised that the fluid with density  $ρ_1$  applied also a buoyoncy force on the top of the container , and the fluid with density  $ρ_2$  applied a buoyoncy force on the other fluid.  Where's the problem ? I am not an expert of random forest but I clearly understand that the key issue with random forest is the (random) tree generation. Can you explain me how the trees are generated? (i.e. What is the used distribution for tree generation?)  Thanks in advance ! Is there a human home planet? Did all the humans in the Star Wars universe originate on a single planet some time in the distant past, or did they originate on different worlds and intermix into one species over millenia?  This is specifically about only humans, not humanoid aliens. I would prefer answers from the main canon or EU canon. Lightning Cancel Enqueued Server Side Action How to perform hard / cold reboot of iPhone or iPad? Show that $d_b(x,y)=\frac{d(x,y)}{1+d(x,y)}$ is a metric. where $(X,d)$ is a metric and $x,y \in X$.  I know we need to show:   non-negativity: $d(x,y)\geq$ 0 $d(x,y)=0$ if and only if $x=y$ symmetry: $d(x,y)=d(y,x)$ $d(x,z)\leq d(x,y) + d(y,z)$   I think we need to consider the derivative of $f(t)=\frac{t}{1+t}$ however I am not sure what to do next. I would like to use Class.newInstance() but the class I am instantiating does not have a nullary constructor. Therefore I need to be able to pass in constructor arguments. Is there a way to do this? Cardinality of the Cartesian Product of Two Equinumerous Infinite Sets Is the cardinality of the Cartesian product of two equinumerous infinite sets the same as the cardinality of any one of the sets? I couldn't find this explicitly stated in any handout or text. This certainly seems to be true from the examples I have seen:  The Cartesian product of two infinitely countable sets is again infinitely countable. The Cartesian product of two sets with cardinality of continuum again has cardinality of continuum. What does !function ($) { $(function(){ }) }(window.jQuery) do? Finding a 2x2 Matrix raised to the power of 1000 Let $A= \pmatrix{1&amp;4\\ 3&amp;2}$. Find $A^{1000}$.  Does this problem have to do with eigenvalues or is there another formula that is specific to 2x2 matrices?