Message Boards Message Boards

0
|
10625 Views
|
10 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Why don't the plot graph show fully in a single fuction ?

Posted 10 years ago

I was plotting the graph showing the variation of the instantaneous copolymer composition F1 with monomer composition f1 through the equation

F1 = ( f1 f2 + r1 f1^2) / (r1 f1^2 + 2 f1 f2 + r2 f2^2) 

whereas r1 and r2 are given for particular situation. I tried to plot 1 function with r1 = 0.055 and r2 = 0.003 first but the graph did not show fully in the interval {f1, 0, 1}, then I plotted 4 functions simultaneously, the result was good. I want to know the reason why it does not show good with the single function. I would like to put a label on each curve when I will print out without color to differentiate which curve is , such as 1 2 3 ... Thank you very much.

This is my code :

Plot[{((1 - f1) f1 + 0.055 f1^2)/(
  0.003 (1 - f1)^2 + 2 (1 - f1) f1 + 0.055 f1^2), ((1 - f1) f1 + 
   55 f1^2)/(
  0.01 (1 - f1)^2 + 2 (1 - f1) f1 + 55 f1^2), ((1 - f1) f1 + 
   0.1 f1^2)/(10 (1 - f1)^2 + 2 (1 - f1) f1 + 0.1 f1^2), f1} , {f1, 0,
   1}, Frame -> True, 
 FrameLabel -> {Subscript[f, 1], Subscript[F, 1]} ]
POSTED BY: ANH MONG
10 Replies

Incomplete curves can often be completed by adding the option PlotRange->All. The logic according to which in absence of this option Mathematica considers parts of curves irrelevant (of detracting from the essential features of the curve?) seems to have changed from version to version. At least my Mathematica 10 works perfectly for the second boxed expression of the original question.

POSTED BY: Ulrich Mutze
Posted 10 years ago

That's exactly the answer for my second questions. Thanks Sir Mutze

POSTED BY: ANH MONG
Posted 10 years ago

And as to labels, you can try Epilog. Check this post out: http://stackoverflow.com/questions/7221315/how-do-i-label-different-curves-in-mathematica

POSTED BY: Maria R
Posted 10 years ago

Thanks Maria I need that one.

POSTED BY: ANH MONG
Posted 10 years ago

Hi!

It seems, the problem is, that you didn't define f2 while trying to plot the function. And when you manually substituted f2 by (1-f1) you got your plot. But you can also substitute it by a command:

Plot[With[{r1 = 0.055, r2 = 0.003}, F1 /. f2 -> 1 - f1], {f1, 0, 1}, 
 Frame -> True, FrameLabel -> {Subscript[f, 1], Subscript[F, 1]}]
POSTED BY: Maria R
Posted 10 years ago

Thanks Maria :) Then I wrote the code again.

F1[f1_,f2_] := (r1 f1^2 + f1 f2)/ (r1 f1^2 + 2 f1 f2 + r2 f2^2) 
Plot[With[{r1 = 0.055, r2 = 0.003}, F1 /. f2 -> 1 - f1], {f1, 0, 1}, 
 Frame -> True, FrameLabel -> {f1, F1}]

And it did not work on my mathematica 8, my using level is beginner, this is the first time I use the syntax With[ ] I'm gonna give you other values of r1 ,r2 : r1 = 55, r2 = 0.01 r1= 0.1, r2=10 and I do successful with my cumbersome codes. I want to plot several functions with those r1,r2 above with clear and more logical syntax.

POSTED BY: ANH MONG
Posted 10 years ago

As a function

 F[f1_, r1_, r2_] := ((1 - f1) f1 + f1^2 r1)/( 2 (1 - f1) f1 + f1^2 r1 + (1 - f1)^2 r2)
    Plot[{F[f1, 0.055, 0.003], F[f1, 55, 0.01], F[f1, 0.1, 10]}, {f1, 0, 1}, Frame -> True, FrameLabel -> {Subscript[f, 1], Subscript[F, 1]}]

Or, if you wish to keep both f1 and f2

FF[f1_, f2_, r1_, r2_] := (f1 f2 + r1 f1^2)/(r1 f1^2 + 2 f1 f2 + r2 f2^2)
Plot[{FF[f1, 1 - f1, 0.055, 0.003], FF[f1, 1 - f1, 55, 0.01], FF[f1, 1 - f1, 0.1, 10]}, {f1, 0, 1}, Frame -> True, FrameLabel -> {Subscript[f, 1], Subscript[F, 1]}]
POSTED BY: Maria R
Posted 10 years ago

Thanks for your helps. :D

POSTED BY: ANH MONG
Posted 10 years ago

I am not sure whether I understand you question correctly. Can the following code serve as you need?

Plot[{((1 - f1) f1 + 0.055 f1^2)/(0.003 (1 - f1)^2 + 2 (1 - f1) f1 + 
     0.055 f1^2), ((1 - f1) f1 + 55 f1^2)/(0.01 (1 - f1)^2 + 
     2 (1 - f1) f1 + 55 f1^2), ((1 - f1) f1 + 
     0.1 f1^2)/(10 (1 - f1)^2 + 2 (1 - f1) f1 + 0.1 f1^2), f1}, {f1, 
  0, 1}, Frame -> True, 
 FrameLabel -> {Subscript[f, 1], Subscript[F, 1]}, 
 PlotLegends -> "Expressions"]
POSTED BY: Yushi Wang
Posted 10 years ago

Thanks. My point is when I plotted with code Plot[ ((1 - f1) f1 + 0.055 f1^2)/(0.003 (1 - f1)^2 + 2 (1 - f1) f1 + 0.055 f1^2), {f1,0,1}] the F1, the vertical axis does not show me reaching to the value 1 at f1 =1. I want to know why it was not :)

POSTED BY: ANH MONG
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