Input/Output Table

Hi All,

Could someone please tell me how to create a simple input/output table from an equation such as y=x^2 + 2 or lead me to a task from which I can cut and paste and change parameters.

Thanks in advance.

Bob

explain

Maybe you could give an example of what you want.  Do you have specific values of x in mind?  You could, for example, do

eq := y=x^2+2:
for xx in [1,2,2.3] do
   printf("%f %f\n", xx, eval(rhs(eq),x=xx));
end do:

That only prints the output.  Do you actually want to insert it into a table or Matrix? 

Doug Meade's picture

function table as a Matrix

Here's another way to construct a table of function values. One advantage of this method is the output is a Maple object that can be used for later steps, if needed.

restart;
interface( rtablesize=20 ):   # needed to display tables with more than 10 rows or columns
f := x->sin(x);
x -> sin(x)
X := [$0..10]/10;
                    [   1   1  3   2  1  3  7   4  9    ]
                    [0, --, -, --, -, -, -, --, -, --, 1]
                    [   10  5  10  5  2  5  10  5  10   ]
T := < seq( 

This constructs a table with three columns. You can modify the list of values from the domain to fit your needs. The specific functions, and number of columns is also completely customizable. Note the use of "|" to separate columns in the table. The output is omitted because MaplePrimes does not like to display Maple matrices.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/

File of Worksheet

Hi Doug,

Would you be able to send me the file of the actual Maple11 worksheet.  I imagine that I could use that as a model like any other task and load it everytime I wanted to create a table for an equation and just change the parameters.  In fact, maybe I could even load it into Maple11 as another task?

I'm a bit surprised it is not as easy to create as a plot!

I appreciate your help since this is one of my main uses of this program.

Bob

Doug Meade's picture

no need for worksheet

There is no need for a worksheet. Just copy and paste these commands wherever you need them. You can create a task template if you want.

restart;
interface( rtablesize=20 ):   # display tables up 20 rows or cols
f := x->sin(x);
X := [$0..10]/10;
T := < seq( < x | f(x) | evalf(f(x)) >, x=X ) >;

It appears as though my previous post was visited by the < gremlin, even though it is inside a pre tag and it previewed correctly. Hmmm.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/

Several options

You may look at the thread Viewing function as a table.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}