I have my own, very fast cos function:
float sine(float x)
{
const float B = 4/pi;
const float C = -4/(pi*pi);
float y = B * x + C * x * abs(x);
// const float Q = 0.775;
const float P = 0.225;
y = P * (y * abs(y) - y) + y; // Q * y + P * y * abs(y)
return y;
}
float cosine(float x)
{
return sine...
Hello!
I need to develop a program in Java to solve some integrals. Integrals like this:
I've looked for some functions to do this, in java.Math but I didn't find anything.
Has anyone an idea to get a solution for this? (maybe some extra libraries or something like that)
Thanks a lot!!
...
The general problem is projecting a polygon onto a plane is widely solved, but I was wondering if anybody could make some suggestions for my particular case.
I have a planar polygon P in 3-space and I would like to project it onto the plane through the origin that is orthogonal to the unit vector u. The vertices of P and the coordinates...
Based on the documents
http://www.gnu.org/software/gsl/manual/html_node/Householder-Transformations.html
and
http://en.wikipedia.org/wiki/Householder_transformation
I figured the following code would successfully produce the matrix for reflection in the plane orthogonal to the unit vector normal_vector.
gsl_matrix * reflection = gsl...
is there common code available that produces square, triangle, sawtooth or any other custom waveforms using the math class?
below is a basic function that handles a SampleDataEvent and plays a middle-c (440 Hz) sine wave. i'd like to change the tone by incorporating square, triangle and other waves.
var position:int = 0;
var sound:So...
I have following code:
template<typename I,typename O> O convertRatio(I input,
I inpMinLevel = std::numeric_limits<I>::min(),
I inpMaxLevel = std::numeric_limits<I>::max(),
O outMinLevel = std::numeric_limits<O>::min(),
O outMaxLevel = std::numeric_limits<O>::max() )
{
double inpRange = abs(double(inpMaxLevel - inpMi...
Hi,
Python's math module contain handy functions like floor & ceil. These functions take a floating point number and return the nearest integer bellow or above it. However these functions return the answer as a floating point number. For example:
In [1]: import math
In [2]: f=math.floor(2.3)
In [3]: f
Out[3]: 2.0
What is the safest w...
Okay, I am looking for something akin to integral images (summed area tables) as used in the acceleration of integral calculations over a window.
I have an image I and its gradient image G. I want to calculate the straight line integral from two arbitrary points a and b in the image of the absolute value of G. Obviously I can step over...
I am working with a large amount of time series.
These time series are basically network measurements coming every 10 minutes, and some of them are periodic (i.e. the bandwidth), while some other aren't (i.e. the amount of routing traffic).
I would like a simple algorithm for doing an online "outlier detection". Basically, I want to kee...
What I mean by bandwagon effect describes itself like so:
Already top-ranked items have a higher tendency to get voted on at all, possibly even to get upvoted.
What I am hoping to get is some concrete recommendations, at best based on your practical experience with a mathematical formula and in which situation it helped.
However, any u...
How can I implement the rightrotate (and leftrotate) operations on 32 bit integers without using any bitwise operations?
I need this because High Level Shader Language (HLSL) does not allow bitwise oeprations upon numbers, and I need rightrotate for a specific shader I'm trying to implement.
...
$total = 30 - $nr1 / 13 - $nr2 - 6 * $nr3 - 3
I know we learned that in school but what is first (+ or - or * or /), where are the brackets or do i even need them ?
...
For example, I have 4800 and I would like to see all the divisors of this number.
# num = the number you want factors of
def divisors_of(num)
(1..num).collect { |n| [n, num/n] if ((num/n) * n) == num}.compact
end
divisors_of(4800)
=> [[1, 4800], [2, 2400], [3, 1600], [4, 1200], [5, 960], [6, 800], [8, 600], [10, 480], [1...
Say we have a list of rooms with their capacities and a list of meetings with the number of attendees. We want to match each meeting with one room in the following way:
A meeting can only be scheduled in a room with capacity equal to or greater than its attendance.
If surplus rooms are present, meetings should be scheduled so that the ...
Hi,
Does anybody know (or may point to some source to read about) a method or algorithm to convert a number represented in binary numeral system into the ternary one (my particular case), or universal algorithm for such conversions?
The solution I've already implemented is to convert a number to decimal first and then convert it into r...
Hey all, i am trying to figure out how to calculate the wage for an employee when they clock out. This is the code i am currently using:
Dim theStartTime As Date
Dim theEndTime As Date
Dim totalTime As String
theStartTime = "16:11:06"
theEndTime = "18:22:01"
totalTime = Format(CDbl((theEndTime - theStartTime) * 24), "#0.0")
So ...
Given this joint probability distribution, I need to figure out P(Cavity | Toothache OR Catch).
I know that
P(Cavity | Toothache OR Catch) = P(Cavity AND (Toothache OR Catch)) / P(Toothache OR Catch)
but I'm not sure how to solve the numerator here.
Thanks.
...
i have two spatial xyz file with different resolution
how can i contour a composition of both files
i like working with R or open source geographical systems like GMT
if u know of a different way of solving this i would be glad to listen
...
I have to convert a floating point to 32-bit fixed point in Java .
Not able to understand what is a 32-bit fixed point ?
Can any body help with algorithm ?
...
I am using some code to subtract one date from another using XSLT 2.0:
<xsl:template match="moveInDate">
<xsl:value-of select="current-date() - xs:date(.)"/>
</xsl:template>
This works, however it leaves me with an answer of P2243D, which I assume corresponds to a "Period of 2243 Days" (which is correct in terms of the math).
Sin...