The airticle shows how to use python and mathematica to do elementary arithmetic with a few examples.
The examples come from An Elementary Introduction To The Wolfram Language

Calculate 10 to the power 12

python:
print( 10**12 )

wolfram:
10^12

=> 1000000000000

Compute 2 to the power 2 to the power 2 to the power 2

python:

result = 2
for i in range(3):
    result = pow(2, result)

print( result )

wolfram:
2^2^2^2

2^2^2^2 = 2^(2^(2^2))

=> 65536

Add the whole numbers from 1 to 10

python:

result = 0
for i in range(10):
    result = result + i+1

print( result )

wolfram:

sum = 0
Do [ sum = sum+i
 ,{i,10}
 ]

Print[sum]

=> 55

分类: MathPython

发表评论

电子邮件地址不会被公开。 必填项已用*标注