mathcad programming important

Upload: abhijith-madabhushi

Post on 24-Feb-2018

231 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Mathcad Programming Important

    1/16

    1

    Mathcad programming

    ., -

  • 7/25/2019 Mathcad Programming Important

    2/16

    Introduction

    A Mathcad program ! "!!"#ta$$% a m&$t!t"p 'cto#. (# Mathcad, a program ! mad" &p o' a !")&"#c" o' !tat"m"#t! &!#g !p"ca$

    op"rator! to co#tro$ th" *o+ o' "a$&ato#. o#!tr&ct %o&r program, th"# Mathcad +$$ ca$c&$at" thro&gh th" !")&"#c" o'

    !tat"m"#t! a#d r"t&r# th" r"!&$t o' th" $a!t !t"p a! t! a#!+"r. (t ca# a$!o r"t&r#a a$&" !p"c"d /% th" 0r"t&r#0 !tat"m"#t.

    1rogram! ca# /" &!"d to r"t&r# ""r% data t%p" that %o& +or2 +th # Mathcad3!ca$ar!, arra%!, a#d ""# t"4t !tr#g!.

    Mathcad program ! cr"at"d /% &!#g t! program op"rator!. Mathcad ha! 56op"rator! +hch ar" acc"!!/$" 'rom 1rogramm#g too$/ar. 7o& ca##ot ma#&a$$%t%p" th" programm#g 2"%+ord!.

  • 7/25/2019 Mathcad Programming Important

    3/16

    "Add Lin"

    8p"rator to #tat" a program or toadd a $#" to a program. 9h"# %o&c$c2 o# t, a "rtca$ too$/ar a#d :p$ac"ho$d"r! +$$ /" prod&c"d. ;h"Add

  • 7/25/2019 Mathcad Programming Important

    4/16

  • 7/25/2019 Mathcad Programming Important

    5/16

    o#dto#a$ op"rator i$

    o#dto#a$ op"rator +hch ca# /"&!"d +h"#""r %o& +a#t aprogram !tat"m"#t to /" "4"c&t"do#$% &po# th" occ&rr"#c" o' !om"co#dto#.

    (# th" rght p$ac"ho$d"r, "#t"r a@oo$"a# "4pr"!!o#.

    (# th" $"'t p$ac"ho$d"r, "#t"r a!tat"m"#t to "a$&at" ' th"

    @oo$"a# "4pr"!!o# ! tr&".

    (' #"c"!!ar%, &!" th" 0Add

  • 7/25/2019 Mathcad Programming Important

    6/16

    ;h" othr%iop"rator

    ;h" oth"r+!" op"rator on!&%or' %ith th i$ oprator>+h"# th" co#dto# o' th" ' ! #otm"t, Mathcad +$$ "4"c&t" th"

    accompa#%#g oth"r+!"!tat"m"#t. (' %o& &!" mor" tha#o#" ' !tat"m"#t /"'or" a#oth"r+!" !tat"m"#t, th"oth"r+!" !tat"m"#t ! "4"c&t"d

    o#$% +h"# a$$ pr"o&! co#dto#!ar" 'a$!".

    #t"r th" oth"r+!" !tat"m"#t #th" $"'t p$ac"ho$d"r.

  • 7/25/2019 Mathcad Programming Important

    7/16

    (or$oop

    #t"r th" oth"r+!" !tat"m"#t # th"$"'t p$ac"ho$d"r.

    =!" a 'or $oop +h"# %o& 2#o+ "4act$%ho+ ma#% tm"! %o& +a#t th" /od% o'th" $oop to "4"c&t".

    ;%p" th" t"rat" ara/$" # th"p$ac"ho$d"r o# th" $"'t, a#d th" ra#g"o' a$&"! o# th" rght. 1$ac" a$$ca$c&$ato#! to /" co#ta#"d # th"$oop mm"dat"$% d"r th" 0'or0 !o

    that th"% ar" #d"#t"d.

    (' #"c"!!ar%, &!" th" th" 0Add

  • 7/25/2019 Mathcad Programming Important

    8/16

    )hi!$oop

    =!" a +h$" $oop +h"#""r %o& +a#t a !"t o'!tat"m"#t! to 2""p "4"c&t#g +h$" a c"rta#co#dto# ! tr&". Ma2" !&r" %o& ha" a!tat"m"#t !om"+h"r" that at !om" po#t +$$ma2" th" co#dto# 'a$!"> oth"r+!", th" $oop

    +$$ "4"c&t" #d"#t"$% a#d %o& +$$ #""d to!top t /% pr"!!#g B!cC.

    (# th" p$ac"ho$d"r to th" rght o' th" 0+h$",0t%p" a @oo$"a# "4pr"!!o#.(# th" p$ac"ho$d"r /"$o+ th" 0+h$",0 "#t"r th"!tat"m"#t %o& +a#t to "4"c&t" r"p"at"d$%.

    (' #"c"!!ar%, &!" th" 0Add

  • 7/25/2019 Mathcad Programming Important

    9/16

    *turn

    @% d"'a&$t, a program r"t&r#! th" r"!&$t o'th" $a!t "4"c&t"d !t"p. Do+""r, %o& ca#r"t&r# a !p"cc a$&" 'rom a#%+h"r" #

    th" program /% &!#g th" r"t&r# op"rator.;h" r"t&r# !tat"m"#t ha$t! program"4"c&to# a#d r"t&r#! a !p"c"d a$&".

    (# th" p$ac"ho$d"r to th" rght o' th"0r"t&r#,0 t%p" +hat""r %o& +o&$d $2" tor"t&r#.

  • 7/25/2019 Mathcad Programming Important

    10/16

    4amp$" 5 a

    4amp$" 5 /

  • 7/25/2019 Mathcad Programming Important

    11/16

    4amp$" :

  • 7/25/2019 Mathcad Programming Important

    12/16

    4amp$" E

    4amp$" F

  • 7/25/2019 Mathcad Programming Important

    13/16

    4amp$" G3 $or$oop

  • 7/25/2019 Mathcad Programming Important

    14/16

    4amp$" L

    5 E G ... #

  • 7/25/2019 Mathcad Programming Important

    15/16

    4amp$" N

    ... ...

  • 7/25/2019 Mathcad Programming Important

    16/16

    OPQRPS