Sie sind auf Seite 1von 17

x := 6

Areacircle( r ) := r

text := "tija jan is my name"

Areacircle( 5) = 78.54

fun := "this is me"


a :=

text if x < 5

Areacylinder ( r , h ) := 2 r h + 2 r

= "this is me"

fun otherwise

Areacylinder ( 2 , 2) = 50.265

Angle := angle ( 4 , 5) = 51.34 deg


Angle = 0.896

Changing the ORIGIN of an array

Origin arry can be changed form tools(worksheet option)


and build-in variables(array origin)

ORIGIN:= 1
0

20
5
Mat :=
9
13

6 7 8
10 11 12

14 15 16
2

0
1
2
3

Changing lement 1,1 of an array


Mat

1, 1

:= 1

1
5
Mat =
9
13

10 11 12

14 15 16
2

Adding morre elements to the array


Mat
Mat

5, 1
1, 5

:= 1

Mat

:= 1

Mat

5, 2
2, 5

:= 1

Mat

:= 1

Mat

5, 3
3, 5

:= 1

Mat

:= 1

Mat

5, 4
4, 5

:= 1

Mat

:= 1

Mat

5, 5
5, 5

:= 1
:= 2

1
5

Mat = 9
13

Mat

6, 6

4 1

8 1

4 1 0

8 1 0

10 11 12 1
14 15 16 1

1 1 1 2

:= 66

1
5

9
Mat =
13
1

10 11 12 1
14 15 16 1
1

1 2

0 0

0
0

66

Range Variable

S1 := 1 , 2 .. 10

S2 := 1 , 0 .. 10

the increment

the decrease

S1 =

S3 := 1 .. 10
if no second value then it will be 1

S2 =
rija

:= S3

-1

3.142

-2

12.566

S3

rija

S3

-3

28.274

-4

50.265

-5
rija =

78.54

-6

-7

153.938

10

-8

201.062

-9

254.469

-10

314.159

113.097

1
1

3.142

12.566

28.274

50.265

78.54

113.097

153.938

201.062

254.469

10

314.159

Array

S1

:= S1 + 1
rija

10 , 1

Array

S1

10

10

17

17

26

Array = 5

26

37

37

50

50

65

65

82

82

101

10

101

k := 1 .. 4
Ahmad

k+ 2n

= 314.159

n := 1 .. 4
:= k + 2n

1
1

5
Ahmad = 6

10

10

11

11

12

12

Example Problem

Array

10 , 1

= 101

Density := 997.1

kg
3

NetPressure( d ) := Density g d
g = 9.807

m
2

1

2
4
Depths := 5 m

7
17
33

kPa = 1000 Pa
Pressures := NetPressure( Depths)

9.778

19.556
39.113
Pressures = 48.891 kPa

68.447
166.23
322.681

5kg
6lb
M :=
3mg
2oz

1

2
4
Depths = 5 m

7
17
33

3 m
s2
ft
5
s2
A :=

2 m
s2

4 ft
s2

F := M A = 19.217 N

F1 := M A

15

4.15

F1 =
N
0
0.07

F1
= 4.15 N
2, 1

1
5

9
Mat =
13
1

0
0

66

4 1 0

8 1

10 11 12 1
14 15 16 1
1

1 2

0 0

4
v := Mat

4
8

12
v=
16
1

0

Text := max( v) = 16

Text1 := min( v) = 0

Truncation and rounding function

Va1 := 3.49

Va2 := 3.51

T1 := floor Va1 = 3

T1 := floor Va2 = 3

T2 := ceil Va2 = 4

T2 := ceil Va1 = 4

T3 := trunc Va1 = 3

T3 := trunc Va2 = 3

T4 := round Va1 = 3

1
2
V1 :=
3
4

T4 := round Va2 = 4

V1 = 10

Ctrl + 3 ()

2 = 62

2 + 2 + 2 + 2 + 2 = 62

i=1

y := 1

f ( y) := 2

f ( y) = 6

2 + 2 + 2 = 24

j =1

1

2
V1 =
3
4

V1
:= 5
5, 1

1
2

V1 = 3
4

5

6
12
3

Sum :=
( V1 L) = 18
24
L =1

30

Using the Summation operator to calculate the total mass of a struccture


TopFloor := 4
FirstFloor := 1 .. TopFloor

1400
1200 3
Volume :=
m
1200
1000

TotalMass :=

700
700 kg
Density :=
700 4
500 m

kg

6
(VolumeFirstFloorDensityFirstFloor) = 3.16 10 m
FirstFloor

