math

Aligning matrices vertically as well as horizontally in LaTeX

I'm trying to accomplish this in LaTeX: ⎡a⎤ ⎡b … n⎤ ⎢⁞⎢ ⎢⁞ ⋱ ⁞⎢ ⎣x⎦ ⎣y … z⎦ [a … x] I'm able to get a vector + a matrix on one line, but I'm not sure how to align the vector below so that it sits perfectly under the large matrix. Here's a less-unicode text representation of the 'drawing' above: [a] [ b c ] [d] [ e f ] ...

What is the difference between "someValuesFrom" and "allValuesFrom"?

In description logic, what is the difference between "someValuesFrom" and "allValuesFrom"? In other words, the difference between (limited existential quantification) and (value restriction). For example, consider this: ∆ = {a, b, c, d, e} ext(B) = {<c,d>} ext(R) = {<a,b>, <a,c>, <d,c>, <c,e>} So what is the difference between t...

Decimal Value Check if Zero

I am trying to write a division method, which accepts 2 parameters. public static decimal Divide(decimal divisor, decimal dividend) { return dividend / divisor; } Now, if divisor is 0, we get cannot divide by zero error, which is okay. What I would like to do is check if the divisor is 0 and if it is, convert it to 1. Is there wa...

Guidance on Snap to Edge Effect

I'm having trouble wrapping my head around how to code this, and would appreciate any assistance. The picture above is something I googled quickly, but depicts a decent example. Imagine the squares and triangle are able to be moved around by the user. If the user drags and drops the BGFC square "near" the ABC triangle, I would like ...

Structure and Interpretation of Computer Programs, what level of maths ability is required?

Hi there, I regrettably haven't studied maths since I was 16 (GCSE level), I'm now a 27 year old c# developer. Would it be a fruitless exercise trying to work through this book? What kind of maths standard is expected of the reader? Thanks in advance for any replies! ...

Random number generator that produces a power-law distribution?

I'm writing some tests for a C++ command line Linux app. I'd like to generate a bunch of integers with a power-law/long-tail distribution. Meaning, I get a some numbers very frequently but most of them relatively infrequently. Ideally there would just be some magic equations I could use with rand() or one of the stdlib random functi...

Generating the function of the plane/surface that a given set of coordinates lie on...

This is something related with Mathematics as well. But this is useful in computing as well. Lets say you have 10 coordinates. (x1,y1)(x2,y2)..... in 2D Space. (i.e on a X-Y Plane). Can we find a single smooth curve going across the each coordinate. While expanding the question, If the space is 3D, then can we find an equation of a sm...

m-estimate for continuous values

I'm building a custom regression tree and want to use m-estimate for pruning. Does anyone know how to calculate that. http://www.ailab.si/blaz/predavanja/UISP/slides/uisp07-RegTrees.ppt might help (slide 12, how should Em look like?) ...

Float to String: What is an Exponent part?

Hi there ;-) I've written a small function in C, which almost do the same work as standart function `fcvt'. As you may know, this function takes a float/double and make a string, representing this number in ANSI characters. Everything works ;-) For example, for number 1.33334, my function gives me string: "133334" and set up special in...

How can I ensure that a division of integers is always rounded up?

I want to ensure that a division of integers is always rounded up if necessary, is there a better way than this, there is a lot of casting going on :-) (int)Math.Ceiling((double)myInt1 / myInt2) ...

The Math of a Jump in a 2D game.

I have been all around with this question and I can't find the correct answer! So, behold, the description of my question: I'm working in J2ME, I have my gameloop that do the following: public void run() { Graphics g = this.getGraphics(); while (running) { long diff = System.currentTimeMillis() - lastLoop; ...

Detecting and fixing overflows

Hi, we have a particle detector hard-wired to use 16-bit and 8-bit buffers. Every now and then, there are certain [predicted] peaks of particle fluxes passing through it; that's okay. What is not okay is that these fluxes usually reach magnitudes above the capacity of the buffers to store them; thus, overflows occur. On a chart, they loo...

algorithm for finding out pixel coordinates on a circumference of a circle

how do i find out pixel value at certain degree on the circumference of a circle if I know the pixel co-ordinates of the center of the circle, radius of the circle ,and perpendicular angle. Basically, I am trying to draw the hands of a clock at various times ( 1 o clock , 2 o clock etc ) ...

Rating architectural efficiency

How would you rate by numbers the efficiency of a certain design? What will be your variables? I can think of: Coupling Design Patterns use Language idioms use. Scalability. High-viability. Code Reuse. Flexibility. Robustness to errors. Testability. Design implications on resource use and memory. Portability. Usage of the correct pro...

Why modulo 65521 in Adler-32 checksum algorithm?

The Adler-32 checksum algorithm does sums modulo 65521. I know that 65521 is the largest prime number that fits in 16 bits, but why is it important to use a prime number in this algorithm? (I'm sure the answer will seem obvious once someone tells me, but the number-theory parts of my brain just aren't working. Even without expertise i...

Code Golf: Evaluating Mathematical Expressions

Challenge Here is the challenge (of my own invention, though I wouldn't be surprised if it has previously appeared elsewhere on the web). Write a function that takes a single argument that is a string representation of a simple mathematical expression and evaluates it as a floating point value. A "simple expression" may in...

Convert a number range to another range, maintaining ratio

I'm trying to convert one range of numbers to another, maintaining ratio. Maths is not my strong point. I have an image file where point values may range from -16000.00 to 16000.00 though the typical range may be much less. What I want to do is compress these values into the integer range 0-100, where 0 is the value of the smallest poin...

how to dynamically update UIlabel text in two UIViews Same Time?

hello all, i have two uiview's named question and answer. the question view is loaded from a cell's click. on the question view i have two iboutlet buttons named "view answer" and "next" when i click on button named "answer" the answerview loaded. both uiviews have one label.now i want to display a question when the first time question v...

Calculating the bounding points for the area of a "Pie Segment" and "sub areas"

Background: I was recently playing around with GDI+ to draw a "Disc" displaying a sweeping color change through 360 degrees. (I dug up some HSL to RGB code to loop through HSL(1,1,1) -> HSL(360,1,1)) Regarding the disc, I first drew a full solid circle using the above, and then a second circle in Grey over the center to give the follow...

Inaccurate Logarithm in Python

I work daily with Python 2.4 at my company. I used the versatile logarithm function 'log' from the standard math library, and when I entered log(2**31, 2) it returned 31.000000000000004, which struck me as a bit odd. I did the same thing with other powers of 2, and it worked perfectly. I ran 'log10(2**31) / log10(2)' and I got a round 3...