How to: Create a range of desired variables (two decimals) into an array

Hi everyone,

I'm curious how I can create a range of desired variables ranging from (-1.00 all the way to 1.00) @ 0.01 increments.

I will want to output this in table format as the first column. There will be 4 columns btw

1st column = the variable [two decimals btw -1.00 and 1.00]

2nd column = math.sin(x) of each

3rd column = my personal sin function

4th column = math.abs(difference between them)

Code:

`public class TaylorSin {`

public static void main(String[] args) {

for (double lB = -100, lB <= 100,lB++) lB.log(x/100);

double[] x = lB;

double ActualFormula = math.sin(x);

double MyFormula = sin(x);

double Absolute = math.abs(ActualFormula - MyFormula);

System.out.format("%3d%10d%10d%4d", double x, ActualFormula, MyFormula, Absolute);

I'm calling my other personally created sin(x) method and attemping to output in table format.

Let me know, because I'm very confused.

Re: How to: Create a range of desired variables (two decimals) into an array

Your for loop only has a single statement in it. And it doesn't do anything unless you are changing something in IB.log(). But even then, x is undefined.

To increment your value by .01 in your for loop just use IB = IB + .01 (or shorthand IB += .01)

Regards,

Jim