# Revision history [back]

### Typesetting Simple Student Worksheet Question & need to defer computation

I have

eq1=2*(x+10)/5==3*(6-5*x)/7


the command print latex(eq1) simplifies the equation to $$\frac{2}{5} x + 4 = -\frac{15}{7} x + \frac{18}{7}$$

is there somthing like latex(eq1.hold()) that would produce

$$\frac{2(x+3)}{5}=\frac{3(6-5x)}{7}$$

### Typesetting Simple Student Worksheet Question & need to defer computation

I have

eq1=2*(x+10)/5==3*(6-5*x)/7


the command print latex(eq1) simplifies the equation to $$\frac{2}{5} x + 4 = -\frac{15}{7} x + \frac{18}{7}$$

is there somthing something like latex(eq1.hold()) that would produce

$$\frac{2(x+3)}{5}=\frac{3(6-5x)}{7}$$

### Typesetting Simple Student Worksheet Question & need to defer computation

I have

eq1=2*(x+10)/5==3*(6-5*x)/7


the command print latex(eq1) simplifies the equation to $$\frac{2}{5} x + 4 = -\frac{15}{7} x + \frac{18}{7}$$

is there something like latex(eq1.hold()) that would produce

$$\frac{2(x+3)}{5}=\frac{3(6-5x)}{7}$$

edit:

ri = lambda x,y:  floor(round(random()*(y-x)+x));
ls = [ri(-5,-1),ri(1,3),ri(2,15),ri(2,15)];
rs = [ri(2,10),ri(-3,-1),ri(-6,-2),ri(2,15)];

def texLinearA(t): return "$\\frac{"+str(latex(t[0]))+"\\left("+str(latex(t[1]))+"+"+str(latex(t[2]))+"x\\right)}{"+str(latex(t[3]))+"}$";

def sageLinearA(t): x=var("x"); return  t[0]*(t[1]+t[2]*x)/t[3];

eq1 = texLinearA(ls)+"="+texLinearA(rs);
eq2 = sageLinearA(ls)==sageLinearA(rs);
eq3 = eq2*lcm(ls[3],rs[3]);
eq4=eq3-x*eq3.rhs().coefficient(x);
eq5=eq4-(eq4.lhs()).substitute(x=0);
eq6=eq5*(1/eq5.lhs().coefficient(x));

html(eq1);
show(eq2);
show(eq3);
show(eq4);
show(eq5);


### Typesetting Simple Student Worksheet Question & need to defer computation

I have

eq1=2*(x+10)/5==3*(6-5*x)/7


the command print latex(eq1) simplifies the equation to $$\frac{2}{5} x + 4 = -\frac{15}{7} x + \frac{18}{7}$$

is there something like latex(eq1.hold()) that would produce

$$\frac{2(x+3)}{5}=\frac{3(6-5x)}{7}$$

edit:edit: I must apologize in advanced as my code may seem infantile but I am very new to this and trying to learn. That said, I was able to get something going but it seems to me there must be a million better ways to do this. Can you point me in the right direction to generalize this process and improve this code. Keep in mind the point of this is to write a student worksheet with problem sets and solutions.

ri = lambda x,y:  floor(round(random()*(y-x)+x));
ls = [ri(-5,-1),ri(1,3),ri(2,15),ri(2,15)];
rs = [ri(2,10),ri(-3,-1),ri(-6,-2),ri(2,15)];

def texLinearA(t): return "$\\frac{"+str(latex(t[0]))+"\\left("+str(latex(t[1]))+"+"+str(latex(t[2]))+"x\\right)}{"+str(latex(t[3]))+"}$";

def sageLinearA(t): x=var("x"); return  t[0]*(t[1]+t[2]*x)/t[3];

eq1 = texLinearA(ls)+"="+texLinearA(rs);
eq2 = sageLinearA(ls)==sageLinearA(rs);
eq3 = eq2*lcm(ls[3],rs[3]);
eq4=eq3-x*eq3.rhs().coefficient(x);
eq5=eq4-(eq4.lhs()).substitute(x=0);
eq6=eq5*(1/eq5.lhs().coefficient(x));

html(eq1);
show(eq2);
show(eq3);
show(eq4);
show(eq5);


### Typesetting Simple Student Worksheet Question & need to defer computation

I have

eq1=2*(x+10)/5==3*(6-5*x)/7


the command print latex(eq1) simplifies the equation to $$\frac{2}{5} x + 4 = -\frac{15}{7} x + \frac{18}{7}$$

is there something like latex(eq1.hold()) that would produce

$$\frac{2(x+3)}{5}=\frac{3(6-5x)}{7}$$

edit: I must apologize in advanced as my code may seem infantile but I am very new to this and trying to learn. That said, I was able to get something going but it seems to me there must be a million better ways to do this. Can you point me in the right direction to generalize this process and improve this code. Keep in mind the point of this is to write a student worksheet with problem sets and solutions.

