HP Forums

Full Version: CAS Book: Doing Mathematics withScientic WorkPlace (MuPAD kernel)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
free book "Doing Mathematics with Scientic WorkPlace", The MuPAD kernel (now owned by Matlab) is bundled with Scientific Notebook and Scientific Workplace Software.

[Image: 51ATKQJ50ZL._SX258_BO1,204,203,200_.jpg]

https://www.sciword.co.uk/manuals/
http://ftp.ftp.mackichan.com/download/ve...ath-55.pdf
http://ftp.ftp.mackichan.com/download/ve...ath-60.pdf

A good book with many CAS examples
Hello, I am transcribing the examples of the book, they are executed both in xcas and hp-prime, except that in the hp-prime there are some instructions not yet ported.


PHP Code:
cas_setup([0,0,0,1,160,[1e-12,1e-15],12,[1,100,0,25],0,1,0,1]); // Default settings

/* I. Elementary Number Theory */
/* integers into products of powers of primes */
ifactor(12345// A prime is an integer greater than 1 whose only positive factors are itself and 1.
ifactor(-24), ifactor(24!)
/* Greatest Common Divisor  */
gcd(a,b// The greatest common divisor of two integers is the largest integer that divides both integers evenly.
gcd(351565
gcd(2^14 3^5^93^7^3), gcd(-104221)
/* Least Common Multiple */
lcm(a,b
lcm(351565
lcm(68); lcm(104221)
/* Factorials */
[a!, 0!, 3!, 7!, 10!] // Factorial is the function of a nonnegative integer n denoted by n! and defined for positive integers n as the product of all positive integers up to and including n; that is, n! = 1*2*3*4*...n. It is defined for zero by 0! = 1
/* Binomial Coefficients */
'(a + b)^n=sum((n!/(k!*(n-k)!))*(a^(n-k)*b^k),k,0,n)' //  An expression of the form a + b is called a binomial. the formula that gives the expansion of (a + b)^n for any natural number n is
binomial(a,b// binomial coefficients.   
binomial(5,2
binomial(a,5), factor(a!/(5!*(a-5)!))
/* Real Numbers */
/* Arithmetic.  The real numbers include the integers and fractions (rational numbers), as well as irrational numbers such as sqrt(2) and pi that cannot be expressed as quotients of integers. */
9.6*pi 2.7*pi // qpi(9.6*pi - 2.7*pi)
42*( 2/1/) * sqrt(2)
(
2/3) / (8/7
/* changea floating point number to a rational number. */
exact(0.125// rational
exact(4.72
exact(6.9*pi)
exact(3.1416 
/* Evaluating float at a rational number gives the floating point form of the number. */

approx(3927/12501/8// Numerical Approximations
/* Powers and Radicals Pag 34 */
[3^4, (2.5)^(4/5), 3^-40.4^32// To raise numbers to powers use ^ symbol
surd(0.008,3); surd(18.234,5); surd(24,2); surd(16/27,3); surd(16,4); surd(-8,3// Radical notation for roots
autosimplify(2):; surd(16/27,3// irrational number
autosimplify(2):; surd(16/27,3)
autosimplify(2):; surd(162*pi^6,4)
approx(3*pi*(2*pi^2)^(1/4)); approx(3*pi^(3/2)*surd(2,4))
autosimplify(0):; surd(162*pi^6,4)
autosimplify(1):; surd(162*pi^6,4)
autosimplify(2):; 1/sqrt(2// Rationalizing a Denominator
autosimplify(0):; 1/sqrt(2)
autosimplify(2):; 1/(sqrt(2)+sqrt(3))
autosimplify(1):; 1/(sqrt(2)+sqrt(3))
autosimplify(2):; (sqrt(2)+sqrt(3))/(sqrt(5)-sqrt(7))
autosimplify(0):; (sqrt(2)+sqrt(3))/(sqrt(5)-sqrt(7))
autosimplify(0):; -1/* (sqrt(2) + sqrt(3)) * (sqrt(5) + sqrt(7))
/* Functions and Relations */
abs(a// Absolute value
abs(-11.3)
max(a,b); min(a,b); // Maximum and Minimum
max12/3,-sqrt(63), 7.3 )
min12/3,-sqrt(63), 7.3 
max2765/2, -14 )
min2765/2, -14 )
floor(5.6); ceil(5.6// Greatest and Smallest Integer Functions 
floor(43/5); ceil(43/5)
floor(-11.3); ceil(-11.3)
floor(pi+e); ceil(pi+e)
evalbe^(i*pi) = -// Checking Equalities and Inequalities
evalbpi=3.14 )
evalbasin(sin(a)=a) )
asin(sin(a))
evalb( (9/8-8/9) = abs(9/8-8/9) )
evalbpi^e-e^pi abs(pi^e-e^pi) )
pi^e-e^pi abs(pi^e-e^pi)
(
9/8) < (8/9)
pi^e^pi
evalb
(sqrt(2)^2=2)
(
5^6^5) and (1=1); (5^6^5) and (1=1)
(
5^6^5) or (1=1); (5^6^5) or (1=1)
(
1) or (1=0)
e^pi pi^) and (0=0)
/* Union, Intersection, and Difference */
set[1,2,3union set[a,b,c]
[
1,2,3union ([3,5union [7])
[
sqrt(2), pi3.9runion [a,b,c]
[
1,2,3intersect [2,4,6]
[
1,2,3intersect [a,b,c]
[
a,b,cdintersect [deef]
set[]
[
1,2,3intersect []
[
1,2,3minus [2,4]
[
1,2,3minus [a,b,c]
[
a,b,c,dminus [deef]
/* Complex Numbers */
i
sqrt
(-5)
i/(1+i)
abs(i// Absolute Value
abs(1+i)
conj(a+i); conj(1+i)// Complex conjugate
re(i); im(3*i)  // Real and Imaginary Parts
6_ft 8_ft10_m 5_m  // Arithmetic Operations with Units
6_ft 8_ft
4_ft 
16_inch 
convert
(5.33333333333_ft,1_m// Converting Units
4_d 3_mn 
convert
(4.00208333333_d,1_s
10_mile/15_s
convert
((2/3)_(mile*s^-1.0),1_m/1_s
convert(7_ft,1_inch)
convert(458.4_deg,1_rad)
convert(50_mile/1_h,1_km/1_h)
convert(47_lb,1_kg)
convert(8_rad,1_deg)
1440./pi
/* Algebra, Polynomials and Rational Expressions */
(3*x^3*)+(8*x^2+7// Sum
(3*x^3*)/(8*x^2+7// Quotients of Polynomials
((1)^-1)*(1)^-// Product
((1)^-1)*(1)^-1
expand
(((1)^-1)*(1)^-1)
(
3*x^3*-)*(8*x^2+7)
(
3*x^+3*x^-4*x^5)/(8*x^+7
(
3/64)*x-( ((21/64)*- (17/2))/(8*x^2+7) ) + (3/8)*x^-1/
sum
(a[k]*x^k,k,0,5)  // summation notation
ratnormal((8x^)^-* (2x^)^-1)
x/(x^2-1) + (3*x-1)/(x^2-3*x+2)
factor(x/(x^2-1) + (3*x-1)/(x^2-3*x+2))
partfrac(36/((x-2)*((x-1)^2)*(x+1)^2)) // Partial Fractions
complex_mode(0):;partfrac((x^3+x^2+1)/(x*(x-1)*(x^2+x+1)*(x^2+1)^3))
partfracy/(((x-y)^2)*(x+1)))
partfrac(y/((x-y)^2*(x+1)),y)
partfrac(y/((x-y)^2*(x+1)),x)
cas_setup(0,0,0,1,160,[1e-12,1e-15],12,[1,100,0,25],0,1,0,1// 9-th parameter increasing power flag

x^3*53*x^5*x^4*x^13 2*x^
sort
(5*t^3*x*t^16*t^y^2*x*t^9,t)
sort(5*t^3*x*t^16*t^y^2*x*t^9)
collect(5*t^3*x*t^16*t^y^2*x*t^9,y)
5*x^5*x^10*x^10*x^5*5factor(5*x^5*x^10*x^10*x^5*5)
1/16*x^-7/5*1/6*i*56/15*i;  factor(1/16*x^-7/5*1/6*i*56/15*i)
expand((3*x+8*i)*(5*x-112)/240)
x^2*3substx^2*3x=// Substituting for a Variable
substyx=y+)
substx^2*3,x=y-); factory^2-2*y*z+2*y+z^2-2*z-3); 2*2*+ (y-z)^3
expand
2*2*+ (y-z)^)
preval(x,a,b// Evaluating at Endpoints
preval(x^2*3x=3x=5// request x=
preval(x^2*335)
preval(x^2*3ab)
purge(x):; roots(5*x^2*3); solve(5*x^2*3=0// multiplicity
list2exp([[3,9],[- 1,1]],x)
roots(x^1,x)
x^13/5*i*x^8*x^29/5*i*81/5*6*18/
solve
(x^13/5*i*x^8*x^29/5*i*81/5*6*18/=0,x)
roots(x^13/5*i*x^8*x^29/5*i*81/5*6*18/5,x)
csolve(x^13/5*i*x^8*x^29/5*i*81/5*6*18/=0,x)
5/2+(13/10*i) - 1/10*(336 850*i)
5/2+(13/10*i) + 1/10*(336 850*i)
assume(xinteger// real
roots(x^13/5*i*x^8*x^29/5*i*81/5*6*18/5,x); 
1//roots(5*x^2+x+3); // bug
purge(x):;
// roots(ax^2 + b*x + c); // bug
solve(x^3*1=0);
roots(a*x^b*c);
csolve(x^3*1=0); // exact
csolve(x^3*1.0=0); // approx
roots(x^3*1=0);
roots(x^3*x^2*x^1)
roots(x^8/3*x^5/3*2)

factor(x^8/3*x^5/3*2); expand((x-3)*(x+1)*(3*x-2)/3)
factors(x^8/3*x^5/3*2)
csolve(x^-13/5*i*x^8*x^29/5*i*81/5*6*-18/5=0)

factor(x^-13/5*i*x^8*x^29/5*i*81/5*6*-18/5)
/* Equations with One Variable */
solve(5*x^3*1)
expand(list[(-(sqrt(29))-3)/10,(sqrt(29)-3)/10])
solve(abs(3*2) =  5)

purge(x)
solve(1/1/1, [x,y],'='// no coloca restricciones
solve(1/1/1x'=')
solve(1/1/1y'=')
solve(1/1/1/1z'=')
solve([x^y^5x^y^1],[x,y],'=')
solve([x^y^5x^y^1],[x,y])
autosimplify(0):;list2exp([[sqrt(3),sqrt(2)],[-(sqrt(3)),sqrt(2)],[sqrt(3),-(sqrt(2))],[-(sqrt(3)),-(sqrt(2))]],[x,y]);
list2exp(solve([x^y^5x^y^1],[x,y]),[x,y])

/* Inequalities */
autosimplify(0):;solve(16 7*>= 10*4y)
solve(x^x^x)
solve(x^2*0x)
solve(abs(2*3) <= 1)
solve( (7-2*x)/(x-2)>=0,x)
a<x<b; ((x>a) and (x<b))
a<x<=b; ((x>a) and (x<=b))
a<=x<=b; ((x>=a) and (x<=b))
/* Defining Functions of One Variable // p 69 */
f(x) := a*x^b*c;
[
f(t), f(-6), f(17)]
f(x) := 5*3;
solve(f(y)=0)
seq(x^3*5,x,[0,1,2,3,4]); // To find the value of the expression x^2 + 3x + 5 at x = 0, 1, 2, 3, 4
seq(x=y+1,y,0,4)
subst(x^3*5,[x=1,x=2,x=3,x=4,x=5])
/* Definning Functions of Several Variables */
f(xyz) := a*y^2*z
g
(xy) := 2*sin(3*x*y)
f(123
g(1,2)
/* Piecewise-Defined Functions */
f(x):= piecewise(x<0,x+2,0<=x<=1,2x>12/x)
[
f(-14), f(1/2), f(21)]
h(x):= (1)/(1)
purge(f), purge(h)//Removing Definitions 
Reference URL's