Sine wave Generation
I am working on a project that I want to output a sine wave of 50Hertz. I have defined it as follows:
`float amplitude = 10.0f;
float frequency = 50.0f;
//float phase = 0.0f;
float samples = 150.0f;
for (int t = 0; t<samples; t++)
{
float wt = (float)(amplitude * Math.Sin((2.0f * Math.PI * frequency * t /
samples)));``
}`
When I run the code I am not getting the expected results when I plot the values on a graph. Does any one know if I am doing this right or what my problem is. Thanks
See also questions close to this topic

Aspose.Word  Word found unreadable content in Document.docx. Do you want to recover the contents of this document?
I am filling up the merge fields of a Word Doc (old file format) document and creating a Word Docx document. Word reports me the following errors. When i save the document to doc, i dont get the error.
When I open the document i get the error:
The file Document.docx cannot be opened because there are problems with the contents.
After that i get the message:
Word found unreadable content in Document.docx. Do you want to recover the contents of this document?..
When I click ok, I get the expected document.
This error appears with several templates. Can you help me?
For saving the document i use:
mergedDocument.Save("FilePath");
I’m using the last version of aspose.words (17.3.0.0).

How to implement a procore connect rest API in sharePoint addins
I want to use procore connect rest api in sharepoint Addins of MS Project of Add inSync.
how many ways we can implement procore connect rest api in sharePoint Addins

How can I add font awesome to an ASP.NET MVC project?
This. I don't know how to add external packages to an ASP.NET MVC project.

Rotation of a point around origin in 2D converge to 0
Following code is written to rotate a point around the origin in 2D. However, instead of going on a circle, it keeps converging to the centre. (originally ran on Three.js) This code works absolutely correct. (I have done this in other platforms and even ran a numerical simulation in excel sheet too).
Why does this happen?
<body> <div id="vals"></div> <script> theta = Math.PI / 90.0; var x = 1; var y = 1; var element = document.getElementById("vals"); var i; for (i = 0; i < 10000; i++){ var r = Math.sqrt( x * x + y * y ); var para = document.createElement("pre"); var node = document.createTextNode("x="+x+" y="+y+" r="+r); para.appendChild(node); element.appendChild(para); x = (x * Math.cos(theta))  (y * Math.sin(theta)); y = (y * Math.cos(theta)) + (x * Math.sin(theta)); } </script> </body>
p.s. I know that if I normalize the values and multiply by the magnitude , I would get the correct answer. However I want to know why this exact thing doesn't work.

What is the most efficient general sin(x) algorithm, and how efficient is it?
Using some series work messing with factorials, I discovered a connection between a polynomial expansion of a factorial and a polynomial expansion of a sin that were very similar.
After creating a small program to generate coefficients of the factorial's polynomial expansion (it's actually really pointless here as it requires calculation of factorial in order to generate a factorial's :P), I was able to add a multiplication by Pi and create an O(n^2) algorithm for sin(x). I wanted to compare it to other algorithms for calculating for sin.
I looked online, but I couldn't find much about sin calculations. I found CORDIC, but couldn't find anything about efficient implementations, so eventually I gave up and came to ask here as it's a good question for anyone interested in the calculations of trigonometric functions in computers.
So what's the typical and/or best way to find sin(x) in software and how does my algorithm stand up?

c++ program with function to evaluate sin using series ..... not giving result
Write a C++ function naming mysin() which take the input number and return the sin of the number . Sin of the number is evaluated using the series. Taylor series for expansion of sin(x)
I am not getting answer for sin using mysin() ..... if i enter value for sin(15) i get 15?
MY code:
#include <iostream> #include <cmath> using namespace std; double mysin(double); int factorial(int); double sin1=0; int fact; int exp1=1; int pwr=0; int main() { int sinNum; cout<<"enter a value for which you want to calculate sin . "<<endl; cin>>sinNum; int x = sinNum; int ans=mysin(x); cout<<"value for sin is "<<ans<<endl; return 0; } double mysin(double x) { while(pwr<=1000) { sin1=sin1+(pow(1,pwr)*pow(x,exp1))/factorial(exp1); pwr++; exp1 + 2; } return sin1; } int factorial(int y) { fact = 1; while(y>0) { fact = fact*y; y; } return fact; }