ri = lambda x,y:  floor(round(random()*(y-x)+x));
floor(round(random()*(y-x)+x)); #random integer
ls = [ri(-5,-1),ri(1,3),ri(2,15),ri(2,15)];
rs = [ri(2,10),ri(-3,-1),ri(-6,-2),ri(2,15)];

def texLinearA(t): return "$\\frac{"+str(latex(t[0]))+"\\left("+str(latex(t[1]))+"+"+str(latex(t[2]))+"x\\right)}{"+str(latex(t[3]))+"}$";

def sageLinearA(t): x=var("x"); return  t[0]*(t[1]+t[2]*x)/t[3];

eq1 = texLinearA(ls)+"="+texLinearA(rs);
eq2 = sageLinearA(ls)==sageLinearA(rs);
eq3 = eq2*lcm(ls[3],rs[3]);
eq4=eq3-x*eq3.rhs().coefficient(x);
eq5=eq4-(eq4.lhs()).substitute(x=0);
eq6=eq5*(1/eq5.lhs().coefficient(x));

html(eq1);
show(eq2);
show(eq3);
show(eq4);
show(eq5);


### Typesetting Simple Student Worksheet Question & need to defer computation

I have

eq1=2*(x+10)/5==3*(6-5*x)/7


the command print latex(eq1) simplifies the equation to $$\frac{2}{5} x + 4 = -\frac{15}{7} x + \frac{18}{7}$$

is there something like latex(eq1.hold()) that would produce

$$\frac{2(x+3)}{5}=\frac{3(6-5x)}{7}$$

edit: I must apologize in advanced as my code may seem infantile but I am very new to this and trying to learn. That said, I was able to get something going but it seems to me there must be a million better ways to do this. Can you point me in the right direction to generalize this process and improve this code. Keep in mind the point of this is to write a student worksheet with problem sets and solutions.

ri = lambda x,y:  floor(round(random()*(y-x)+x)); #random integer
integer from x to y
ls = [ri(-5,-1),ri(1,3),ri(2,15),ri(2,15)];
rs = [ri(2,10),ri(-3,-1),ri(-6,-2),ri(2,15)];

def texLinearA(t): return "$\\frac{"+str(latex(t[0]))+"\\left("+str(latex(t[1]))+"+"+str(latex(t[2]))+"x\\right)}{"+str(latex(t[3]))+"}$";

def sageLinearA(t): x=var("x"); return  t[0]*(t[1]+t[2]*x)/t[3];

eq1 = texLinearA(ls)+"="+texLinearA(rs);
eq2 = sageLinearA(ls)==sageLinearA(rs);
eq3 = eq2*lcm(ls[3],rs[3]);
eq4=eq3-x*eq3.rhs().coefficient(x);
eq5=eq4-(eq4.lhs()).substitute(x=0);
eq6=eq5*(1/eq5.lhs().coefficient(x));

html(eq1);
show(eq2);
show(eq3);
show(eq4);
show(eq5);


### Typesetting Simple Student Worksheet Question & need to defer computation

I have

eq1=2*(x+10)/5==3*(6-5*x)/7


the command print latex(eq1) simplifies the equation to $$\frac{2}{5} x + 4 = -\frac{15}{7} x + \frac{18}{7}$$

is there something like latex(eq1.hold()) that would produce

$$\frac{2(x+3)}{5}=\frac{3(6-5x)}{7}$$

edit: I must apologize in advanced as my code may seem infantile but I am very new to this and trying to learn. That said, I was able to get something going but it seems to me there must be a million better ways to do this. Can you point me in the right direction to generalize this process and improve this code. Keep in mind the point of this is to write a student worksheet with problem sets and solutions.solutions. can be seen here link text

ri = lambda x,y:  floor(round(random()*(y-x)+x)); #random integer from x to y
ls = [ri(-5,-1),ri(1,3),ri(2,15),ri(2,15)];
rs = [ri(2,10),ri(-3,-1),ri(-6,-2),ri(2,15)];

def texLinearA(t): return "$\\frac{"+str(latex(t[0]))+"\\left("+str(latex(t[1]))+"+"+str(latex(t[2]))+"x\\right)}{"+str(latex(t[3]))+"}$";

def sageLinearA(t): x=var("x"); return  t[0]*(t[1]+t[2]*x)/t[3];

eq1 = texLinearA(ls)+"="+texLinearA(rs);
eq2 = sageLinearA(ls)==sageLinearA(rs);
eq3 = eq2*lcm(ls[3],rs[3]);
eq4=eq3-x*eq3.rhs().coefficient(x);
eq5=eq4-(eq4.lhs()).substitute(x=0);
eq6=eq5*(1/eq5.lhs().coefficient(x));

html(eq1);
show(eq2);
show(eq3);
show(eq4);
show(eq5);