1
$\begingroup$

This question already has an answer here:

Hi I'm trying to visualize a 2D equation that I have previously solved as I vary a parameter 'b'. First I solve for 'y' in terms of 'x' and 'b', then I intend to use Manipulate.

sol = Solve[y+b==2*x,y]
Manipulate[Plot[y/.sol,{x,-1,1}],{b,-2,2}]

In this simplified example I'm expecting a line of slope 2 to move up and down as I vary 'b' but I just get a blank graph.

$\endgroup$

marked as duplicate by Kuba plotting Sep 30 '18 at 16:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0
$\begingroup$

This is a tricky. The problem is that the argument b needs to appear explicitly in the Manipulate expression. One solution, perhaps not simplest, is as follows

sol = Solve[y + b == 2*x, y]
y1[x_, b_] = y /. sol[[1, 1]]
Manipulate[Plot[y1[x, b], {x, -1, 1}], {b, -2, 2}]
$\endgroup$
  • $\begingroup$ I understand, thank you! It's strange that Manipulate can't handle 'b' implicitly.. but this still works :) Thanks! $\endgroup$ – Matthew James Sep 30 '18 at 11:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.