mumps-demo/05-user-defined-routines/Main.m

18 lines
403 B
Mathematica
Raw Normal View History

2019-09-26 10:04:21 -04:00
2019-09-26 16:50:50 -04:00
d hello^MyMathRoutines
2019-09-26 10:04:21 -04:00
r "Enter n: ",n,!
2019-09-26 16:50:50 -04:00
s areaCircle=$$areaCircle^MyMathRoutines(n)
2019-09-26 10:04:21 -04:00
w "areaCircle(",n,") = ",areaCircle,!
2019-09-26 16:50:50 -04:00
s fibonacci=$$fibonacci^MyMathRoutines(n)
2019-09-26 10:04:21 -04:00
w "fibonacci(",n,") = ",fibonacci,!
2019-09-26 16:50:50 -04:00
s factorialByVal=$$factorialByVal^MyMathRoutines(n)
2019-09-26 10:04:21 -04:00
w "factorialByVal(",n,") = ",factorialByVal,!
s m=n
2019-09-26 16:50:50 -04:00
do factorialByRef^MyMathRoutines(.n)
2019-09-26 10:04:21 -04:00
w "factorialByRef(",m,") = ",n,!