Eulers Method Calculator Program Programming Software Development by Start4me Good time of day! I'm working on creating an Eulers Method Calculator program. The problem I got stuck on is … std::complex<typename> Programming Software Development by akhal … w = pow(e, 2*pi*j/n) Where e is eulers constant, and j=sqrt(-1.0); But this doesnt work… understanding euler totient function Programming Software Development by nitin1 what are they trying to say in this paragraph , I have read it 10 times, but not getting what they want to teach me here: link is this. : http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=primeNumbers and the para which is just before the euler totient theorem. am copying here also. *Or consider a scenario where you are … Re: A ternary computer that actually works? Hardware and Software by Hiroshe … numbers. They appear in the most bazzare places, and even eulers identity all togeather astonishingly. This still doesn't mean that… Re: what's the best form of rotation data structures? Programming by Tcll … to gimbal lock... I do have a code which applies eulers to vectors using matrix math to avoid gimbal lock, but… Re: Eulers Method Calculator Program Programming Software Development by castajiz_2 when the user inputs for example 2x+y, you then want it to be 2*xcor(enteredvalue)+ ycor(enteredvalue) or do you want to apply integrals to this equation since differetiantion is all about integrals. If you want to do the first thing then i would suggest to see check if the equation contains x and replace it with your xcor double variable, same for… Re: Eulers Method Calculator Program Programming Software Development by Start4me Yes, I want it to be 2*xcor(enteredvalue)+ ycor(enteredvalue), but I don't know how to convert the users input into the code like you have above. What would the code be instead of the (enteredvalue)? Re: Eulers Method Calculator Program Programming Software Development by castajiz_2 That s not really an easy task.You could somehow make a an array of characters with the tochararray method and then implement a for loop to go through each cell and check where x,y,numbers and math operators are and somehow accumulate this in a integer variable in c# there is a class for that and you can do it much easier for Java i suggest to take… Re: Eulers Method Calculator Program Programming Software Development by Start4me For the sake of minimizing the complexity to parse the dydx, lets use a predefined formula of "x + y" aka dydx = (xcor+ycor); The code bellow gives the output, but only finds the first (x, y) coordinates. I tried the while loop, but the program doesn't work properly to give the output when the fx matches with xcor, instead goes on … Re: Eulers Method Calculator Program Programming Software Development by Start4me I was able to fix the issue by replacing: while (xcor != fx) with: while (xcor <= fx) however, this only works with a positive delx. When I tried a negative delx, I had to use: while (xcor >= fx) I however get lost on behalf of how to make which code to work. When the user inputs positive or negative delx. To be … Re: std::complex<typename> Programming Software Development by alwaysLearning0 try to explicitly declare template arguments, this usually happens when template argument deduction satisfy multiple template class/functions. [CODE] w = pow<double,int>(e, 2*pi*j/n) //or whatever you want to be your datatype [/CODE] Have a look into the pow functions: [url]http://www.cplusplus.com/reference/std/complex/pow/[/url] Re: std::complex<typename> Programming Software Development by mike_2000_17 Well, I think you need to brush-up on some complex algebra stuff... With Euler's identity, this e to the power of 2*Pi*j/n is simply a rotation by 2*Pi/n. You can easily construct this complex number by using the "polar" function, as so: [CODE] w = polar(1.0, 2*pi/n); [/CODE] Re: std::complex<typename> Programming Software Development by akhal I couldnt make "n" complex, but even if I can, I dont want to, because my code is part of a parallel program and all my intentions are to time optimize my code, so making more complex constructors may slow down my program. Anyway, restating my problem; I have to code the equation: w=pow(e,2*pi*j/n) (where j=sqrt(-1) ) So since the … Re: std::complex<typename> Programming Software Development by mrnutty >>[B]#define J sqrt(-1.0)[/B] there is no such thing as sqrt(-1.0), the parameter to sqrt shouldn't be negative. Instead just imagine the second paramter of complex type is imaginary. [code] typedef std::complex<float,float> Complex; typedef std::vector<float> TimeDomainData; typedef std::vector<Complex> … Re: std::complex<typename> Programming Software Development by mike_2000_17 "pow(e,2*pi*j/n)" is a complex number with magnitude 1 and angle 2*pi/n. You just need to create that number, and thus, I reiterate my solution: [CODE] complex<double> w = polar(1.0, 2*pi/n); [/CODE] Re: std::complex<typename> Programming Software Development by akhal Thank you so much "firstPerson" and "Mikael Persson" for your so kind information/support. I tried "polar" function but it stated wrong arguments when I tried the given ones, so I rather invented trying like: [code] theta = TWO_PI/nth; complex<double> w(cos(theta), sin(theta)); [/code] And I think it is …