0
|
15753 Views
|
6 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

# How to plot the graph?

Posted 11 years ago
 DSolve[{Derivative[2][Subscript[u, 00]][y] +       Rey*S*Derivative[1][Subscript[u, 00]][y] == -Rey*      Gr*((E^(Pr Rey S - Pr Rey S y) (-1 + E^(Pr Rey S y)))/(-1 + E^(        Pr Re S))),     Subscript[u, 00][0] == h*Derivative[1][Subscript[u, 00]][0],     Subscript[u, 00][1] == 1}, Subscript[u, 00][y], y] // FullSimplify  {{Subscript[u, 0][     y] -> (E^(-Rey S (Pr (-1 + y) + y)) (-E^(Rey S y) Gr -         E^(S (Rey + Pr (Re + Rey (-1 + y)))) (-1 + Pr) Pr Rey S^2 +         E^(Rey S (1 + y)) Gr (1 + h Rey S) +         E^(S (Pr Re + Rey + Pr Rey (-1 + y) + Rey y)) (-1 +            Pr) Pr Rey S^2 (1 + h Rey S) -         E^(Rey S (1 + Pr y)) Gr (1 + Pr (-1 + Pr + h Pr) Rey S) +         E^(Rey S (1 + Pr (-1 + y))) (Gr + (-1 + Pr) Pr Rey S^2) -         E^(Rey S (1 + Pr (-1 + y) + y)) (1 +            h Rey S) (Gr + (-1 + Pr) Pr Rey S^2) -         E^(Rey S (1 + y + Pr y))          Gr (-1 + Pr) Pr Rey S (1 + h Rey S) (-1 + y) +         E^((1 + Pr) Rey S y)          Gr (1 + Pr Rey S (h Pr + (-1 + Pr) y))))/((-1 + E^(        Pr Re S)) (-1 + Pr) Pr Rey S^2 (-1 +         E^(Rey S) (1 + h Rey S)))}}Plot[Subscript[u, 00][y], {y, 0, 1}]When I try to plot this u00, the plot was empty. why?
