540 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-3
votes
3
answers
277
views
Taylor Series in Java using float [closed]
I am implementing a method berechneCosinus(float x, int ordnung) in Java that should approximate the cosine of x using the Taylor series up to the specified order.
My questions:
Can I optimize the ...
4
votes
1
answer
135
views
floating-point implementation of a function with removable singularity
Consider the following function:
ƒ(x) = sin(sqrt(x)) / sqrt(x) if x > 0
ƒ(x) = 1 if x = 0
ƒ(x) = sinh(sqrt(-x)) / sqrt(-x) if x < 0
This is an entire function with a Taylor series at 0 of: 1/1!...
8
votes
2
answers
773
views
Sine approximation, did i beat Remez?
First, it is most compact sine approximation ever. It seems i can do better than Remez in terms of precision/performance. Here [0,pi/2] approximation range.
double p[] =
-0.0020836519336891552,
-0....
0
votes
2
answers
159
views
how to approximate 2^x and log2(x) where x is an FP number [closed]
I have 2 approximations for both functions, however the log2(x) takes in an FP number, and outputs a fixed point number; and the 2^x takes in an integer, and outputs a floating point number.
the ...
2
votes
1
answer
163
views
Maximum the sum of lengths of two nondecreasing subsequence of given array
It is a famous question which asked about finding longest nondecreasing subsequence from a given array. The question is well studied and have O(n log n) time complexity solutions.
I have encountered a ...
2
votes
1
answer
98
views
How can I approximate 255/sqrt(x) using Newton's method?
I am trying to approximate 255 / sqrt(x) using Newton's method to avoid using division or the sqrt() operation on an architecture where those operations are expensive.
My derivation is:
y = 255 / sqrt(...
2
votes
2
answers
193
views
Approximating logarithm using harmonic mean
Here is a function to approximate log10(x+1) for (x+1) < ~1.2:
a = 1.097
b = 0.085
c = 2.31
ans = 1 / (a - b*x + c/x)
It should look like that:
It works by adjusting harmonic mean to match log10,...
1
vote
2
answers
186
views
Problem with least squares rational approximation to `asin(x)+ sqrt(1-x^2)` in [3,1] form
I'm trying to generate a decent [3,1] rational least squares polynomial approximation to asin(x)+sqrt(1-x^2) on [0,1] and failing dismally :(
The problem is that it has a pole for this particular ...
1
vote
0
answers
109
views
The efficient approximation algorithm of mandelbrot set?
While implementing the mandelbrot set using java, I found that the rendering time of the program is ridiculously slower than other programs.
public class FractalFormula {
private Complex[] ...
0
votes
0
answers
70
views
Interpolation with function of 3 variables in maple
The value depends on three variables. I have a data set of type [x,y,z,w]. Here x,y,z are the input variables and w is the output result. Can I use maple to find a function that approximates a given ...
1
vote
0
answers
39
views
How can I write the code for optimization problem with adding new constraints that use all optimal solutions in each iteration?
I currently deals with optimization problems with a convex constraint function by cvx.
I consider approximating the function by point-wise maximum function composed of the tangent lines that can be ...
1
vote
0
answers
32
views
Approximating the diameter of a point set
given a set of n points P and a nxn matrix M such that for every two point u,v where M[u,v] is the distance between u and v , and the distance is pseudo metric, is there a property testing algorithem ...
2
votes
2
answers
672
views
Fixing boundary values on a spline?
I have data x and y which are noisy evaluations of a function f:[0,alpha] -> [0,1]. I know very little about my function except that f(0) = 0 and f(alpha) = 1.
Is there any way to enforce these ...
0
votes
0
answers
287
views
Explicit & implicit Euler and trapezoid method of ODE solving in Python
I have a question regarding my code. I have to solve an ODE: [y′(t)=(0.5−t)(y(t) + 1), y(0) = 1], numerically (and approximate), using the explicit and implicit Euler as well as the trapezoid method ...
0
votes
1
answer
51
views
PyTorch: calculating model accuracy for approximation problems
There are some SO posts on calculating accuracy of a classification model in PyTorch, but I how do I calculate accuracy of an approximation model?
For example, for classifications, I can usually count,...