Hi, first question here, apologies in advance for any foul-ups.
I'm implementing an interpreter for a toy language in C#, and in order to do math in that language I'd like to implement a function like this:
public static object Add( object a, object b )
{
// return the sum of a and b
// each might be int, double, or one of many oth...
Hi I've been doing some research about matrix inversion (linear algebra) and I wanned to use c++ template programming for the algorithm , what i found out that there are number of methods like: Gauss-Jordan Elimination or LU Decomposition and I found the function LU_factorize (c++ boost library)
I want to know if there were other metho...
I have a function that takes a floating point number and returns a floating point number. It can be assumed that if you were to graph the output of this function it would be 'n' shaped, ie. there would be a single maximum point, and no other points on the function with a zero slope. We also know that input value that yields this maximu...
I have a method that converts an int to a base60 string (using 0-9, a-z, and A-Z chars), but can't work out how to convert it back again. Here is my method for converting base10 to base60:
public static function toBase60(value:Number):String
{
var targetBase:uint = 60;
value = value.toString().split('.')[0];
var digits:Arra...
I am in the process of writing a fairly long monograph on a computer science topic. However, I usually find myself in a position of having to write some computer science concept in mathematical terms, and it is difficult to me. For instance, say I want to write a for-loop or a void function. I do most of the time go to my Knuth or Cormen...
Hi,
As mentioned above. I give one example, let's say all the test values are less than 1 but greater than 0.
0.12 (precision: 3, scale:2)
0.345 (precision: 4, scale:3)
0.6789 (precision: 5, scale:4)
how do i convert those value without hard-coding the scale and precision value.
0.12 -> 12
0.345 -> 345
0.6789 -> 6789
for 0.1 and...
Greetings,
googling for that subject brings, e.g., MTL, exmat, LAPACK and also here. I also seem to remember that Microsoft Research released one, but can't put my hands on it.
I look for advice from someone who actually used (or developed...) one of those, hoping to achieve a Matlab experience inside C++ (as much as possible).
Thanks in...
I have written some page turning software simulating a magazine. Currently the speed of the page turning is linear, and I want to make it more realistic with acceleration and deceleration.
At the start of the animation it should be slow, half way through it should have reached max speed, then it returns to a slow speed by the end of th...
I have a percentage, it ranges from 50% to 0%.
I need the values to be mirrored, so:
0% now equals 50%
1% = 49%
25% = 25%
48% = 2%
50% = 0%
etc.
Thanks for any help!
...
Hi folks.
I'm currently implementing a software that measures certain values over time. The user may choose to measure the value 100 times over a duration of 28 days. (Just to give an example)
Linear distribution is not a problem, but I am currently trying to get a logarithmical distribution of the points over the time span.
The str...
I need an algorithm that identifies all possible combinations of a set of numbers that sum to some other number.
For example, given the set {2,3,4,7}, I need to know all possible subsets that sum to x. If x == 12, the answer is {2,3,7}; if x ==7 the answer is {{3,4},{7}} (ie, two possible answers); and if x==8 there is no answer. Note t...
Hi,
I have two Lines: L1 and L2. I want to calculate the angle between the two lines. L1 has points: {(x1, y1), (x2, y2)} and L2 has points: {(x3, y3), (x4, y4)}. How can I calculate the angle formed between these two lines, without having to calculate the slopes? The problem I am currently having is that sometimes I have horizontal lin...
Hi, I'm trying to write a method that interpolates from 0 to x (position of an object in one dimension) over time using acceleration at the beginning and deceleration at the end (ease out / ease in) with the only constraints that the total time is provided, as well as the duration of the acceleration and deceleration. the motion should r...
Hi,
I have had this problem for a while, still trying to work on a solution.
What is the best possible method for evenly distributing items in a list, with a low discrepancy?
Say we have a list or elements in an array:
Red, Red, Red, Red, Red, Blue, Blue, Blue, Green, Green, Green, Yellow
So ideally the output would produce someth...
Hi,
PHP converts a large number to floating point which I need in "long" format to pass to a soap xml api.
((round(time()/(60*15))*60*15)+(30*60))*1000
This gives the result:
1.28E+12
Whereas, what I need is:
"1280495700000"
in order to pass to the api
...
Setup:
I have a boolean matrix e.g.
1 0
1 1
0 1
where rows are named m1, m2, m3 (as methods) and columns t1 and t2 (as tests).
Definition:
An explanation is a set of rows (methods) which in union have at least one "1" in any column (every test hast to be matched by at least one method).
in our example, the set of explanations ...
Does anyone know where I could find a library of code for converting Lat/Lon position to Military Grid Reference System (MGRS)? I'm looking for a C# implementation if possible.
...
Hi,
I have a basic question for all of the math experts out there.
"If I have an academic paper, whats the easiest way to convert a simple mathematical equation into working Matlab (or C++) code?"
Ideally, there would be a Latex >> Matlab (or C++) conversion tool.
However, failing this, is there a "cheat sheet" which contains all of ...
If I have 177 items, and each page has 10 items that means I'll have 18 pages.
I'm new to python and having used any of the math related functions.
How can I calculate 177/10 and then get round up so I get 18 and not 17.7
...
I'm trying to build a "simple" web app that calculates either a male or females body fat % based on the U.S. Navy's circumference formula. I have the majority of the app completed at this point. However, I cannot figure out why the way I've setup the formula below won't work. Two of the values are underlined in red in my .cs file.
My...