6 Replies
Sort By:
Posted 11 years ago
 The next thing you need to do, aside from supplying numerical values to your variables, is to give your rule a name. Let's just call it ruel for now: In[5]:= ruel =   DSolve[{Derivative[2][Subscript[u, 0, 0]][y] +        Rey*S*Derivative[1][Subscript[u, 0, 0]][y] == -Rey*       Gr*((E^(Pr Rey S - Pr Rey S y) (-1 + E^(Pr Rey S y)))/(-1 +            E^(Pr Rey S))),      Subscript[u, 0, 0][0] == h*Derivative[1][Subscript[u, 0, 0]][0],      Subscript[u, 0, 0][1] == 1}, Subscript[u, 0, 0][y], y] //    FullSimplify Out[5]= {{Subscript[u, 0, 0][    y] -> (E^(-Rey S (Pr (-1 + y) + y)) (-E^(Rey S y) Gr +         E^(Rey S (1 + y)) Gr (1 + h Rey S) +         E^(Rey S (1 + Pr (-1 + y))) (Gr + (-1 + Pr) Pr Rey S^2) -         E^(Rey S (1 + Pr (-1 + y) + y)) (1 +            h Rey S) (Gr + (-1 + Pr) Pr Rey S^2) -         E^(Rey S (1 + Pr y)) (Gr +            Gr Pr (-1 + Pr + h Pr) Rey S + (-1 + Pr) Pr Rey S^2) +         E^(Rey S (1 + y + Pr y)) (-1 + Pr) Pr Rey S (1 +            h Rey S) (Gr + S - Gr y) +         E^((1 + Pr) Rey S y)          Gr (1 + Pr Rey S (h Pr + (-1 + Pr) y))))/((-1 + E^(        Pr Rey S)) (-1 + Pr) Pr Rey S^2 (-1 +         E^(Rey S) (1 + h Rey S)))}}What happens when we just print ruel then? Let's find out: In[6]:= ruel  Out[6]= {{Subscript[u, 0, 0][     y] -> (E^(-Rey S (Pr (-1 + y) + y)) (-E^(Rey S y) Gr +          E^(Rey S (1 + y)) Gr (1 + h Rey S) +          E^(Rey S (1 + Pr (-1 + y))) (Gr + (-1 + Pr) Pr Rey S^2) -          E^(Rey S (1 + Pr (-1 + y) + y)) (1 +             h Rey S) (Gr + (-1 + Pr) Pr Rey S^2) -          E^(Rey S (1 + Pr y)) (Gr +            Gr Pr (-1 + Pr + h Pr) Rey S + (-1 + Pr) Pr Rey S^2) +         E^(Rey S (1 + y + Pr y)) (-1 + Pr) Pr Rey S (1 +            h Rey S) (Gr + S - Gr y) +         E^((1 + Pr) Rey S y)          Gr (1 + Pr Rey S (h Pr + (-1 + Pr) y))))/((-1 + E^(        Pr Rey S)) (-1 + Pr) Pr Rey S^2 (-1 +         E^(Rey S) (1 + h Rey S)))}}Now we have given the rule a name, we can (this would my preference) strip away the outer brackets by taking the innermost part of the rule, like so: In[7]:= ruel[[1, 1]]  Out[7]= Subscript[u, 0, 0][   y] -> (E^(-Rey S (Pr (-1 + y) + y)) (-E^(Rey S y) Gr +        E^(Rey S (1 + y)) Gr (1 + h Rey S) +        E^(Rey S (1 + Pr (-1 + y))) (Gr + (-1 + Pr) Pr Rey S^2) -        E^(Rey S (1 + Pr (-1 + y) + y)) (1 +           h Rey S) (Gr + (-1 + Pr) Pr Rey S^2) -        E^(Rey S (1 + Pr y)) (Gr +          Gr Pr (-1 + Pr + h Pr) Rey S + (-1 + Pr) Pr Rey S^2) +       E^(Rey S (1 + y + Pr y)) (-1 + Pr) Pr Rey S (1 + h Rey S) (Gr +          S - Gr y) +       E^((1 + Pr) Rey S y)        Gr (1 + Pr Rey S (h Pr + (-1 + Pr) y))))/((-1 + E^(      Pr Rey S)) (-1 + Pr) Pr Rey S^2 (-1 + E^(Rey S) (1 + h Rey S)))That would be my preference in making use of a rule.Let's make use of our rule in replacing the original variable u 00 [ y ] by using the replace part symbol /.: In[8]:= Subscript[u, 0, 0][y] /. ruel[[1, 1]]  Out[8]= (E^(-Rey S (Pr (-1 + y) + y)) (-E^(Rey S y) Gr +       E^(Rey S (1 + y)) Gr (1 + h Rey S) +       E^(Rey S (1 + Pr (-1 + y))) (Gr + (-1 + Pr) Pr Rey S^2) -       E^(Rey S (1 + Pr (-1 + y) + y)) (1 +          h Rey S) (Gr + (-1 + Pr) Pr Rey S^2) -       E^(Rey S (1 + Pr y)) (Gr +          Gr Pr (-1 + Pr + h Pr) Rey S + (-1 + Pr) Pr Rey S^2) +      E^(Rey S (1 + y + Pr y)) (-1 + Pr) Pr Rey S (1 + h Rey S) (Gr +         S - Gr y) +      E^((1 + Pr) Rey S y)       Gr (1 + Pr Rey S (h Pr + (-1 + Pr) y))))/((-1 + E^(     Pr Rey S)) (-1 + Pr) Pr Rey S^2 (-1 + E^(Rey S) (1 + h Rey S)))We still haven't set u 00 [ y ] equal to anything, but once we do then it will only be necessary to supply some numbers to your variables and hopefully your problem will be ready to Plot.You could use the rule and replace part ( this symbol, the slash and dot ? /. is known as replace part ) in plotting, or you could set u 0,0 [ y ] equal to the material indicated in the rule.Here we set u 0,0 [ y ] equal to the material indicated in the rule: In[9]:= Subscript[u, 0, 0][y] = Subscript[u, 0, 0][y] /. ruel[[1, 1]]  Out[9]= (E^(-Rey S (Pr (-1 + y) + y)) (-E^(Rey S y) Gr +       E^(Rey S (1 + y)) Gr (1 + h Rey S) +       E^(Rey S (1 + Pr (-1 + y))) (Gr + (-1 + Pr) Pr Rey S^2) -       E^(Rey S (1 + Pr (-1 + y) + y)) (1 +          h Rey S) (Gr + (-1 + Pr) Pr Rey S^2) -       E^(Rey S (1 + Pr y)) (Gr +          Gr Pr (-1 + Pr + h Pr) Rey S + (-1 + Pr) Pr Rey S^2) +      E^(Rey S (1 + y + Pr y)) (-1 + Pr) Pr Rey S (1 + h Rey S) (Gr +         S - Gr y) +      E^((1 + Pr) Rey S y)       Gr (1 + Pr Rey S (h Pr + (-1 + Pr) y))))/((-1 + E^(     Pr Rey S)) (-1 + Pr) Pr Rey S^2 (-1 + E^(Rey S) (1 + h Rey S)))What happens when we just write down u 0,0 [ y ]? Let's take a look: In[10]:= Subscript[u, 0, 0][y]  Out[10]= (E^(-Rey S (Pr (-1 + y) + y)) (-E^(Rey S y) Gr +       E^(Rey S (1 + y)) Gr (1 + h Rey S) +       E^(Rey S (1 + Pr (-1 + y))) (Gr + (-1 + Pr) Pr Rey S^2) -       E^(Rey S (1 + Pr (-1 + y) + y)) (1 +          h Rey S) (Gr + (-1 + Pr) Pr Rey S^2) -       E^(Rey S (1 + Pr y)) (Gr +          Gr Pr (-1 + Pr + h Pr) Rey S + (-1 + Pr) Pr Rey S^2) +      E^(Rey S (1 + y + Pr y)) (-1 + Pr) Pr Rey S (1 + h Rey S) (Gr +         S - Gr y) +      E^((1 + Pr) Rey S y)       Gr (1 + Pr Rey S (h Pr + (-1 + Pr) y))))/((-1 + E^(     Pr Rey S)) (-1 + Pr) Pr Rey S^2 (-1 + E^(Rey S) (1 + h Rey S)))You could probably Plot that if only those numbers meant something.I say probably, because without knowing if the formula would give purely real results or complex ones I can't say for sure. If you supply numbers which end up giving complex results, it still won't Plot and you will have to decide which part you want to look at, the real part Re[ ] or the imaginary part Im[ ].
