I have an arbitrary function or inequality (consisting of a number of trigonometrical, logarithmical, exponential, and arithmetic terms) that takes several arguments and I want to get its range knowing the domains of all the arguments. Are there any Java libraries that can help to solve a problem? What are the best practices to do that? ...
According to Daniel, in his answer, there is no easy way to modify the below function so I bit the bullet and started from scratch. Solution is below (as an answer). Actually, ignore my answer. See Tom Sirgedas' answer it's a lot shorter.
I need to modify the solution found here: http://stackoverflow.com/questions/1343346/calculate-a...
Basically this script will subtract StartTime from EndTime, using a jQuery plugin the html form is populated with Start and End Time in the format HH:MM, an input field is populated with the result, it works except for one issue:
If Start Time is between 08:00 and 09:59 it just returns strange results - results are 10 hours off to be pr...
I have 3 points colored H1, H2, and H3, where each Hi is has 100%
saturation and value, and only the hue varies. In other words, these
are "rainbow" colors.
I want to use SVG's gradient function to color the triangle
"naturally". In other words, points close to H1 should have hue H1,
the coloring should be continuous, etc.
Is thi...
I want to learn Algorithms and become fluent in them. My goal is to land a job as a Software Development Engineer at either Google or Microsoft. I've been recommended to use the book "Introduction to Algorithms" by Cormen.
But I feel like the book is not for beginners.
Can anyone recommend a book on Algoritms that I can find easier ? o...
Hi,
I am writing a small utility for calculating a complicated mathematical formula (using commons-math library for integration and root finding). I was trying to write it in the same way as a normal business application, however I found that I am getting a quickly increasing number of classes. To get the first step of the calculations ...
Background: I have a function in my program that takes a set of points and finds the minimum and maximum on the curve generated by those points. The thing is it is incredibly slow as it uses a while loop to figure out the min/max based on approximated error. Not completely sure what formal method this is because I did not write it myself...
Hi, I am working on a project that does a lot of querying and the some mathematical modeling based on results from these queries, and finally some scoring (read: "execution time too long to test thoroughly").
Recently I have realized a rather new problem/bug in my code; some of the results get NaN values for score! Here's how the score...
Currently I am interning at a software company and one of my tasks has been to implement the recognition of mouse gestures. One of the senior developers helped me get started and provided code/projects that uses the $1 Unistroke Recognizer http://depts.washington.edu/aimgroup/proj/dollar/. I get, in a broad way, what the $1 Unistroke Re...
Hi,
I'm trying to figure out how to implement RSA crypto from scratch (just for the intellectual exercise), and i'm stuck on this point:
For encryption, c = me mod n
Now, e is normally 65537. m and n are 1024-bit integers (eg 128-byte arrays). This is obviously too big for standard methods. How would you implement this?
I've been rea...
Why doesn't this work?
@echo off
for /l %%i in (0, 1, 100) do (
for /l %%j in (0, 1, 10) do (
set /a curr=%%i*10 + %%j
echo %curr%
)
echo "-----------------------------"
)
This is the output I get from this:
1010
1010
1010
1010
1010
1010
1010
1010
1010
1010
1010
"----------------------------"
1010
1010
10...
I'm looking for an extended answer to the question asked here:
http://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap
where any of the dates in either date range can be null. I've come up with the following solution, but I'm not sure if it can be simplified further.
(StartA == NULL || StartA <= EndB) &&
(E...
function setValue() {
var startTime = document.getElementById('ToilA');
var endTime = document.getElementById('EndHours'); startTime = startTime.value.split(":");
var startHour = parseInt(startTime[0], 10);
var startMinutes = parseInt(startTime[1], 10);
endTime = endTime.value.split(":");
var endHour = parseInt(endTime[0], 10);
va...
Hi, I am thinking recently on how floating point math works on computers and is hard for me understand all the tecnicals details behind the formulas. I would need to understand the basics of addition, subtraction, multiplication, division and remainder. With these I will be able to make trig functions and formulas.
I can guess something...
Hey All,
I was just wondering if there's a way to generate many different combinations of numbers and letters, based off of just one number/letter? For example:
From just this one String:
234jk43fc7898cfg58
We could generate MANY different combos like:
HGYTD786Gjhghjg76fghf8
8976sgh8976
cv34905bv7
435bv4875bvg487bv
45b6467ne456n
4n5...
I need to obtain the supplement of an angle.
Exactly what I need to do is to implement some kind of code that mirror the angle, let's say, I have 45 degrees -> 135, another example: 80 ->100, 0 degrees -> 180, and so on.
Solved: I implemented this just a moment ago, and it worked perfectly, I use 180 - angle if angle < 180, and 360 - a...
Is it possible to easily round a figure up to the nearest 100 (or 1000, 500, 200 etc.) in SQL Server?
So:
720 -> 800
790 -> 800
1401 -> 1500
...
This is what I am doing, which works 99.999% of the time:
((int)(customerBatch.Amount * 100.0)).ToString()
The Amount value is a double. I am trying to write the value out in pennies to a text file for transport to a server for processing. The Amount is never more than 2 digits of precision.
If you use 580.55 for the Amount, this lin...
So given the following program:
Is the time complexity of this program O(0)? In other words, is 0 O(0)?
I thought answering this in a separate question would shed some light on this question.
EDIT: Lots of good answers here! We all agree that 0 is O(1). The question is, is 0 O(0) as well?
...
Implement Biginteger Multiply
use integer array to store a biginteger
like 297897654 will be stored as {2,9,7,8,9,7,6,5,4}
implement the multiply function for bigintegers
Expamples: {2, 9, 8, 8, 9, 8} * {3,6,3,4,5,8,9,1,2} = {1,0,8,6,3,7,1,4,1,8,7,8,9,7,6}
I failed to implement this class and thought it for a few weeks, couldn't get...