math

Good reference of color-modifying functions?

Hello, everyone! I can't find a good reference about color-modifying functions (such as contrast, brightness, gamma, ...). (Is there a more exact term for what I mean?) Would appreciate a tutorial with example pictures and implementation algorithms. Thank you! EDIT: Platform and language is not so important. I'm interested in pure m...

Math for core animation?

What is a good level of math required for, like, advanced core animation? Take this for example: http://cocoadex.com/2008/01/lemur-math.html And what's a good book/resource to learn it? -Jason ...

LaTeX Page Size --- how do I produce a page that is "just big enough"?

Hi, I was learning about using the command line version of latex today, and I was experimenting with outputting .tex to .dvi, and then .dvi to .png. The problem is, I have a simple .tex document which contains some math. The goal is to eventually produce a png form of the equation. But when I run: $ latex -output-format=dvi test.tex $...

Area of intersection of n circles each having radius 'r'.

Prob Statement: 'N' equii radii circles are plotted on a graph from (-)infinity to (+)infinity.Find the total area of intersection i.e all the area on the graph which is covered by two or more circles. Please refer to the below image for better view. ...

What is wrong with my algorithm?

Alright, I've cooked up some code to reverse hex characters around as part of a fun exercise I made up. Here is what I have at the moment: #include <stdio.h> int main() { char a,b,c; while (1) { c = getchar(); if (!feof(stdin)) { a = c % 16; b = (c - a) / 16; c...

Smallest sum of pairs

Given 2N-points in a 2D-plane, you have to group them into N pairs such that the overall sum of distances between the points of all of the pairs is the minimum possible value.The desired output is only the sum. In other words, if a1,a2,..an are the distances between points of first, second...and nth pair respectively, then (a1+a2+...an...

Knowing two points of a rectangle, how can I figure out the other two?

Hey there guys, I'm learning processing.js, and I've come across a mathematical problem, which I can't seem to solve with my limited geometry and trigonometry knowledge or by help of Wikipedia. I need to draw a rectangle. To draw this rectangle, I need to know the coordinate points of each corner. All I know is x and y for the midpoints...

AI: selecting immediate acceleration/rotation to get to a final point

I'm working on a game where on each update of the game loop, the AI is run. During this update, I have the chance to turn the AI-controlled entity and/or make it accelerate in the direction it is facing. I want it to reach a final location (within reasonable range) and at that location have a specific velocity and direction (again it doe...

round number in JavaScript to N decimal places

in JavaScript, the typical way to round a number to N decimal places is something like: function round_number(num, dec) { return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec); } However this approach will round to a maximum of N decimal places while I want to always round to N decimal places. For example "2.0" would be r...

In java - Grouping similar values

Hi All, First of all,thanks for reading my question. I used TF/IDF then on those values, I calculated cosine similarity to see how many documents are more similar. You can see the following matrix. Column names are like doc1, doc2, doc3 and rows names are same like doc1, doc2, doc3 etc. With the help of following matrix, I can see that...

Does F# have free functions?

Does every function has to be inside a type like in C#? Or does F# has free functions? Also what about functions I have seen all over some F# code like, cos, sin, etc. Are they calls to Math.Cos, Math.Sin? Also why did they provide cos, sin, etc like that instead of Math.Cos, Math.Sin? ...

Guarded Equations in Haskell

Can somebody provide me with an easy to understand explanation of a guarded equation as it is used in Haskell and also its mathematical sense? ...

Does F# have generic arithmetic support?

Does F# have the same problem as C# where you can't directly use arithmetic operators with generic T types? Can you write a generic Sum function that would return the sum of any value that supports the arithmetic addition? ...

Why does .Net use a rounding algorithm in String.Format that is inconsistent with the default Math.Round() algorithm?

I've noticed the following inconsistency in C#/.NET. I was wondering why it is so. Console.WriteLine("{0,-4:#.0} | {1,-4:#.0}", 1.04, Math.Round(1.04, 1)); Console.WriteLine("{0,-4:#.0} | {1,-4:#.0}", 1.05, Math.Round(1.05, 1)); Console.WriteLine("{0,-4:#.0} | {1,-4:#.0}", 1.06, Math.Round(1.06, 1)); Console.WriteLine("{0,-4:#.0} | {1,...

Optimising a haversine formula SQL call in PHP

I'm creating an MySQL call using PHP, I'm calculating distance using the haversine forumula: SELECT name, id, (6371 * acos(cos(radians(' . $lat . ')) * cos(radians(geoname.latitude)) * cos(radians(geoname.longitude) - radians(' . $lon . ')) + sin(radians(' . $lat . ')) * sin(radians(geoname.latitude)))) AS distance ...

What's a good library for parsing mathematical expressions in java?

I'm an Android Developer and as part of my next app I will need to evaluate a large variety of user created mathematical expressions and equations. I am looking for a good java library that is lightweight and can evaluate mathematical expressions using user defined variables and constants, trig and exponential functions, etc. I've look...

With IEEE-754, 0 < ABS(const) < 1, is (x / const) * const guaranteed to return distinct results for distinct values of X?

Assume I do this operation: (X / const) * const with double-precision arguments as defined by IEEE 754-2008, division first, then multiplication. const is in the range 0 < ABS(const) < 1. Assuming that the operation succeeds (no overflows occur), are distinct arguments of X to this operation guaranteed to return distinct results? I...

OSCommerce Product Listing Shows Inaccurate Count and Results Per Page

http://www.roguevalleyroses.com/rose_list.php?search_id=&amp;class=&amp;height=&amp;growth=&amp;color=&amp;bloom_size=&amp;bloom_type=&amp;shade=&amp;fragrance=&amp;disease=&amp;rebloom=&amp;thorns=&amp;zone=&amp;hybridizer=Ashdown%20Roses&amp;date_range=&amp;text=&amp;view=&amp;show=&amp;page=4 This is the page. The code that queries ...

Will using modulus favour high numbers?

Will adding 6 random unique numbers in the range 0-32 and doing a modulus on the result favour a high number? Example: 9 +10 +11 +18 +25 +28 +32 = 133 % 20 = 13 ...

What's that elegant modulo that I can't figure out?

What's a good way to determine the following. You have a table of game players, in an array of size N. Each round, each player takes a turn. You know the index of the player that should go first, and each player will take a turn ascending the array, and looping back to 0 when it hits the last index. For example, if player at index 3 we...