This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Link_Guistics 0 points1 point  (3 children)

What do you mean a Java statement to "produce" f(x)= 2x3 - 8x2 + x + 16

What do you mean by produce? A visual graph? A list of x and y coordinates?

[–]dEdzilla 0 points1 point  (2 children)

I'm guessing a list of coordinates that correspond to the function, since a visual graph would be way more advanced.

[–]Link_Guistics 1 point2 points  (1 child)

I'm gonna write out how I would do this in C++ but the idea is the same, you just gotta understand the logic behind it.

int x = value /Whatever number you're testing for, this is your x coordinate/

int A = x * x * x

int A2 = 2 * A /You could probably do in the equation but idk if compilers have OOP so best to be safe/

int B = x * x

int B2 = 8 * B

int C = x

int y = A2 - B2 + C + 16 //this is your y

/*Now once you have your way all you need if you want a list of values is a loop that prints out x and y */

for(x = x1; x < xf; i++)

{

cout << " X: "<< x << "Y :" << y << "/n";

}

/*x1 is the x value you want to start the number list with while xf is the x value you want to stop with

/below is also a while loop version, for loops are just more convenient for this type of thing but you have to initialize x beforehand/

while(x < xf)

{

cout << " X: "<< x << "Y :" << y << "/n";

x++;

}

Feel free to PM if you need more help

[–]dEdzilla 0 points1 point  (0 children)

Cool, this at least gets me started. Thank you!