Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
So I found the taylor series online for calculating trig functions but as far I can tell this only works for radians, is there any way to create a similar formula and program it to calculate trig for angles in degrees without converting radians to degrees?
So I am going to go out on a limb here and say "no", not the way you are thinking about it, and the result would end up looking like you converted degrees to radians. The reason is that the Taylor series are built up through derivatives of the trig functions, and these derivatives only give the familiar results (like the derivative of sine(x) is cosine(x)) when the angles are in radians. That is because if you are working on the limit definitions of the derivative, you need to be able to pull out things like the limit as x goes to 0 of (sin(x))/x=1, which is not true in degrees. If you worked these on the sine function in degrees, those factors of pi and 180 are going to show up anyway, and you will feel as if you were converting radians to degrees after all.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 months ago.
Improve this question
I am trying to follow chapter 2 on SDT in
https://link.springer.com/chapter/10.1007/978-3-030-03499-3_2
It basically says
d'emp = z(HIT) - z(FA)
if you don't know z() let your computer compute it ..
But how? Is there a function in R? It cannot be scale becaus Hit and FA are single values.
In this book, the z-transformation z() is defined as "the inverse cumulative Gaussian function". I think the sentence "If you are not familiar with the z-transformation just treat it as a function you can find on your computer" means for readers to not stop too much time in what does z-transformation means and pay attention to the calculations of d_emp and b_emp as the differences and the average.
However, if you want to know how to compute the inverse cumulative Gaussian (normal) function, you can use qnorm() from statslibrary. Be aware that you have to specify the mean and sd of the population, by default the function takes mean = 0 and sd = 1.
To know more:
Inverse of the cumulative gaussian distribution in R
https://www.statology.org/dnorm-pnorm-rnorm-qnorm-in-r/
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm developing a little 2D game and i have to predict when and where things will collide.
So, i've got four Vector2 :
A position
B position
A linear velocity
B linear velocity
I have to find if they intersect, where they intersect and at what time from now.
I've found many math solutions but i could't translate them into code.
The visualization of the problem, numbers are velocities
You want to compute the minimum of
norm((A+t*vA)-(B+t*vB))=norm((A-B)+t*(vA-vB))
Taking the square of these Euclidean norms
norm((A-B)+t*(vA-vB))^2 = norm(A-B)^2 + 2*t*dot(A-B,vA-vB) + t^2*norm(vA-vB)^2
gives you a simple quadratic function in t where the minimum has the value
min_dist =norm(A-B)^2 - dot(A-B,vA-vB)^2/norm(vA-vB)^2
at time
t = -dot(A-B,vA-vB)/norm(vA-vB)^2
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I was wondering if this would be considered a fractal or just a recursive shape. It seems like it is to me, but our lab says "However, it is not just enough that the shape was generated by some recursive process, because there are shapes you could generate recursively which are not fractals," but it also explains more. To me, it seems like it is, but I just wanted to make sure.
Thank you very much!
No, it is not a fractal, because it doesn't demonstrate self-similarity. See: http://mathworld.wolfram.com/Fractal.html
A fractal has recursive properties, but not all recursive figures are fractals.
Here's what my rule of thumb is to decide whether a shape is a fractal or not:
Zoom into the object by a factor of X (say).
Count how many copies of the original object are in the zoomed-in version, let's call it N.
The dimension of the object is the logarithm of N, to the base X.
Eg: Zoom into a square by a factor of 2, you'll have 4 copies of the square that "fit inside" the larger square. Since log 4 (base 2) is 2, hence this is a 2D object.
Look at the Koch curve:
Zooming in 3x will give you 4 copies of the original curve, hence its "dimension" is log 4 (base 3), which is a number between 1 and 2... a fractional dimension, (hence the name fractal).
Applying this rule to your recursive figure, if you zoom in 2x, you will still see the original figure (N = 1). Its dimension works out to be log 1 (base 2), which is zero.
Since zero is not a fraction, therefore your figure is not a fractal.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
i'd like to know how to solve a definite integral in Mathematica.
I do know all variables except b, and need to solve for F(b)=0.
How can i solve it in Mathematica?
Here is my try:
NSolve[Integrate[1/(8*(1 - ff) (2 Pi)^0.5) E^(-0.5*((x - 1.1)/(1 - ff)/8)^2), {x, 0, 9999}] == -0.44531779637243296, ff]
These integrals can be trivially expressed in terms of an error function: Wiki, Mathworld. Hence what you need here is a library to (i) calculate error functions, (ii) numerically solve non-linear equations. Virtually any language has this, so pick anything you're familiar with. In Mathematica, look up Erf and NSolve.
I'd start by plugging it into Wolfram Alpha and see what it gives you.
Mathematica should be able to do it. I think of statistics first when R comes up; I don't know about its calculus capabilities. Excel is not the first choice.
If I were you, I'd be less worried about the software and more worried about the solution itself. A function of this form might be well known. Plot each one and visually check to see what the functions look like and how easy they might be to integrate.
Like this:
http://www.wolframalpha.com/input/?i=graph+exp%28-%28%28x%2B5%29%2F1.5%29%5E2%29
You should be wondering why it's three similar looking integrals. Those singularities in the plot tell you why.
If there's no closed form solutions, you'll have to go with a numerical one. You'll have to choose an algorithm (simple Euler or Runga Kutta or something else), interval sizes, etc. You'll want to know about singular points and how best to tackle them.
Choosing a package is just the start.
You might find http://r.789695.n4.nabble.com/calculus-using-R-td1676727.html helpful.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'm using the formula sin = sqrt(1-cos^2) to convert from cos to sin where source angle is not known an a call to arccos is too expensive. This operation obviously produces a wrong sign if source angle is in the 3rd or 4th quadrants. Could someone recommend me an effective way to compute the correct sign?
Thank you!
The correct sign will depend on the quadrant of the original angle. If you don't have the angle, the solution is ambiguous.
Note that the arccos will not solve your problem because it will return only angles in the 1st and 2nd quadrants.
You simply do not have enough information!