<sagecell> var('x,y') #first declare your variables
- We now create each graph one by one.
- We'll name the first plot "p" and then use += to add each equation to the same plot.
p=implicit_plot(x+.7*y==110,(x,0,140),(y,0,140)) #This adds the cookie dough constraint. p+=implicit_plot(.4*y==32,(x,0,140),(y,0,140),color='red') #This adds the icing constraint. p+=implicit_plot(x+y==140,(x,0,140),(y,0,140),color='green') #This adds the baking constraint. p+=implicit_plot(.1*x+.15*y==15,(x,0,140),(y,0,140),color='orange')#This adds the prep time constraint.
- If you want to add more plots, then use "p+=" and then add your plot. Use implicit_plot if you don't want to
Profit = (1.5-.03*(x-60))*x+(2-.03*(y-40))*y Profit = (1.5-.01*(x-60))*x+(2-.01*(y-40))*y Profit = (1.5-.02*(x-60))*x+2*y Profit = (1.5-.01*(x-60))*x+2*y Profit = (1.5)*x+(2)*y p+=implicit_plot(Profit==190,(x,0,140),(y,0,140),color='black') p+=implicit_plot(Profit==200,(x,0,140),(y,0,140),color='black') p+=implicit_plot(Profit==210,(x,0,140),(y,0,140),color='black') p+=implicit_plot(Profit==220,(x,0,140),(y,0,140),color='black') p+=implicit_plot(Profit==230,(x,0,140),(y,0,140),color='black') p+=implicit_plot(Profit==0,(x,0,140),(y,0,140),color='black') p+=implicit_plot(Profit==50,(x,0,140),(y,0,140),color='black') p+=implicit_plot(Profit==100,(x,0,140),(y,0,140),color='black') p+=implicit_plot(Profit==150,(x,0,140),(y,0,140),color='black')
- After you're finished adding plots, use show(p) to have the computer draw your work.
p+=plot_vector_field((Profit.diff(x),Profit.diff(y)),(x,0,140),(y,0,140))
show(p)
sol=solve((x+.7*y==110,.1*x+.15*y==15),(x,y)) show(sol) 1.5*75+2*50
</sagecell>