1024, -512, 256, -128, 64, -32, ...Can you figure out the next four terms in this sequence? Write a program called StrangeSequence.java that uses a for-loop to print the first 10 terms of this sequence?
Write a program called YnSequence.java to print out the value of Yn when given fixed values of of n and x. Here is a code template where n=10 and x=0.5:
In this case the resulting value should be approximately (but not exactly) 2.0. Next, change the value of x so that x=0.1 and see what you get for Yn. You should get a number that's approximately equal to 0.123.
DrawTool.setXYRange (0,1, 0,100);Don't forget that you need to have DrawTool.java in the same directory.
Make sure n is a variable whose value you can change. Then print the results (you need to compute and print π from π/2) that you get for the following values of n: 10, 20, ..., 100.
Recommended, but not required:
This week we'll explore
computational biology - the intersection of biology
and computer science.