MuPAD
There are a few basic number theory functions in the kernel; others are contained in the numlib library.
>> isprime(997);
TRUE
>> Factor(2^67-1);
193707721 761838257287
>> nextprime(1000000);
1000003
>> powermod(9382471,322973,1298377);
880825
>> phi(nextprime(2^20)-1);
498400
Here phi is Euler's totient function returning the number of integers less than and relatively prime to its argument. These functions allow us to perform simple RSA encryption and decryption. Suppose we choose two primes and compute their product:
>> p:=nextprime(5678);
5683
>> q:=nextprime(6789);
6791
>> N:=p*q;
38593253
Now we have to choose an integer e relatively prime to (p-1)*(q-1);
a smaller prime will do; say e:=17.
>> e:=17:The values e and N are our “public key”. Now we find the d, the inverse of e modulo (p-1)*(q-1). This is very easily done using the convenient overloading of the reciprocal function:
>> d:=1/e mod (p-1)*(q-1);
6808373
Suppose someone wishes to send us a message M < N; say
>> M:=24367139;They can encrypt it using our public key values:
>> M1:=powermod(M,e,N);
18476508
We can now decrypt this using the value d (and N):
>> powermod(M1,d,N);
24367139
This is indeed the value of the original message.
We have seen a glimpse of MuPAD's symbolic abilities in the equation solving above. But MuPAD can do much more than this: all manner of algebraic simplification; rewriting in a different form; partial fractions; and so on.
>> expand((x+2*y-3*z)^4);
4 4 4 3 3 3 3 3
x + 16 y + 81 z + 32 x y + 8 x y - 108 x z - 12 x z - 216 y z -
3 2 2 2 2 2 2 2
96 y z + 216 x y z - 144 x y z - 72 x y z + 24 x y + 54 x z +
2 2
216 y z
>> Factor(%);
4
(x + 2 y - 3 z)
>> sum(1/(k*(k+2)*(k+4)),k=1..n);
2 3 4
310 n + 337 n + 110 n + 11 n
----------------------------------------
2 3 4
4800 n + 3360 n + 960 n + 96 n + 2304
>> partfrac(%);
1 1 1 1
--------- - --------- - --------- + --------- + 11/96
8 (n + 3) 8 (n + 1) 8 (n + 2) 8 (n + 4)
>> normal(%);
2 3 4
310 n + 337 n + 110 n + 11 n
----------------------------------------
2 3 4
4800 n + 3360 n + 960 n + 96 n + 2304
>> Factor(%);
2
n (n + 5) (55 n + 11 n + 62)
----------------------------------
96 (n + 1) (n + 2) (n + 3) (n + 4)
>> sum(sin(k*x),k=1..n);
(I exp(-I x) - I exp(I x) + I exp(-I n x) - I exp(I n x) -
I exp(- I x - I n x) + I exp(I x + I n x)) /
4 - 2 exp(-I x) - 2 exp(I x)
>> rewrite(%,sincos);
(2 sin(x) + 2 sin(n x) + I cos(x + n x) - 2 sin(x + n x) - I cos(- x - n x)
) / 4 - 4 cos(x)
MuPAD's calculus skills are excellent. It implements very powerful algorithms for differentiation, integration, and limits.
>> diff(x^3,x);
2
3 x
>> diff(exp(exp(x)),x$4);
2 3
exp(x) exp(exp(x)) + 7 exp(x) exp(exp(x)) + 6 exp(x) exp(exp(x)) +
4
exp(x) exp(exp(x))
The dollar operator, $, is MuPAD's sequencing operator. As with most operators, it is overloaded; in the context of a derivative it is interpreted as a multiple derivative. We can of course also perform partial differentiation.
>> int(sec(x),x);
ln(2 sin(x) + 2) ln(2 - 2 sin(x))
---------------- - ----------------
2 2
>> int(cos(x)^3, x=-PI/4..PI/3);
1/2 1/2
5 2 3 3
------ + ------
12 8
>> int(E^(-x^2),x=0..0.5);
/ 1 \
int| --------, x = 0..0.5 |
| 2 |
| x |
\ exp(1) /
>> float(%);
0.461281006412792448755702936740453103083759088964291146680472565934983884\
2952938567126622486999424745
If we require only a numeric result, then we don't want to force
MuPAD to attempt a symbolic or exact solution first. In such a case
we may use the hold command, which returns the
input unevaluated, but “holds” onto it for the purposes of later
evaluation. Thus we may enter:
>> hold(int(exp(-x^2),x=0..0.5));followed by the float command.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
- RSS Feeds
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- A Topic for Discussion - Open Source Feature-Richness?
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- What's the tweeting protocol?
- Tech Tip: Really Simple HTTP Server with Python
- BASH script to log IPs on public web server
4 hours 2 min ago - DynDNS
7 hours 38 min ago - Reply to comment | Linux Journal
8 hours 10 min ago - All the articles you talked
10 hours 34 min ago - All the articles you talked
10 hours 37 min ago - All the articles you talked
10 hours 38 min ago - myip
15 hours 3 min ago - Keeping track of IP address
16 hours 54 min ago - Roll your own dynamic dns
22 hours 7 min ago - Please correct the URL for Salt Stack's web site
1 day 1 hour ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
Sellout
Mupad has been bought out by mathworks and all code is now under matlab (junk) licence.
any and all open source work is now dead.
Thankyou for a well written a
Thankyou for a well written article. TeXmacs acts as an excellent interface to mupad. I assume that the TeXmacs screen display generated by TeX. The graphics is generated by javaview. The combination of TeXmacs and javaview greatly enhance the mupad experience.