mailing-list for TeXmacs Users

Text archives Help


[TeXmacs] Example of a step by step solution of an equation using Maxima and a Numeric Spreadsheet in TeXmacs


Chronological Thread 
  • From: "Adrian S." <address@hidden>
  • To: texmacs-users <address@hidden>
  • Subject: [TeXmacs] Example of a step by step solution of an equation using Maxima and a Numeric Spreadsheet in TeXmacs
  • Date: Thu, 28 Apr 2016 13:54:57 -0500

I made an example of a numeric Spreadsheet using TeXmacs and Maxima to
show how to solve an linear equation in the variable of choice.

It still has bugs, since it uses map(factor, ....) which does not do
as intended if one does not have a sum of more than one term in the
equation.

I hope this is useful to someone. If someone makes a better version,
let me know.

Peace.
-A.
<TeXmacs|1.99.3>

<style|generic>

<\body>
  <doc-data|<doc-title|Solving a linear equation
  Step-by-Step>|<doc-author|<author-data|<author-name|Adrián Soto>>>>

  The following solves, step by step, an equation of degree one in the
  variable of choice.\ 

  <calc-input|field6||><calc-table|equacion1|<numeric-dot-table|<tformat|<table|<row|<cell|<cell-inert|a1|<with|color|red|Type>
  the equation you want to solve>>|<cell|<cell-inert|b1|<math|r*<around*|(|c+<frac|1|3>|)>=<around*|(|<frac|x-a|b-x>+<frac|1|3>|)>*d>>>>|<row|<cell|<cell-inert|a2|<with|color|red|Type>
  \ the variable you want to solve for>>|<cell|<cell-inert|b2|<math|x>>>>|<row|<cell|<cell-inert|a3|Maxima
  Distributes>>|<cell|<cell-output|b3|=distrib(b1)|<math|c*r+<frac|r|3>=<frac|d*<around*|(|x-a|)>|b-x>+<frac|d|3>>>>>|<row|<cell|<cell-inert|a4|Maxima
  factors all the denominators>>|<cell|<cell-output|b4|=map(factor,(lhs(b3)))=map(factor,rhs(b3))|<math|c*r+<frac|r|3>=<frac|d|3>-<frac|d*<around*|(|x-a|)>|x-b>>>>>|<row|<cell|<cell-inert|a5|Maxima
  finds the LCM of the denominators>>|<cell|<cell-output|b5|=factor(denom(lhs(xthru(b4)))*denom(rhs(xthru(b4)))/gcd(denom(lhs(xthru(b4))),denom(rhs(xthru(b4)))))|<math|3*<around*|(|x-b|)>>>>>|<row|<cell|<cell-inert|a6|Maxima
  multiplies both sides by the LCM>>|<cell|<cell-output|b6|=b5*b4|<math|3*<around*|(|c*r+<frac|r|3>|)>*<around*|(|x-b|)>=3*<around*|(|x-b|)>*<around*|(|<frac|d|3>-<frac|d*<around*|(|x-a|)>|x-b>|)>>>>>|<row|<cell|<cell-inert|a7|Maxima
  distributes and simplifies>>|<cell|<cell-output|b7|=multthru(b5,b4)|
  <math|3*c*r*<around*|(|x-b|)>+r*<around*|(|x-b|)>=d*<around*|(|x-b|)>-3*d*<around*|(|x-a|)>>>>>|<row|<cell|<cell-inert|a8|Maxima
  distributes>>|<cell|<cell-output|b8|=expand(b7)|<math|3*c*r*x+r*x-3*b*c*r-b*r=-2*d*x-b*d+3*a*d>>>>|<row|<cell|<cell-inert|a9|Maxima
  determines if it is a linear equation>>|<cell|<cell-output|b9|=is(diff(lhs(b8)-rhs(b8),b2,2)=0)|<math|<math-bf|true>>>>>|<row|<cell|<cell-inert|a10|Maxima
  shuffles the terms we want on the left>>|<cell|<cell-output|b10|=if b9 then
  expand(diff(lhs(b8)-rhs(b8),b2)*b2)=expand(rhs(b8)-lhs(b8)-diff(rhs(b8)-lhs(b8),b2)*b2)|
  <math|3*c*r*x+r*x+2*d*x=3*b*c*r+b*r-b*d+3*a*d>>>>|<row|<cell|<cell-inert|a11|Maxima
  factors out the letter we want >>|<cell|<cell-output|b11|=if b9 then
  collectterms(lhs(b10),b2)=rhs(b10)| <math|<around*|(|3*c*r+r+2*d|)>*x=3*b*c*r+b*r-b*d+3*a*d>>>>|<row|<cell|<cell-inert|a12|Maxima
  divides by the coefficient>>|<cell|<cell-output|b12|=if b9 then
  b2=rhs(b11)/diff(lhs(b11),b2)| <math|x=<frac|3*b*c*r+b*r-b*d+3*a*d|3*c*r+r+2*d>>>>>>>>>
</body>

<\initial>
  <\collection>
    <associate|page-medium|paper>
    <associate|page-orientation|landscape>
    <associate|page-type|letter>
    <associate|prog-scripts|maxima>
  </collection>
</initial>

<\references>
  <\collection>
    <associate|auto-1|<tuple|1|?>>
  </collection>
</references>


  • [TeXmacs] Example of a step by step solution of an equation using Maxima and a Numeric Spreadsheet in TeXmacs, Adrian S., 04/28/2016

Archive powered by MHonArc 2.6.19.

Top of page