Student Support Forum: 'Making graphs' topicStudent Support Forum > General > Archives > "Making graphs"

 Next Comment > Help | Reply To Topic
 Author Comment/Response Tea 08/22/08 10:52am I have an issue regarding the graph code, because everytime I evaluate a cell (shift+enter), I don't see a graph! v1[pH_, pK_] := Max[0, (10^-pK 10^-pH + (10^-14 - 10^(-2 pH)) (10^-pK + 10^-pH))/((10^(-2 pH) + 10^-pH - 10^-14) (10^-pK + 10^-pH))] v2[pH_, pK1_, pK2_] := Min[2.5, v1[pH, pK1] + v1[pH, pK2]] V[a_, pH_, pK_, pK1_, pK2_] := v1[pH, pK] KroneckerDelta[a, 1] + v2[pH, pK1, pK2] KroneckerDelta[a, 2] titr[a_, pH_, pK_, pK1_, pK2_] := ParametricPlot[{V[a, x, pK, pK1, pK2], x}, {x, 0, pH}, AxesOrigin -> {0, 0}, PlotRange -> {{0, 2.5}, {0, 14}}, PlotStyle -> Thick, AspectRatio -> .75, GridLines -> Automatic, Frame -> True, FrameLabel -> {"relative volume of base added", "pH = -\!\(\*SubscriptBox[\"log\", \ \"10\"]\)[\!\(\*SubscriptBox[\"H\", \ \"3\"]\)\!\(\*SuperscriptBox[\"O\", \"+\"]\)]"}, ImageSize -> {390, 300}] app[a_, pH_, pK_, pK1_, pK2_, ind_] := Graphics3D[{color[ind, pH], Glow[color[ind, pH]], Cylinder[{{0, 0, 0}, {0, 0, .1 + .1 V[a, pH, pK, pK1, pK2]}}, .25], White, Opacity[.2], Glow[], Cylinder[{{0, 0, 0}, {0, 0, .5}}, .25], EdgeForm[], Cylinder[{{0, 0, .85}, {0, 0, 1.85}}, .075], Opacity[.2], Cylinder[{{0, 0, .85}, {0, 0, .6}}, .025], Gray, Opacity[.5], Cylinder[{{-.1, 0, .725}, {.1, 0, .725}}, .02], Cylinder[{{.1, -.05, .725}, {.1, .05, .725}}, .02], White, Opacity[.2], EdgeForm[], Table[Cylinder[{{0, 0, .85}, {0, 0, .85 - \[Epsilon]}}, .075 - \[Epsilon]], {\[Epsilon], 0, .05, .01}], Opacity[0], EdgeForm[Black], Table[ Cylinder[{{0, 0, .85 + .125 n}, {0, 0, .85 + .125 (n + 1)}}, .075], {n, 1, 7}]}, Boxed -> False, ImageSize -> {190, 300}] color[0, pH_] := White color[1, pH_] := If[pH <= 3.5, Yellow, If[pH >= 4, Lighter[Blue], Lighter[Green]]] color[2, pH_] := If[pH <= 5, Lighter[Red], If[pH >= 5.5, Yellow, Orange]] color[3, pH_] := If[pH <= 7.5, Yellow, If[pH >= 8, Lighter[Red], Orange]] color[4, pH_] := If[pH <= 8.5, White, If[pH >= 9, Lighter[Red], Pink]] color[5, pH_] := If[pH <= 4.25, Yellow, If[pH >= 4.75, Lighter[Blue], Lighter[Green]]] Manipulate[ Grid[{{titr[a, pH, pK, pK1, pK2], app[a, pH, pK, pK1, pK2, ind]}}], {{a, 1, "acid type"}, {1 -> "monoprotic", 2 -> " diprotic "}}, {{pK, 0, Style[Subscript["pK", a]]}, 0, 10, Appearance -> "Labeled"}, {{pK1, 2, Style[Subscript["pK", a1]]}, 2, 10, Appearance -> "Labeled"}, {{pK2, 7, Style[Subscript["pK", a2]]}, 2, 10, Appearance -> "Labeled"}, {{pH, 13.65, "titration progress"}, .01, 13.65}, {{ind, 0, "indicator"}, {0 -> "none", 1 -> "bromothymol blue", 2 -> "methyl red", 3 -> "phenol red", 4 -> "phenolphthalein", 5 -> "bromocresol green"}}, SaveDefinitions -> True, AutorunSequencing -> {1, 2, 5, 6}] I'm working on a chemistry assignment, and I have already written the main part of it, I only need the right code for a graph.....or graphs in general! URL: ,

 Subject (listing for 'Making graphs') Author Date Posted Making graphs Tea 08/22/08 10:52am Re: Making graphs yehuda ben-s... 08/24/08 01:47am Re: Making graphs Strangelove 08/27/08 07:34am Re: Making graphs Strangelove 08/27/08 07:38am
 Next Comment > Help | Reply To Topic