mathcad
DESCRIPTION
MathCAD. B. A. a. b. Boundary value problem. Second order differential equation have two initial values. They can be placed in different points. for. for. a. b. Boundary value problem. Other type of initial conditions. for. for. b. A. Boundary value problem. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/1.jpg)
MathCAD
![Page 2: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/2.jpg)
Boundary value problem Second order differential equation
have two initial values. They can be placed in different points.
yyxfy ,,
a b
A
B
Ay for ax By for bx
![Page 3: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/3.jpg)
Boundary value problem
Other type of boundary conditions
Ay for ax tgy for bx
a b
A
![Page 4: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/4.jpg)
Boundary value problem Applies to second order differential
equations or systems of first order differential equations
Initial conditions are given on opposite boundaries of solving range
Numerical methods (usually) needs initial values focused in one point (one of the boundaries)
![Page 5: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/5.jpg)
Boundary value problem
Initial conditions required to start the integrating procedure
Ay for ax tgy for ax
a b
![Page 6: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/6.jpg)
Boundary value problem
We have to guess missing initial condition at the point we start the calculations
Conditions given Condition to guess
yA, yB y’A or y’B
yA, y’B y’A or yB
y’A, yB yA or y’B
![Page 7: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/7.jpg)
Boundary value problem In the chemical and process
engineering: Displaced parameters: heat and mass
transfer Countercurrent heat exchangers Mass transfer with accompanying chemical
reaction
![Page 8: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/8.jpg)
Boundary value problem
HOW TO GUESS??!!
1. Assume missing initial value(s) at start point
2. Make the calculation to the endpoint of independent variable range.
3. Check the difference between boundary condition calculated and given on the endpoint
4. If the difference (error) is too large change the assumed values and go back to point 2.
![Page 9: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/9.jpg)
Boundary value problem Example:
Given initial conditions of system of two differential equations
(range <a,b>): y1a, y1b
To start calculations the value of y2a is required
1. Assume y2a
2. Calculate values of y1, y2 until the point b is reached
3. Calculate the difference (error) e = |y1b(calculated)-y1b,(given)|
4. If e>emax change y2aand go to p. 2
212
211
,,
,,
yyxfdx
dy
yyxfdx
dy
![Page 10: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/10.jpg)
Boundary value problem What is necessary to solve the boundary
values problem?1. System of equations2. Endpoints of the range of independent
variable (range boundaries)3. Known starting point values4. Starting point values to be guessed5. Calculation of error of functions values
on the opposite (to starting point) side of the range
![Page 11: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/11.jpg)
To find missing initial values in the MathCAD the sbval procedure can be used. SYNTAX: sbval(v, a, b, D, S, B) v – vector of guesses of searched initial values in the starting
point a (p. 4)
a, b – endpoints of the range on which the differential equation is being evaluated (p. 2)
D – vector function of independent variable and dependent variable vector, consists of right hand sides of equations. Dependent variables in the equations HAVE TO BE vector HAVE TO BE vector typetype! (p. 1)
S – vector function of starting point and known and searched (v) defining initial conditions on starting point (p. 3&4)
B – function (could be vector type) to calculate error on the endpoint (b) (p. 5)
Result: vector of searched initial conditions.
Boundary value problem
![Page 12: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/12.jpg)
Boundary value problem
![Page 13: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/13.jpg)
Boundary value problem
![Page 14: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/14.jpg)
Odesolve
Overall ODE solving procedure
![Page 15: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/15.jpg)
Odesolve Returns a function(s) of independent variable
which is a solution to the single ordinary differential equation or ODE system
Solving initial condition problem as well as boundary problem
Can solve single ODE and system of ODE Result is an implicit function
![Page 16: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/16.jpg)
OdesolveSyntax
Keyword Given Differential equation(s) using Boolean
equal(s) (bold =). Derivative symbols ` by pressing [ctrl][F7] or constructions like from calculus toolbar.
Initial/boundary condition(s) (for derivatives only ` symbols). Boolean equal.
function_name:=Odesolve([v],x,b,[initvls])
n
n
dx
d
![Page 17: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/17.jpg)
OdesolveAdditional information:
v – vector of functions names - for ODE system only
b – terminal point of the integration Initvls – number of discretization intervals
(def. 1000) functions have to be defined explicitly (y(x)
not just y) Algebraic constraints are accepted.
![Page 18: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/18.jpg)
OdesolveOne second
order ODE
![Page 19: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/19.jpg)
OdesolveSystem of
two first order ODE
![Page 20: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/20.jpg)
OdesolveNumerical methods:
Adams/BDF calls: Adams-Bashford method for non-stiff
systems of ODE BDF method for stiff systems of ODE
Fixed – calls rkfixed Adaptive – calls Rkadapt Radau – calls Radau method – used
with algebraic constraints
![Page 21: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/21.jpg)
MathCAD symbolic operations
Chosen symbolic operations accessible in MathCAD
Simple symbolic evaluation: algebraic expressions, derivating, integrating, matrix operations, calculation of limits etc.
Symbolic with keyword: substitute, expand, simplify, convert, parfrac, series, solve,...etc.
![Page 22: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/22.jpg)
MathCAD symbolic operations
Symbolic operation are accessible from the Symbolic Toolbar or by the keystrokes:
[ctrl][.] simple operations [shift][ctrl][.] operations with keywords
To get the symbolic result NO NO VALUEVALUE can be assigned to the variables used in expressions!!
![Page 23: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/23.jpg)
MathCAD symbolic operations
simple operations Symbolic integration
Indefinite integration operator (symbol), expression, [ctrl]+[.]
Symbolic derivation Derivative operator, expression, [ctrl]+[.]
Calculation of limits, sums
![Page 24: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/24.jpg)
Substitute - replace all occurrences of a variable with another variable, an expression or a number expression [ctrl][shift][.] substitute, substitution
equation (use bold = symbol) expand - expands all powers and products of
sums in the selected expression expression [ctrl][shift][.] expand, variable
Simplify - carry out basic algebraic simplification, canceling common factors and apply trigonometric and inverse function identities expression [ctrl][shift][.] simplify
MathCAD symbolic operations
![Page 25: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/25.jpg)
Factor – transforms an expression (or number) into a product (of prime numbers) expression [ctrl][shift][.] factor
if the entire expression can be written as a product
To convert an equation to a partial fraction, type: expression, [ctrl][shift][.] convert,parfrac, variable
series keyword finds Taylor series expression, [ctrl][shift][.] series, variable = central point of
expansion, order of approximation To solve single equation
expression [ctrl][shift][.] solve, variable Assumes expression equal 0
MathCAD symbolic operations
![Page 26: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/26.jpg)
To solve system of equation Type Given Type equations (using [ctrl]+[=]) find(var1, var2,..) [ctrl][.]
MathCAD symbolic operations
![Page 27: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/27.jpg)
Units in MathCAD
![Page 28: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/28.jpg)
System of units available in MathCAD: SI - fundamental units: meters (m), kilograms
(kg), seconds (s), amps (A), Kelvin (K), candella (cd), moles (mole).
MKS - fundamental units: meters (m), kilograms (kg), seconds (sec), coulombs (coul), Kelvin (K)
CGS - fundamental units: centimeters (cm), grams (gm), seconds (sec), coulombs (coul), Kelvin (K)
US - fundamental units: feet (ft), pounds (lb), seconds (sec), coulombs (coul), Kelvin (K)
![Page 29: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/29.jpg)
To add unit: type unit after number (MathCAD will add multiplication sign between number and units)
MathCAD converts units between Units Systems and between fundamental and derived unit. User can define new derived units as fallows:
derived_unit:=multiplier*fundamental_unit, e.g.: kPa:=1000*Pa
![Page 30: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/30.jpg)
Independently of units used in data the results are given in fundamental units of actual Units System. Result unit can be changed!!
After the result of evaluation the placeholder appears. In these placeholder type the desired unit
![Page 31: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/31.jpg)
Calculations with units.
Calculate volume of rectangular prism of size
ft
![Page 32: MathCAD](https://reader035.vdocuments.site/reader035/viewer/2022062422/56813ad3550346895da307de/html5/thumbnails/32.jpg)
Units problemParameters with units can not be used
in the vector function definition of system of differential equations (especially from transformation of second order ODE to the system of first order ODE)
Solution: Multiply each element of sum in vector
function definition by inversion of its unit