M n := 1

M u := 2

if M n > M u , "Design is OK" , "Design is Not OK" = "Design is Not OK"

Page223

Interpolation Function
vx :=

1

2

vy :=

4

8
x.T :=

vx :=

0.125

0.25

vy :=

24.3

26.6

linterp x.T , T ,

linterp( vx , vy, 0.2) = 25.68

1
2

Time := 3 s
4

5

2.1
3.9

m
Velocity := 5.9
7.8 s

10.1

1.5
2.2
xValues :=
s
0
6

3
4.3 m
IntResult := linterp( Time , Velocity, xValues ) =
0.3 s
12.4

MathCad Programing
0.5 < Factor < 2.0
Factor( x) :=

2 if x > 2
x if 0.5 < x < 0.5
0.5 otherwise

0.125

0.25

F1 := Factor( 0.25) = 0.5


F2 := Factor( 1.0) = 0.5
F1 := Factor( 3 ) = 2

IntResult = 3
1

m
s

FS( d ) :=

return 1.5 if d 3.5in

FS( 6in) = 1.2

return 1.4 if d 4.5in


return 1.3 if d 5.5in
return 1.2 if d 6.5in
return 1.1 if d 7.5in
1 otherwise

BB( x , y) :=

"Both x and y is in the positive region" if x > 0 y > 0


"x is in the positive region and y is in reganive" if x > 0 y < 0
"x is in the negative region and y is in positive" if x < 0 y > 0
"Both x and y is in the positive region" if x < 0 y < 0
"x and y is in the origion" if x = 0 y = 0
"Not acceptable" if x = 0 y y = 0 x 0

BB( 1 , 1 ) = "Both x and y is in the positive region"


BB( 1 , 1 ) = "x is in the positive region and y is in reganive"
BB( 1 , 1 ) = "x is in the negative region and y is in positive"
BB( 1 , 1 ) = "Both x and y is in the positive region"
BB( 0 , 0 ) = "x and y is in the origion"
BB( 0 , 1 ) = "Not acceptable"

BB( 1 , 0 ) = "Not acceptable"

BB( 1 , 1 ) = "Both x and y is in the positive region"

( )

Test x , y :=

if x 0
100 if y 0
200 otherwise
if x < 0
300 if y 0
400 otherwise

BB( 0 , 1 ) = "Not acceptable"

Test ( 4 , 2 ) = 300

i := 1 , 2 .. 4

i =

3
4
x :=
7
10

1
2
3
4

Test :=
i

100 if

2
1
y :=
3
2

"This is a comment line"


x 0y 0
i

200 if

"Use this line for text"


x 0y <0
i

300 if

"Use this line for text"


x 0y 0
i

400 otherwise
Test =
i

100
200
300
400

Pass := "Passes-Solution Works"


Fails := "Fails-Retry"
p := 1 , 2 .. 3
Zero := "Result is Zero"

T :=
p

5
Result := 0

5

Pass if Result > 0

T = "Fails-Retry"

Fails if Result < 0

T = "Result is Zero"

Zero otherwise

T = "Passes-Solution Works"

1
2
3

Range Variable and Vectors

v := stack( 1 , 2 )
w := stack( 1 , "a" , 3 )

v=

1

2

1
w = "a"

3
Plotting a Range over a Log Scale
Low := 0.001
log
Step :=

High := 10000

Intervals := 20

High

Low = 0.35

Intervals

log

High

=7
Low

r := 1 , 2 .. ( Intervals + 1 )

X := Low 10

( r 1) Step

Function ( z) := z

s := 0.001 ,

10000 0.001
20

.. 10000

s=
110-3

110-3
4

1 10

500

999.999

1 10

1.5103

100

2103

10
Function( s )

2.5103

3103

0.1

3.5103

0.01

4103

4.5103

5103

1 10

1 10
4
1 10

0.01

100

5.5103

1 10

6103

6.5103
7103
...
4

1 10

X =
r

1 10

110-3
100

2.23910-3

10

5.01210-3

0.011

0.1

0.025

Function( X )

0.056

0.01

0.126

1 10

0.282

1 10
4
1 10

0.01

1
X

100

1 10

0.631
1.413
3.162
7.079
15.849
35.481
79.433
...

m := 2kg
v := 200

cm
s

65kgf = 143.3 lbf

m v
2

75kgf = 165.347 lbf

= 4 J

T :=

24.3

26.6

, 0.2 = 25.68

Das könnte Ihnen auch gefallen