Posted 11 years ago
 Personally, I think the double zero subscript is just a big distraction, but if you want to use it maybe you should put a zero in between the zeros:Subscript[u, 0, 0][y]If you wanted more zeros in your subscripts, you could then do it like so:Subscript[u, 0, 0, 0][y]or if you wanted four zeros:Subscript[u, 0, 0, 0, 0][y]At this stage of the game, I would have settled for plain old u without the subscripts.I was so tired from fighting my own problem last night that I didn't realize that the reason you were only getting one subscript is that the two zeros were being multiplied together. I never use subscripts myself.You still haven't supplied numbers for Rey, Pr, Gr, S or h, and without some numbers your problem is going to be too abstract and indeterminant for Plot to work with.I suppose you're working on something having to do with heat transfer or fluid dynamics and Rey is a Reynolds number, Pr is a Prandtl number, and Gr is a Grashof number. I have no idea what S would be - entropy? Would h be height? You still need to give those symbols numerical values before you can use Plot.Also, at one point in your problem, you have Re (in black) instead of Rey (in blue). Re is a pre-defined Mathematica symbol meaning "to take the real part of a complex number", like so:In[3]:= Re[5 + 2 I]Out[3]= 5Here's the first part of your problem again, this time with a comma in between the zeros: In[1]:= DSolve[{Derivative[2][Subscript[u, 0, 0]][y] +       Rey*S*Derivative[1][Subscript[u, 0, 0]][y] == -Rey*      Gr*((E^(Pr Rey S - Pr Rey S y) (-1 + E^(Pr Rey S y)))/(-1 +           E^(Pr Re S))),     Subscript[u, 0, 0][0] == h*Derivative[1][Subscript[u, 0, 0]][0],     Subscript[u, 0, 0][1] == 1}, Subscript[u, 0, 0][y],    y] // FullSimplify  Out[1]= {{Subscript[u, 0, 0][    y] -> (E^(-Rey S (Pr (-1 + y) + y)) (-E^(Rey S y) Gr -         E^(S (Rey + Pr (Re + Rey (-1 + y)))) (-1 + Pr) Pr Rey S^2 +         E^(Rey S (1 + y)) Gr (1 + h Rey S) +         E^(S (Pr Re + Rey + Pr Rey (-1 + y) + Rey y)) (-1 +            Pr) Pr Rey S^2 (1 + h Rey S) -         E^(Rey S (1 + Pr y)) Gr (1 + Pr (-1 + Pr + h Pr) Rey S) +         E^(Rey S (1 + Pr (-1 + y))) (Gr + (-1 + Pr) Pr Rey S^2) -         E^(Rey S (1 + Pr (-1 + y) + y)) (1 +            h Rey S) (Gr + (-1 + Pr) Pr Rey S^2) -         E^(Rey S (1 + y + Pr y))          Gr (-1 + Pr) Pr Rey S (1 + h Rey S) (-1 + y) +         E^((1 + Pr) Rey S y)          Gr (1 + Pr Rey S (h Pr + (-1 + Pr) y))))/((-1 + E^(        Pr Re S)) (-1 + Pr) Pr Rey S^2 (-1 +         E^(Rey S) (1 + h Rey S)))}}And in the following bit of Mathematica code I have "corrected" what I suspect is a typo involving Rey and Re: In[4]:= DSolve[{Derivative[2][Subscript[u, 0, 0]][y] +       Rey*S*Derivative[1][Subscript[u, 0, 0]][y] == -Rey*      Gr*((E^(Pr Rey S - Pr Rey S y) (-1 + E^(Pr Rey S y)))/(-1 +           E^(Pr Rey S))),     Subscript[u, 0, 0][0] == h*Derivative[1][Subscript[u, 0, 0]][0],     Subscript[u, 0, 0][1] == 1}, Subscript[u, 0, 0][y],    y] // FullSimplify  Out[4]= {{Subscript[u, 0, 0][    y] -> (E^(-Rey S (Pr (-1 + y) + y)) (-E^(Rey S y) Gr +         E^(Rey S (1 + y)) Gr (1 + h Rey S) +         E^(Rey S (1 + Pr (-1 + y))) (Gr + (-1 + Pr) Pr Rey S^2) -         E^(Rey S (1 + Pr (-1 + y) + y)) (1 +            h Rey S) (Gr + (-1 + Pr) Pr Rey S^2) -         E^(Rey S (1 + Pr y)) (Gr +            Gr Pr (-1 + Pr + h Pr) Rey S + (-1 + Pr) Pr Rey S^2) +         E^(Rey S (1 + y + Pr y)) (-1 + Pr) Pr Rey S (1 +            h Rey S) (Gr + S - Gr y) +         E^((1 + Pr) Rey S y)          Gr (1 + Pr Rey S (h Pr + (-1 + Pr) y))))/((-1 + E^(        Pr Rey S)) (-1 + Pr) Pr Rey S^2 (-1 +         E^(Rey S) (1 + h Rey S)))}}
