## Mathematica matrix diagonalization

What you need to do is normalize the answer you get. There is a function called Normalize, which can be used like this:

## Rotating a Vector in 3D Space

If you want to rotate a vector you should construct what is known as a rotation matrix. Rotation in 2D Say you want to rotate a vector or a point by θ, then trigonometry states that the new coordinates are To demo this, let’s take the cardinal axes X and Y; when we rotate the X-axis 90° counter-clockwise, …

## Round *UP* to the nearest 100 in SQL Server

The following should work. After reading your question, I’m not exactly sure what you want 100 to return. For this 100 returns 100. This gives the following results:

## Probability of hash collision

Let’s imagine we have a truly random hash function that hashes from strings to n-bit numbers. This means that there are 2n possible hash codes, and each string’s hash code is chosen uniformly at random from all of those possibilities. The birthday paradox specifically says that once you’ve seen roughly √(2k) items, there’s a 50% chance …

## How to save decimal in java

Initialize your variable with an expression that evaluates to a double rather than an int: Otherwise the expression is done using integer arithmetic (which ends up truncating the result). That truncated result then gets converted to a double.

## What is the maximum number of edges in a directed graph with n nodes?

If you have N nodes, there are N – 1 directed edges than can lead from it (going to every other node). Therefore, the maximum number of edges is N * (N – 1).

## Inverse Cosine in Python

We have the acos function, which returns the angle in radians.

## Inverse of Tan in python (tan-1)

math.atan(x) returned in radian, if you want degree, convert it using math.degrees(x)

## How can I convert a number from base 8 to base 10?

To convert any base to base 10 just do the following: For every digit in the different base multiply that by the base and digit. For example: Works for any base … binary, hex, you name it just do that and it will convert to base 10.

## What is the most efficient way to calculate the least common multiple of two integers?

The least common multiple (lcm) of a and b is their product divided by their greatest common divisor (gcd) ( i.e. lcm(a, b) = ab/gcd(a,b)). So, the question becomes, how to find the gcd? The Euclidean algorithm is generally how the gcd is computed. The direct implementation of the classic algorithm is efficient, but there are variations that take advantage of binary …