Message Boards Message Boards

0
|
33942 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Graph derivative or partial derivatives?

Posted 3 years ago

Why can't I graph derivative or partial derivatives in Mathematica?I am trying to plot dc/dt=d2c/dt2+kc(1-c). enter image description here

Here is my code:

Manipulate[
 StreamPlot[{V, Dc'' + Kc (c0 - c)}, {c, -2, 2}, {t, -2, 2}],
 {{k, 1}, -2, 2}, {c0, 1000}]
POSTED BY: k d
5 Replies

Hello,

What do you mean by "Can Mathematica graph a double derivative?"

Can you do that? If so, graph y''.....

Ah, you can't? Exactly, you have to know y to calculate y'' and then you can plot it. So I think you should get a solution for your c and then you may be able to plot almost everything.

But be careful what you are requesting Mathematica to do. Here e.g. I don't know the reason for the error message, I could fix these things in earlier examples but here it doesn't work, so the solution may be totally wrong.

e1 = D[c[x, t], t] == fD  D[c[x, t], x, x] + k c[x, t] (c0 - c[x, t])
e2 = c[x, 0] == 0
e3 = D[c[x, t], x] == .3 /. x -> 0
e4 = c[0, t] == c0 (1 - Exp[-15 t])

vals = {fD -> .03, k -> .9, c0 -> 1.2}
sol = NDSolve[({e1, e2, e3, e4} /. vals),  c, {t, 0, 5}, {x, 0, 10}][[1, 1]]

f = c /. sol

Plot3D[f[x, t], {x, 0, 10}, {t, 0, 5}, PlotRange -> All]
Plot3D[Derivative[0, 1][f][x, t], {x, 0, 10}, {t, 0, 5},PlotRange -> All]
Plot3D[Derivative[2, 0][f][x, t], {x, 0, 10}, {t, 0, 5}, PlotRange -> All]
POSTED BY: Hans Dolhaine

Yes, there is a lot of missing information and bad code used... what is the value of V? I gave V a value and not used the derivate.. So, can you formulate better the problem?

V = 10; Manipulate[
 StreamPlot[{V, c + Kc (c0 - c)}, {c, -2, 2}, {t, -2, 2}], {{Kc, 
   1}, -2, 2}, {c0, 0, 1000}]

Derivate you can do like this or ':

D[c, t]
D[c, {t, 2}]

But what is c? etc

POSTED BY: Claudio Chaib
Posted 3 years ago
Manipulate[
 StreamPlot[{t, D*c'' + K*c (c0 - c)}, {c, -2, 2}, {t, -2, 2}],
 {{K, 1}, -2, 2}, {c0, 3}, {D, 4.17}]

I changed it to this. But c is like an x value, it can have multiple different values.

POSTED BY: k d

Because you don't have a vector field. Look at

https://reference.wolfram.com/language/ref/StreamPlot.html

In your code: what is V, what is D? (Typo: Dc'' should be D c''. but what ist c''?) and so on.....

POSTED BY: Hans Dolhaine
Posted 3 years ago
Manipulate[
 StreamPlot[{t, D*c'' + K*c (c0 - c)}, {c, -2, 2}, {t, -2, 2}],
 {{K, 1}, -2, 2}, {c0, 3}, {D, 4.17}]

I fixed it V should have been t. And D should be defined. However the graph is still blank. It has to do with the c''. Can Mathematica graph a double derivative?

POSTED BY: Updating Name
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