Troubleshooting Mathematica Plotting Problem

Click For Summary

Discussion Overview

The discussion revolves around troubleshooting a Mathematica plotting issue related to a piecewise function. Participants are exploring syntax and formatting errors that may be causing a blank graph output.

Discussion Character

  • Homework-related
  • Technical explanation

Main Points Raised

  • One participant presents a piecewise function in Mathematica that results in a blank graph and seeks assistance.
  • Another participant suggests testing individual pieces of the piecewise function to identify the issue.
  • A different participant emphasizes the importance of using the correct syntax, specifically recommending the use of square brackets for function names instead of round brackets.
  • A later reply confirms that the suggested modifications resolved the issue and produced the expected graph.

Areas of Agreement / Disagreement

Participants generally agree on the need for correct syntax in Mathematica, and the discussion appears to resolve around the proposed solutions, though initial confusion about the plotting issue remains unaddressed.

Contextual Notes

The discussion does not explore the underlying reasons for the blank graph beyond syntax errors, and it does not address potential limitations of the piecewise function itself.

kevmac
Messages
6
Reaction score
2

Homework Statement


I've entered the following piecewise equation into Mathematica:

Plot[Piecewise[{{sin (t), 0 <= t < \[Pi]}, {5 + 5 cos (t) + sin (t), \[Pi] <= t < 4*\[Pi]}, {10 cos (t) + sin (t), 4*\[Pi] <= t}}], {t, 0, 20*\[Pi]}]

But I am getting a blank graph in return. I've proofread my input many times and can't find anything wrong with it. Can anyone help me get a graph generated?

Homework Equations

The Attempt at a Solution

 
Physics news on Phys.org
kevmac said:

Homework Statement


I've entered the following piecewise equation into Mathematica:

Plot[Piecewise[{{sin (t), 0 <= t < \[Pi]}, {5 + 5 cos (t) + sin (t), \[Pi] <= t < 4*\[Pi]}, {10 cos (t) + sin (t), 4*\[Pi] <= t}}], {t, 0, 20*\[Pi]}]

But I am getting a blank graph in return. I've proofread my input many times and can't find anything wrong with it. Can anyone help me get a graph generated?

Homework Equations

The Attempt at a Solution


jedishrfu is correct. You should also use square brackets, not round brackets in functions. Sin[t] is the correct syntax. If you make those two modifications, it will work, as shown below.
Screenshot from 2016-02-11 13:35:01.png
 
Thanks to both of you! This ended up working just fine and I got the same graph that you did e.bar.goum
 
  • Like
Likes   Reactions: e.bar.goum

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
1K