5

I will ask a simple question and might have an issue on the site that explains better about it, but not found.

I am formulating a code that defines me an equation that I can generate a plot.

m = {{1, 1, 1}, {1, 2, 3}, {1, 4, 9}};
b = {1, 2, 3};
abc=LinearSolve[m, b]
f=abc[[1]]*x+ abc[[2]]*y+ abc[[3]]*z
sol=Solve[f==0,z]
Plot3D[sol,{x,0,15},{y,0,15}]

Or

Plot3D[z,{x,0,15},{y,0,15}]

I'm realizing that there is a mistake, but I do not know how to get an equation from LinearSolve output.

LCarvalho
  • 9,233
  • 4
  • 40
  • 96

1 Answers1

3

Solve is one of the functions that returns a list of rules and you need to use the /. Replace All command. Read: http://support.wolfram.com/kb/12505

m = {{1, 1, 1}, {1, 2, 3}, {1, 4, 9}};
b = {1, 2, 3};
abc = LinearSolve[m, b]
f = Dot[abc, {x, y, z}]
sol = Solve[f == 0, z]
Plot3D[z /. sol, {x, 0, 15}, {y, 0, 15}]

enter image description here

And as J.M. mentioned f= Dot [abc, {x, y, z}]is the same as f = abc[[1]]*x + abc[[2]]*y + abc[[3]]*z

Young
  • 7,495
  • 1
  • 20
  • 45