Skip to main content
added 106 characters in body
Source Link
Bill Watts
  • 8.6k
  • 1
  • 14
  • 32

Second question. Since the diffeq for g is second order, you need another condition, so I added one for its x derivative. I also changed g[x] to g[x,y] in your code. This will not make g vary with y, but NDSolve evidently likes all its dependent variables to be consistent. NDSolve can then solve for the two dependent variables f and g. The following works great in M8 (in my opinion the most stable version), but M11 has problems. M11 should be able to do it.

Clear[f, g] sol = NDSolve[{D[f[x, y], x, y] == D[g[x, y], x]*y, D[g[x, y], {x, 2}] == 2, g[0, y] == 0, (D[g[x, y], x] /. x -> 0) == 0, f[0, y] == 0, f[x, 0] == 0}, {f, g}, {x, 0, 10}, {y, 0, 10}]; Plot3D[Evaluate[f[x, y] /. sol[[1]]], {x, 0, 10}, {y, 0, 10}, PlotRange -> All] 

enter image description here

Plot3D[Evaluate[g[x, y] /. sol[[1]]], {x, 0, 10}, {y, 0, 10}, PlotRange -> All] 

enter image description here

You can see that g only varies with x. In fact in this case it is x^2

Second question. Since the diffeq for g is second order, you need another condition, so I added one for its x derivative. I also changed g[x] to g[x,y] in your code. This will not make g vary with y, but NDSolve evidently likes all its dependent variables to be consistent. NDSolve can then solve for the two dependent variables f and g. The following works great in M8 (in my opinion the most stable version), but M11 has problems.

Clear[f, g] sol = NDSolve[{D[f[x, y], x, y] == D[g[x, y], x]*y, D[g[x, y], {x, 2}] == 2, g[0, y] == 0, (D[g[x, y], x] /. x -> 0) == 0, f[0, y] == 0, f[x, 0] == 0}, {f, g}, {x, 0, 10}, {y, 0, 10}]; Plot3D[Evaluate[f[x, y] /. sol[[1]]], {x, 0, 10}, {y, 0, 10}, PlotRange -> All] 

enter image description here

Plot3D[Evaluate[g[x, y] /. sol[[1]]], {x, 0, 10}, {y, 0, 10}, PlotRange -> All] 

enter image description here

Second question. Since the diffeq for g is second order, you need another condition, so I added one for its x derivative. I also changed g[x] to g[x,y] in your code. This will not make g vary with y, but NDSolve evidently likes all its dependent variables to be consistent. NDSolve can then solve for the two dependent variables f and g. The following works great in M8 (in my opinion the most stable version), but M11 has problems. M11 should be able to do it.

Clear[f, g] sol = NDSolve[{D[f[x, y], x, y] == D[g[x, y], x]*y, D[g[x, y], {x, 2}] == 2, g[0, y] == 0, (D[g[x, y], x] /. x -> 0) == 0, f[0, y] == 0, f[x, 0] == 0}, {f, g}, {x, 0, 10}, {y, 0, 10}]; Plot3D[Evaluate[f[x, y] /. sol[[1]]], {x, 0, 10}, {y, 0, 10}, PlotRange -> All] 

enter image description here

Plot3D[Evaluate[g[x, y] /. sol[[1]]], {x, 0, 10}, {y, 0, 10}, PlotRange -> All] 

enter image description here

You can see that g only varies with x. In fact in this case it is x^2

Source Link
Bill Watts
  • 8.6k
  • 1
  • 14
  • 32

Second question. Since the diffeq for g is second order, you need another condition, so I added one for its x derivative. I also changed g[x] to g[x,y] in your code. This will not make g vary with y, but NDSolve evidently likes all its dependent variables to be consistent. NDSolve can then solve for the two dependent variables f and g. The following works great in M8 (in my opinion the most stable version), but M11 has problems.

Clear[f, g] sol = NDSolve[{D[f[x, y], x, y] == D[g[x, y], x]*y, D[g[x, y], {x, 2}] == 2, g[0, y] == 0, (D[g[x, y], x] /. x -> 0) == 0, f[0, y] == 0, f[x, 0] == 0}, {f, g}, {x, 0, 10}, {y, 0, 10}]; Plot3D[Evaluate[f[x, y] /. sol[[1]]], {x, 0, 10}, {y, 0, 10}, PlotRange -> All] 

enter image description here

Plot3D[Evaluate[g[x, y] /. sol[[1]]], {x, 0, 10}, {y, 0, 10}, PlotRange -> All] 

enter image description here