First, find the n nth roots of unity.
eg if n = 6, find the n distinct (complex) numbers such that n^6 = 1.
Second, raise each root to the power pi (.^pi).
Third, sum the resulting numbers and use that as the output.
Surely I shouldn't done this ugly string thing, that is bad for everyone. Without any doubt, Tim's solution is the best one
Find the two most distant points
Sum of first n terms of a harmonic progression
Number of 1s in a binary string
Add two numbers
Count up then down
Calculating large fibonacci numbers
Find argmax of a function
Find left eigenvector of row stochastic matrix
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office