Re: Tabular output
- To: mathgroup at smc.vnet.net
- Subject: [mg24677] Re: [mg24631] Tabular output
- From: Otto Linsuain <linsuain+ at andrew.cmu.edu>
- Date: Fri, 4 Aug 2000 01:19:02 -0400 (EDT)
- References: <200007282124.RAA02077@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Doug: I believe ParametricPlot[{C[x],P[x]},{x,xmin,xmax}] will plot C on the horizontal axes and P on the vertical one (perhaps viceversa). As for the table: Table[{x,P[x],C[x]},{x,xmin,xmax,dx}] or {#, P[#], C[#]} & /@ Range[xmin,xmax,dx] will do the following: Range[xmin,xmax,dx] is equivalent to, (but faster than), Table[x,{x,xmin,xmax,dx}] they both create the lists: { xmin, xmin + dx, xmin + 2 dx, up to xmax } it does not matter if you don't hit xmax, it will stop once you get past it. I don't recall if the first number larger than xmax is included or dropped. Table is more general than Range, since you can form the list of any expression that depends (or doesn't depend!) on x, So Table[f[x],{x,xmin,xmax,dx}] will form the list {f[xmin], f[xmin+dx], ....} So the first solution: Table[{x,C[x],P[x]},{x,xmin,xmax,dx}]= { {xmin,C[xmin],P[xmin]}, {xmin+dx,C[xmin+dx],P[xmin+dx]}, .... The second solution will do the same since it maps the function: function[x_] = {x,C[x],P[x]} onto the list {xmin,xmin+dx,...} See which one is faster. You can see a 3D graph of this list by using ListPlot3D which is available in a Mathematica package. Otto Linsuain.