Mathematica Troubleshooting Mathematica Plotting Problem

AI Thread Summary
The discussion revolves around troubleshooting a piecewise function plotted in Mathematica that initially returns a blank graph. The user shared their code, which included a piecewise equation with sine and cosine functions. Key advice provided includes using square brackets instead of round brackets for function names, specifically changing "sin(t)" to "Sin[t]" and "cos(t)" to "Cos[t]". After implementing these corrections, the user successfully generated the desired graph, confirming that the syntax adjustments resolved the issue.
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 e.bar.goum

Similar threads

Replies
1
Views
2K
Replies
1
Views
2K
Replies
2
Views
2K
Replies
2
Views
1K
Replies
4
Views
4K
Replies
4
Views
3K
Back
Top