math

PHP giving wrong calcuation

Trying to work out distance between two points (lat & lng) I have an issue because PHP is (after running through my distance function) returning the same distance regardless. I break it down and I find that PHP has an issue with some maths For this example, assume: Lat2: 49.263205 So, I want to convert lat2 to a radian $pi = pi(); $r...

Pure java implementation of the java.lang.Math class

I just downloaded the openjdk source and came to the realization that nearly all of the java.lang.Math class was implemented in native c/c++ code. I was wondering if there were any implementations that were fully written in java. ...

first n digits of an exponentiation

How do i determine the first n digits of an exponentiation (ab). eg: for a = 12, b = 13 & n = 4, the first 4 digits are 1069. ...

How to create an algorithm type?

Say I have two sequences of numbers, A and B. How can I create an object to describe the relationship between the two sequences? For example: A: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9... B: 0, 2, 4, 6, 8, 10, 12, 14, 16, 18... B = 2A The relationship, f() is how we get from A to B. But given two arbitrary sequences, how can I construct...

trying to understand string permutations?

I found this sweet code here: http://geeksforgeeks.org/?p=767 the source link: http://mathworld.wolfram.com/Permutation.html ok how do I even begin to understand these codes? how do I start coding like this? I have encountered many such codes...using dynamic programming, backtracking, branch and bound...and understood squat. even if u ...

What sort of Math do I need to create software in the Oil and Gas Industry?

I'm interested in working in the Oil and Gas Industry as a Software Engineer. What sort of Math is commonly required to work in this industry? Any first hand experience would be beneficial. ...

[Java] Question on how to refer to two specific objects in a method

So basically, we create four lines. One is created by giving a point (x,y) and the slope, the second is created by giving two points (x1, y1) and (x2,y2), the third is created as an equation in slope intercept form y=mx+b, and the fourth is given as an equation x=a with the line being vertical. To do that, we create four constructors. T...

how to transform a sphere to a hemisphere, smoothly

Hi all, I am using a 3rd-party "rotator" object, which is providing a smooth, random rotation along the surface of a sphere. The rotator is used to control a camera (see rotator.h/c in source code for xscreensaver). The output of the rotator is latitude and longitude. What I want is for the camera to stay above the "equator" - thus lim...

Finding the y-axis for points on a line graph made with PHP's imageline()

I'm making a line graph with PHP using imagecreate() and imageline(). Im' trying to figure out how to do the calculation to find the y-axis for each point on the graph. Here are a few values that would go in the graph: $values[jan] = .84215; $values[feb] = 1.57294; $values[mar] = 3.75429; Here is an example of the line graph. The x-a...

Amazon Kindle For Reading Technical Material

Possible Duplicate: Is the Amazon Kindle suitable for programming books? What are peoples thoughts on the new Kindle for reading technincal and math books? Are they worth it? Its a shame you cant pop into a store and give them a whirl ...

How can I represent math variables in c#?

Hi, I need to represent these mathematical equations in code and to solve them: 2x = 3y 3y = 4z 2x + 3y + 4z = 1 Please advise. Thanks, Oz ...

Ruby Curve Fitting (logarithmic regression) package

I am looking for a Ruby gem or library that does logarithmic regression (curve fitting to a logarithmic equation). I've tried statsample (http://ruby-statsample.rubyforge.org/), but it doesn't seem to have what I'm looking for. Anybody have any suggestions? ...

Basic math operations with HUGE numbers

By huge numbers, I mean if you took a gigabyte (instead of 4/8 bytes etc.) and tried to add/subtract/multiply/divide it by some other arbitrarily large (or small) number. Adding and subtracting are rather easy (one k/m/byte at a time): out_byteN = a_byteN + b_byteN + overflowBit For every byte, thus I can add/subtract as I read the ...

Looking for a software package that finds the roots of complex functions.

Hi, As the title says I'm looking for a software package that computes the roots of complex functions. Languages: C/C++/C# Platform: Windows Functions: cos, sin, exp, log. Thanks. ...

How can I find the rotation of a quad in 3D ?

I have coordinates for 4 vectors defining a quad and another one for it's normal. I am trying to get the rotation of the quad. I get good results for rotation on X and Y just using the normal, but I got stuck getting the Z, since I've used just 1 vector. Here's my basic test using Processing and toxiclibs(Vec3D and heading methods): im...

Determine the optimal combination of coins for a dollar amount

I need to find the most optimal combination of coins that makes up a certain dollar amount. So essentially, I want to use the least amount of coins to get there. For example: if a currency system has the coins: {13, 8, 1}, the greedy solution would make change for 24 as {13, 8, 1, 1, 1}, but the true optimal solution is {8, 8, 8}. I ...

java based math libarary to handle multiple math scenarios

We are planning to do something similar to what is available in this site AAAMath. We would like to generate sample questions which will add / mult / div / sub (either 2 numbers or 3 numbers or one of the numbers could be a constant ..). Would like to know if there are any libraries which provide a higher level abstraction on the above b...

Difference between constrained optimization and unconstrained optimization problems?

What is the property that makes an optimization problem unconstrained? ...

I'm new to python, and trying to program a sales tax button for a calculator.

Hello, I just started programming in python not long ago, and I'm having trouble figuring out the rounding issue when it comes to tax and money. I can't seem to get decimals to always round up to the nearest hundredths place. for instance, in our state, sales takes is 9.5%, so a purchase of 5 dollars would make tax $.48, but in realit...

Online algorithm for calculating absolute deviation

I'm trying to calculate the absolute deviation of a vector online, that is, as each item in the vector is received, without using the entire vector. The absolute deviation is the sum of the absolute difference between each item in a vector and the mean: I know that the variance of a vector can be calculated in such a manner. Va...