ConceptualComputational

Straight lines

Formatting

DarkGreen:=Green//Darker//Darker

labelst[str_]:=Style[str,14,FontFamily->"Arial",Background->White]

myn[n_]:=labelst[If[Abs[n]<.0001,NumberForm[0.0,4],NumberForm[n,4]]]

myn[8.0^-5]

Head[myn[8.9]]

labelst[cu["a"]//TraditionalForm]

Remove[fsty]

fsty[f_,x_]:=Text[labelst[f[x]]//TraditionalForm]

fsty[cu,"a"]

Point-slope form

ptsl[m_,p_,x_]:=m x+ p[[2]]-m p[[1]]

ptsl[m_,p_,x_]:=m (x-p[[1]])+ p[[2]]//Simplify

ptsl[3,{1,2},x]

Two-point form

tpl[p_,q_,x_]:=(p[[2]]-q[[2]])/(p[[1]]-q[[1]])(x-p[[1]])+p[[2]]//Simplify

tpl[{1,2},{0,-1},x]

tpl[{0,-1},{1,2},x]

tpl[{1,4},{5,2},x]

Intersection of projections

Given two points, find intersection of horizontal line through one point and vertical line through the other

wh[{a1_,a2_},{b1_,b2_}]:={b1,a2}

wh[{.3,.5},{.8,.6}]

Definitions

Definitions

cu[x_]:=x^3-x;cud[x_]:=cu'[x]

labelst[str_]:=Style[str,14,FontFamily->"Arial",Background->White];
tline[a_,x_]:=ptsl[cud[a],{a,cu[a]},x];
(*offs:=.3;*)
u[x_,offs_]:={x+offs,ptsl[cud[x],{x,cu[x]},x+offs]};
v[x_,offs_]:={x-offs,ptsl[cud[x],{x,cu[x]},x-offs]};
corner[x_,offs_]:={v[x,offs][[1]],u[x,offs][[2]]};
secline[a_,b_,x_]:=If[
a==b,
ptsl[cud[a],{a,cu[a]},x],
tpl[{a,cu[a]},{b,cu[b]},x]
]

corner[.8,.3]

corner[x,.3]

secline[.9,1.2,x]

Graphics[{Thick,PointSize[Large],
Line[{{0,0},{3,0}}],
Point[{1,0}],Point[{2,0}],Inset[Style[x,18],{1,-.1}],Inset[Style[y,18],{2,-.1}]
},
PlotRange->{{0,3},{-.2,.2}}
]