algebra.txt 879 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. %%%%%%%%%%%%%%%%%%%%%
  2. % ALGEBRA (SOLVE)
  3. %%%%%%%%%%%%%%%%%%%%%
  4. % Solve quadratic equation
  5. solve(x^2+8x+15=0, x);
  6. % Solve for expression
  7. solve(a*log(sin(x+3))^2 - b, sin(x+3));
  8. % Solve simultaneous equations
  9. solve({x+3y=7, y-x=1},{x,y});
  10. % Solve a system with parameters
  11. solve({x=a*z+1, y=b*z},{z,x});
  12. % Simplify expression
  13. ((((-r1*(1+k1))/(r2*(1+k2)))+((r1)/(r2)))/(((r1)/(r2))));
  14. % Another solve example
  15. % Note the use of $ as the line termination
  16. % character to suppress output from
  17. % intermediate computations
  18. x1 := sqrt(h^2 + p1^2)$
  19. x2 := sqrt((h/2)^2 + (p-p1)^2)$
  20. x3 := x1 + x2$
  21. dx := df(x3, p1)$
  22. solve(dx, p1);
  23. % Suppose you are given the equation
  24. % x^2+x+1=0 and wish to determine the
  25. % value of x^3. The following simple
  26. % substitution achieves this.
  27. rule := solve(x^2+x+1=0,x)$
  28. y := (x^3 where rule);
  29. % Then y=1, because
  30. % x^3=x*(x^2)=-x*(x+1)=-x^2-x=1.
  31. end;