Message Boards Message Boards

0
|
2196 Views
|
8 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Plotting piecewise function?

Posted 1 year ago

I'm new to Mathematica and am having a LOT of trouble getting around the program. I've read some of the documentation online and it doesn't seem to answer anything for me, nor does it address my issue.

Please do not link to the documentation when answering my question. I just want some good, step by step instructions written here.

  1. How do I graph a function? I know there is a "plot" command and that you have to enter things like you would on an old MS-DOS computer. I can't find any way to do things graphically.

Say I want to graph f(x) = x^2 + 3. What will make this come up visually for me, as in a drawn out graph on the screen like I'd get on Desmos or even a TI-84?

  1. How do I see that I am in a cell? Is it like a Word text box where I can clearly see the boundaries or is there some other way...or do I just have to go blindly into this?

  2. How do I graph a piecewise function? I know I sort of need to get #1 first, but I'm sure there are more loops to go through for this.

I should mention that I am used to computer programs that use buttons, not typing things, and I'm not good at all with computer programming languages. I still don't know how to write a Java program without looking at the book.

POSTED BY: Scott B
8 Replies
Posted 1 year ago

I should mention that I am used to computer programs that use buttons, not typing things, and I'm not good at all with computer programming languages.

Let's start there. The Wolfram Language is a programming language. Mathematica provides a notebook interface in which you can execute Wolfram Langauge code. So, if you want to make progress with Wolfram/Mathematica, you're going to need to get over this impedence, at least to some degree.

I just want some good, step by step instructions... Say I want to graph f(x) = x^2 + 3....

I could type that function definition right into a Plot expression. You need to tell Plot the domain you want to see, and that's what the {x, -10, 10} bit is. enter image description here

Now, notice the little blue bracket to the right. That is delimiting a cell. On the left, you have a label that's telling you that this is an input cell. The horizontal line is showing you where the cursor currently is, and it's just outside the cell. To get output, you need to evaluate the cell. There is a menu command Evaluation -> Evaluate Cells. There is a shortcut for this: Shift-Return. This command will evaluate all cells that are selected. If your cursor is inside a cell, then this command will evaluate that cell. So, either put your cursor in the cell (click somewhere in/near the Plot expression) or select the cell by clicking on the blue bracket. Now, evaluate the cell. enter image description here

There are a million directions we could go from here. I think the main issue you need to confront is that you're going to be using a programming language and you're going to be creating what are in effect small programs. This means learning the syntax and understanding how evaluation of expressions works, at least at a basic level.

Maybe you should just play around with this Plot for awhile. Edit the contents of that cell by changing the function or the domain limits (you'll need to re-evaluate after each edit to see the effect of your change). Maybe even look at the documentation for Plot if you can bear it--there will be other examples you can try out. Then come back with other questions.

POSTED BY: Eric Rimbey

Please do not link to the documentation when answering my question.

Perhaps you were not aware that the documentation is live. You can modify code in the documentation, evaluate the cell (as Eric described) and see the output. Any changes you make are not saved so experiment freely. E.g from the documentation for Plot

enter image description here

Change the function and the domain

enter image description here

You might want to read Stephen Wolfram's book An Elementary Introduction to the Wolfram Language which is available free online. The exercises are live, enter your solution as Wolfram Language code and it will check if it is correct.

POSTED BY: Rohit Namjoshi
Posted 1 year ago

This is all good information. I'm surprised we have to work with this for a fundamental Calc I class. Most of those are just math?

How do I insert an "input" variable? Or an "output"?

Any screen shot with what I need to use, circled, would be helpful. Otherwise, this seems to make sense, even though I can't understand why I'd need this instead of Desmos.

I'm not a technical/programming person here. I need step by step instructions here and struggle with manuals written for computer people. Conversational English is the best way to reach me here!

POSTED BY: Scott B
Posted 1 year ago

How do I insert an "input" variable? Or an "output"?

I don't know what you mean by this. But regardless, coming to this forum with such questions is probably not going to help you much. Your questions are just too basic to even begin to explain via this sort of bulletin-board back-and-forth. Find a buddy in your class that already has some Mathematica knowledge. Or raise the issue with your instructor. Or start reading the introductory book Rohit liniked to. Seriously, this is like trying to teach someone to drive using only text messages.

POSTED BY: Eric Rimbey
Posted 1 year ago

What I mean is how do you get those little blue messages to the side of the function that say In[1] = I can’t figure out where the command to get them is.

I already said the book was far too technical for me and so is the documentation. I understand the calculus perfectly fine, and can do the problems without any difficulty. The assignment was due yesterday and is late because I have been so helplessly lost and nobody is of any help within the class.

The assignment basically is to put a function in to the notebook and display the graph. I can draw this graph just fine on paper or on any other graphing utility, but just don’t know how to get that blue part of the text in now.

I apologize if I am asking questions that seem very very stupid. I’m just not very good with computers!

POSTED BY: Scott B
Posted 1 year ago

OK so I figured out what I wasn't doing correctly. Apparently you have to hit "shift" while you hit "enter". Now it's graphing and solving things and that seems to be causing the blue In and Out to come up.

Those blue in and outs threw me off too because they look like some kind of mathematical structure.

POSTED BY: Scott B
Posted 1 year ago

The questions aren't stupid. It's just that it'll take many pages of text before we get to anything interesting.

But regarding the blue text, don't even try to manipulate those. They are generated automatically each time you evaluate an expression. Just ignore them. They would be too much of a distraction to discuss at this point.

As for drawing the graph, are you still stuck on that? Did my previous post not get you past that hurdle?

POSTED BY: Eric Rimbey
Posted 1 year ago

I got it to draw the graph. It was the whole shift-enter thing that I was missing plus I thought the blue things had to come from somewhere. Now I just need to get it to do a piecewise.

I can barely figure out Instagram, let alone programming, so thanks for bearing with me. I'd rather be using paper and a calculator any day! (I couldn't even figure out the Alexa speaker thing and it just sits gathering dust now).

POSTED BY: Scott B
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract