Message Boards Message Boards

GROUPS:

[✓] Plot a graph for viscosity vs. molecular weight?

Posted 9 months ago
1079 Views
|
4 Replies
|
1 Total Likes
|

Hi, I just started learning mathematica. I'm trying to plot this plot the graph for viscosity vs molecular weight (attached pictures Formula [1] and books plot[2] from Cosgrove book of colloidal sciences.) I first try to sum functions (linear part EE(M) and non linear part EE(M)) but I don't think it works like that (line 3). So I used the "IF" command and it seems it is also wrong (line 5). I think I have problem with defining functions and parameters in mathematica. My .nb file is attached and I appreciate your help.

P.S: Also look at line7 why mathematica doesn't plot when I use function's name?

EE1[M1_] := a M1; 
EE2[M1_] := a M1^3.4;
Plot[{a M1 + a M1^3.4}, {M1, 1, 100}, PlotRange -> Automatic]
Mc = 54;
ee[M_] := If[M < Mc, M, M^3.4](*ee is viscosity [\eta]*)
Plot[If[M < Mc, M, M^3.4], {M, 1, 100}, PlotRange -> Automatic]

Also why this code doesn't plot manipulate when i use function's name

Manipulate[Plot[{EE1 + EE2}, {M1, 1, 100}, PlotRange -> Automatic], {a, 1, 3}]

enter image description here <code>enter image description here

Attachments:
POSTED BY: Arm Mo
Answer
4 Replies

Hold the expression using With and insert a value for a

With[{a = 1},
 Plot[{a M1 + a M1^3.4}, {M1, 1, 100}, PlotRange -> Automatic]
 ]

Same thing can be done, instead of setting the value for Mc

With[{Mc = 54},
 ee[M_] := If[M < Mc, M, M^3.4];(*ee is viscosity[\eta]*)
 Plot[ee[M], {M, 1, 100}, Filling -> Axis]
 ]

Make the EE functions of two arguments, then supply the value of a using the manipulator

EE1[M1_, a_] := a M1;
EE2[M1_, a_] := a M1^3.4;

Manipulate[
 Plot[EE1[M1, a] + EE2[M1, a], {M1, 1, 100}, PlotRange -> {0, 2*^7}],
 {a, 1, 3}]
Posted 9 months ago

Thanks for the reply, I see that manipulate expression that you sent works, thank you. However, the graph doesn't look like what I see in book (figure attached). I think I have problem with PlotRange..?, maybe plotting conditional functions are different? \Eta is a function of M if M is less than Mc=600 M then \Eta is linear , if M is greater than Mc then plot is non linear.

POSTED BY: Arm Mo
Answer

The graph in the book uses logarithmic scales. Did you try LogLogPlot?

Posted 9 months ago

Yes I think you are right! Thank you,

POSTED BY: Arm Mo
Answer
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