1
$\begingroup$

The code I am using to make my plot is:

DiscretePlot[
  Piecewise[{{1/((-2)^{x + 1}), x <= 3}, {1/32, x >= 4}}], {x, 0, 10}]

Also, how do I change to color of the points on the plot to red? I did

PlotStyle -> Red

It did not work.

$\endgroup$
  • 2
    $\begingroup$ Your input is not correct the first term should be: {1/((-2)^(x + 1)), x <= 3} and not {1/((-2)^{x + 1}), x <= 3} (beware the {}. You can track it down when you evaluate your function at x=3 (you get a list!) and x=4 you get a value. $\endgroup$ – mgamer Mar 4 at 17:31
3
$\begingroup$

You can't use { } to bracket expressions in the Wolfram Language — only ( ). Curly braces { } are a shortcut for writing the function List.

So your code should be:

DiscretePlot[
  Piecewise[{{1/((-2)^(x + 1)), x <= 3}, {1/32, x >= 4}}], {x, 0, 10},
  PlotStyle -> Red]

plot

| improve this answer | |
$\endgroup$
1
$\begingroup$

Syntax errors corrected

DiscretePlot[Piecewise[{{1/((-2)^(x + 1)), x <= 3}, {1/32, x >= 4}}], {x, 0, 10}, 
 PlotStyle -> Red]

enter image description here

| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.