~ubuntu-branches/ubuntu/lucid/mathomatic/lucid

« back to all changes in this revision

Viewing changes to tests/demo.in

  • Committer: Bazaar Package Importer
  • Author(s): Sandro Tosi
  • Date: 2010-01-18 19:37:25 UTC
  • mfrom: (1.1.24 upstream) (3.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20100118193725-w378n9lvatvh65qr
Tags: 15.0.4-1
* New upstream release
* debian/control
  - added ${misc:Depends} to mathomatic-primes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
clear all
2
 
; A symbolic differentiation demonstration.
 
2
; Some symbolic differentiation examples follow.
3
3
 
4
4
; Take the derivative of the absolute value function:
5
5
|x|
8
8
; Take the derivative of an algebraic fraction:
9
9
(2+3x)/(4+5x)
10
10
derivative
11
 
; Replace the constants with unique variables to generalize:
12
 
(a+b*x)/(c+d*x)
13
 
derivative x
14
 
 
15
 
; Mathomatic can nicely differentiate anything that doesn't require symbolic logarithms.
16
 
((x-1)(x-2)(x-3))/((x-4)(x-5))
17
 
differentiate ; This command is just another name for the derivative command.
18
11
 
19
12
; A Taylor series demonstration:
20
13
y=x_new^n
21
 
0 ; solve for zero
22
 
taylor x_new 1 x_old ; build the nth root of y iterative approximation formula
 
14
taylor x_new 1 x_old ; build the (nth root of y) iterative approximation formula
23
15
solve verify x_new ; solve for the wanted variable, verifying the result
24
16
simplify ; convergent nth root approximation formula:
25
 
replace x_old x_new with x ; make old and new the same
 
17
replace x_old x_new with x ; make x_old (input) and x_new (output) the same
26
18
x ; make sure the formula was correct by solving for x
27
19
 
28
20
; Another Taylor series demo:
29
21
e^x ; enter the exponential function
30
22
taylor x 10 0 ; generate a 10th order taylor series of the exponential function
31
23
laplace x ; do a Laplace transform on it
32
 
laplace inverse x ; undo the transform
33
 
compare with 12 ; compare the current expression with equation space number 12
 
24
simplify ; show the structure of the result
 
25
laplace inverse x ; undo the Laplace transform
 
26
compare with 8 ; check the result