Posted 11 years ago
 When I abstract your differential equation from DSolve and print it out by itself before having done any processing, it appears that Mathematica won't take the second zero in the subscript. Here is the equation all by itself: In[39]:= Derivative[2][Subscript[u, 00]][y] +    Rey*S*Derivative[1][Subscript[u, 00]][y] == -Rey*   Gr*((E^(Pr Rey S - Pr Rey S y) (-1 + E^(Pr Rey S y)))/(-1 +        E^(Pr Re S)))  Out[39]= Rey S Derivative[1][Subscript[u, 0]][y] + (Subscript[u,     0]^\[Prime]\[Prime])[y] == -((   E^(Pr Rey S - Pr Rey S y) (-1 + E^(Pr Rey S y)) Gr Rey)/(-1 + E^(    Pr Re S)))When you copy and paste the stuff after Out[39] into Mathematica, you will see that the second subsrcipted 0 is gone even before anything else has been done.
Posted 11 years ago
 There appears to be several possible reasons:What I take to be variables Rey, S, Gr, S, Pr and h do not appear to have any values associated wtih them, thus they are purely abstract symbols. Plot ultimately has to have either closed form formulas with numbers to work with or Interpolation type functions to work with.The rule that DSolve has come up with refers to u subscript 0, not u subscript 00 as in the equations in DSolve. Did you somehow delete a zero?There hasn't been anything set to equal the replace part rule, thus it could not yet have been used in Plot even if it had been employed.I find that it's always best to strip away the outer brackets from rules, and I don't see that that has yet been done.The rule hasn't been employed in Plot, thus u subscript 00 is still an empty symbol.In summary, unless those symbols have some inherent meaning I don't understand, you are still several steps away from being able to Plot because the whole thing is still too abstract.
Posted 11 years ago
 I had changed Subscript[u,00] to Subscript[u,0]. Eventhough the plot was still empty.
Posted 11 years ago
 Hello, please post copyable code! Take a few minutes to read this tutorial about correct posting  especially of Mathematica code:How to type up a post: editor tutorial & general tipsIf you will not follow the tutorial, other members of community may not be able to test your code. To edit your post  click Edit in the lower right corner of your post.