Next: Statistics Up: Wester's test suite Previous: Wester's test suite

# Numbers

Problem :compute .

```>> fact(50);

30414093201713378043612608166064768844377641568960512000000000000
```

Problem :compute the prime decomposition of .

```>> ifactor(fact(50));

[1, 2, 47, 3, 22, 5, 12, 7, 8, 11, 4, 13, 3, 17, 2, 19, 2, 23, 2, 29, 1,

31, 1, 37, 1, 41, 1, 43, 1, 47, 1]
```

The function `ifactor(n)` returns a list where , and .

Problem :compute .

```>> _plus(1/i\$i=2..10);

4861/2520
```

In MuPAD each arithmetic operator has a functional form, here `_plus` for addition, so for example `_plus(a,b)` is the same as `a+b`.

Problem :compute a numerical approximation of to 50 digits.

```>> DIGITS:=50: float(exp(PI*sqrt(163)));

2.6253741264076874399999999999925007259719818568887e17
```

The floating-point numbers are output in scientific notation. This notation can be used as input too.

[New] Problem :compute a numerical approximation of , where J is the Bessel function of the first kind.

```>> besselJ(2,1.0+I);

0.4157988694e-1 + 0.2473976415 I
```

Please note that floating-point numbers are ``contagious'': no `float` instruction is needed here.

[New] Problem :compute an infinite decimal representation of .

```>> loadlib("numlib"): export(numlib):
>> decimal(1/7);

0, [1, 4, 2, 8, 5, 7]
```

This result means that the decimal expansion of is . Here the instruction `loadlib("numlib")` loads the package. Then `export(numlib)` exports the functions of this package, i.e. enables one to call them with a short name (otherwise we should write `numlib::decimal`).

[New] Problem :compute the first terms of the continued fraction of .

```>> contfrac(PI,5);

1
---------------------- + 3
1
------------------ + 7
1
------------- + 15
1
--------- + 1
1
--- + 292
...
```

The second (optional) argument of `contfrac` specifies the number of digits to be taken into account before computing the continued fraction.

[New] Problem :simplify .

```>> radsimp(sqrt(2*sqrt(3)+4));

1/2
3    + 1
```

[New] Problem :simplify .

```>> radsimp(sqrt(14 + 3*sqrt(3 + 2*sqrt(5 - 12*sqrt(3 - 2*sqrt(2))))));

1/2
2    + 3
```

[New] Problem :simplify .

```>> 2*infinity-3;

infinity
```

The symbol `infinity` is implemented as a domain in MuPAD. This allows the overloading of the basic arithmetic operations, together with the comparisons. For example we can write in a MuPAD program `if a<infinity then ... end_if`.

Andre Heck
Sun Apr 23 10:32:10 MDT 1995