math

Math average with php

Time to test your math skills... I'm using php to find the average of $num1, $num2, $num3 and so on; upto an unset amount of numbers. It then saves that average to a database. Next time the php script is called a new number is added to the mix. Is there a math (most likely algebra) equation that I can use to find the average of the o...

Math, circles, interior points and densities

The theory is this: I have a circle C of radius R and centre S. Inside this circle, I want to place N (a "big" number) points such that the density of points in the vicinity V of a point P is equal everywhere in the circle for all points. As N goes to infinity and the vicinity goes to P, the density function in both polar and cartesian c...

J Language for learning math - "Math for the Layman"

Working programmer looking for a math refresher or just developing mathematical thinking. Saw J Language http://www.jsoftware.com/jwiki/Books The book "Math for the Layman" claims that the J language makes math easier to learn by providing interactive tools and simpler notation than conventional math. Can someone confirm this from exper...

Pattern Matching in Java

I'm working on java program that can compute the differentiation of any given mathematical expression. When User types the expression say Sin(Cos(x^2)) I need to check whether it is mathematically valid or not. Of course we can do it by manual code writing but that would be tedious work. Can I do it using regex package of java?? How?? ...

What is affine invariant?

What is affine invariant? Please explain affine invariant intuitively. ...

WPF 3D - rotate a model around it's own axes

Suppose I have a simple WPF 3D scene set up with a single rectangle rotated -45 degrees around the X axis like so: <Viewport3D> <Viewport3D.Camera> <PerspectiveCamera Position="0,0,4"/> </Viewport3D.Camera> <ModelVisual3D> <ModelVisual3D.Content> <DirectionalLight Color="White" Direction="-1,-1,-3...

Math Libraries for iPhone

Not wanting to re-invent the wheel, are there any open-source (or included) math libraries in Objective-C (for iPhone) that can calculate Internal Rate of Return (IRR) or Modified Internal Rate of Return (MIRR)? I'd hate to have to re-do all that work if someone out there has already done it. Thanks! ...

PHP Add up a series of minutes:seconds

I have a list of video segment durations I need to add up to get the total duration. The series is like this: 0:33 4:30 6:03 2:10 ...etc I need to add up the minutes and seconds to get a total video duration. Here's the modified function of my accepted answer: function getTotalDuration ($durations) { $total = 0; foreach...

Minimum area quadrilateral algorithm

There are a few algorithms around for finding the minimal bounding rectangle containing a given (convex) polygon. Does anybody know about an algorithm for finding the minimal-area bounding quadrilateral (any quadrilateral, not just rectangles)? I've searched the internet for several hours now, but while I found a few theoretical papers...

Javascript Radio Button Count and Calculation for Questionnaire

Hi, I am trying to create a simple questionnaire for a website but am fairly new to javascript and html I do have a basic function to calculate a percentage and have created the html form with radio buttons and a submit button There will be about 20 questions in the questionnaire which will have yes/no radio buttons. What I need to d...

Generating triangular/hexagonal coordinates (xyz)

I'm trying to come up with an iterative function that generates xyz coordinates for a hexagonal grid. Maths has never been easy for me (I'm just not very clever!) and this problem has me stumped. With a starting hex position (say 0,0,0 for simplicty) I want to calculate the coordinates for each successive "ring" of hexagons, as illustrat...

Do math functions of constant expressions get pre-calculated at compile time?

I tend to use math functions of constant expressions for convinience and coherence (i.e log(x)/log(2) instead of log(x)/0.3...). Since these functions aren't actually a part of the language itself, neither are they defined in math.h (only declared), will the constant ones get precalculated at compile time, or will they be wastefully calc...

Calculating fourier transform at any frequency

I know that if we have some data representing some wave, for example image line values, we can use fourier transform to get frequency function of that wave. But we have N values at points x=0...N-1 And we get only N frequencies at the output. So I want to analyze the wave everywhere in the range [0, N-1] For example at point u = 1.5. ...

How to determine a point in a triangle?

Hi all Is there an easy way to determine if a point inside a triangle? It's 2D not 3D. Best Regards, ...

Matlab - Find point of intersection between two vectors

I have a very simple matlab question. What is the easiest way to find the point of intersection between two vectors. I am not familiar with the various matlab fuctions -- it seems like there should be one for this. For example if I have one vector from (0,0) to (6,6) and another vector from (0,6) to (6,0), I need to determine that they ...

Calculus, How can you find an equation from a series of numbers?

I'm analyzing financial data and would like to find the inflection points of a line. I know I can do this using derivatives, but first I need an equation. Is there are way to generate an equation based off of a series of numbers. I would need to do this programmaticly. ...

function to calculate total sale amount

I have a product that sells in a strange way. The formula to get the current price is: total_products_sold * 0.05 I need a function that will return the total sales value, given a total_products_sold value. This needs to figure out all past pricing, using the above formula. e.g. if I sold 3 products, the total sales amount is: 1 * ...

Want to improve math skills for programming

I have just started programming with Java and noticed I might need to improve my math skills if i'm to do anything worthwhile with it. I just noticed that some of the exercises should be easy for someone with a solid understanding in math as there seems to be some math formulae running the show. I finished high school two years ago and d...

Where can I find line buffering code?

I can't find any code for doing this. The only places I can find it is in GIS APIs. Preferably in java, but I can port other languages too. I'd even settle for a overview of all the formulas required. ...

C# Efficient Algorithm Integer Based Power Function

I am looking at http://stackoverflow.com/questions/101439/the-most-efficient-way-to-implement-an-integer-based-power-function-powint-int. This is the answer they got. I am trying to make it work for C# but I am getting comparing int to bool and all this other stuff. . . and I can't figure out why they are comparing & 1 wouldn't that me...