Re: Tabular output
- To: mathgroup at smc.vnet.net
- Subject: [mg24663] Re: [mg24631] Tabular output
- From: BobHanlon at aol.com
- Date: Mon, 31 Jul 2000 09:23:30 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 7/28/2000 5:48:36 PM, dooglefish at aol.communicate writes: >I created two functions, P[x] and C[x], for the maximum allowable stresses >in a >beam-column from axial load and bending moment. The variable x is the distance >from one edge of the cross section to the neutral axis in bending. > >The functions evaluate correctly and plot correctly, i.e. I can get a plot >of >P[x] versus x and C[x] versus x. > >Question 1) I would like to plot P[x] versus C[x]. Does anybody have any >hints? > >Question 2) How can I create a table of values such as (see below) ? > >x P[x] C[x] > > >Any help would be appreciated. > Needs["Statistics`ContinuousDistributions`"] distB = BetaDistribution[2., 4.]; distN = Evaluate[NormalDistribution[Mean[distB], StandardDeviation[distB]]]; To print a table: TableForm[ Table[{ NumberForm[x, {2, 1}, NumberPadding -> {"", "0"}], NumberForm[PDF[distB, x], {4, 3}, NumberPadding -> {"", "0"}], NumberForm[PDF[distN, x], {4, 3}, NumberPadding -> {"", "0"}], NumberForm[CDF[distB, x], {4, 3}, NumberPadding -> {"", "0"}], NumberForm[CDF[distN, x], {4, 3}, NumberPadding -> {"", "0"}]}, {x, 0, 1, .1}], TableHeadings -> {None, {"x", "PDFB[x]", "PDFN[x]", "CDFB[x]", "CDFN[x]"}}] To plot one CDF against the other: Off[Solve::"ifun"]; Plot[{y, CDF[distB, x /. NSolve[y == CDF[distN, x], x]]}, {y, 10^-3, 1.}, PlotStyle -> {{AbsoluteDashing[{4}], RGBColor[0, 0, 1]}, RGBColor[1, 0, 0]}, AxesLabel -> {"CDFN[x]", "CDFB[x]"}, ImageSize -> {500, 310}]; Bob Hanlon