MATHEMATICS

Tampilkan postingan dengan label Mathematica. Tampilkan semua postingan
Tampilkan postingan dengan label Mathematica. Tampilkan semua postingan

Sabtu, 26 Oktober 2013

Visual Mathematics

Years ago when I started studying mathematics besides my job in IT I never considered that I would be able to apply mathematics in my day-to-day job. But I do now, because I work on the development of a drawing program ( a specialized drawing program on Android ). Does that make me happy? Just a bit. Because  applied mathematics can get as dirty as computer programming. Once applied, mathematics has lost most if not all of its beauty ( although nothing of its power ). I love pure mathematics, and even more so visual mathematics. The three pictures below are the result of applying a function to respectively the integers 1, 2 and three. The construction ( Mathematica programming, if you like ) of that function however required understanding of calculus, geometry, linear algebra, group theory and tling theory ( they are all parts of the Archimedean tiling of the whole plane with vertex type 4,8,8 ). My point being: this is the mathematics I like so much.

When I really like a picture I made I add it to 'The Gallery'. I am far from being able to create art with mathematics but there is a point where mathematics becomes art or where art becomes ( laying the groundwork for future ) mathematics. M.C. Escher explored mathematics decades before general theories about the subject were formulated.

If you are interested in Mathematics and Art then I can recommend this book: Connections: The geometric bridge between art and science.

Kamis, 19 April 2012

M336 Groups and Geometry

Thirty point Open University courses consist of four blocks, where the sixty pointers have eight. M336 Groups and Geometry is a four block course. Since there are two inter-related but independent tracks it doesn't feel like an ordinary 30 point course, somewhat heavier in fact. The geometry course roughly discusses one topic per block:
Block 1: Frieze groups
Block 2: Tilings
Block 3: 2D-Lattices and wallpaper groups
Block 4: 3D-Lattices.

See this previous post about block1 and frieze groups.

I am almost done with block 2 but I am still struggling with tilings ( TMA02 question 4 ). In the meantime I have coded a nice Mathematica pattern editor, ( which I hope will form the base for a Wallpaper Group editor and generator ).

Click to enlarge.

Programming Mathematica is easy and fast, that is: after you have wrestled yourself through the rather steep learning curve. An advanced topic in Mathematica ( i.e. chapter 15 in the Cookbook ) is the programming with DynamicModules and Manipulate. It turns out that, even as a GUI, Mathematica seems to have no limitations to what is possible. In order to code the pattern editor I had to crash myself through Manipulate for which I received invaluable help from the Mathematica experts community at Mathematica StackExchange. Thank you very much!

Kamis, 12 April 2012

Get Mathematica Cookbook from O'Reilly for $4.95

If you are into Mathematica this might be helpful. SWIM owns a paper copy of the Mathematica Cookbook, but he did not own the e-book version yet. The e-book version of the Cookbook is particularly interesting because it is entirely written in Mathematica and is delivered as such: as a set of Mathematica Notebooks. Anyway, SWIM went to the O'Reilly website to register his Cookbook. This required a valid e-mail address but no proof of ownership of the hard copy Cookbook. After the registration was completed he got the offer to update to the e-book version for only USD4.95. I don't know how long this option will work though, publishers publish to make money and unfortunately not to disseminate Mathematica. Anyway, USD4,95 for the e-book is value for money, you get 15 chapters or 800 pages or literally hundreds of workable recipes.

Rabu, 04 April 2012

What is the difference between digital image processing and computer graphics?

#mathematica

Although digital image processing and computer graphics are similar in the sense that they rely heavily on ( advanced ) mathematics and that they work with computer imagery they are in essence quite different technologies. So, what is the difference between digital image processing and computer graphics?

Computer graphics creates new digital images from geometrical descriptions, such as 3D-object models or (scene-)graphs, developers of computer games, special effect programmers in the movie industry all use ( primarily ) computer graphics.

Example: Computer Graphics - Click to enlarge
Digital image processing strips an image down to its core: an array of numbers and can thus be manipulated in any way possible, i.e. rotating, resizing, morphing, etc.

 Example: Digital Image Processing - Click to enlarge 
In certain applications the two fields meet, for example when 3D models are (re-)created from image data. An interesting project is for example the creation of a 3D model showing the distribution of dark matter in the universe.

Both Digital Image Processing and Computer Graphics are playgrounds to show off your math skills. Most, if not all mathematics software have extensive support for computer graphics as well as digital image processing.

Minggu, 01 April 2012

Playing mathematics

#openuniversity# #m336#

" If it isn't fun it isn't Mathematics. " If any part of mathematics is causing problems make it so that you can play with it. It is easier said than done but it -is- true: mathematics is something you should =DO=. You can't read a mathematics book as if it was just any book in any field, let alone that you can read a maths book as if it was a novel. The mathematics reading protocol has to be applied and that means: verify everything that the author tries to tell you. Mathematics books are notoriously full of errors so you might even find one. If it isn't the best method than it certainly is the method with the most fun involved: study by playing with mathematics. If our brain is the computer then mathematics is a computer game. Really.

Built from scratch with Mathematica

I decorated the cube above with tilings I had to study for M336. Studying tilings is dry, to say the least, so I became 'actively involved' and created tilings myself using Graphics in Mathematica, I put the code I made for Frieze patterns to work on Tilings.

As far as I can remember I have always loved mathematics, except for the darkest two years of my life. I remember myself sitting in the second class of secondary school looking at something I had never seen before: geometric proofs in Euclidean style, i.e.: no algebra, no numbers, no vectors, nothing. The teacher had this gigantic protractor for making drawings on the blackboard. The government dropped this style of math teaching years before but that teacher insisted on Euclid. Looking back I think he just wasn't flexible enough. My grades for math were terrible and so were those of many others. He destroyed the dreams of many children. Although I catched on later, I don't think that I will ever be ready for Euclid.

Rabu, 15 Februari 2012

Drawing ( friezes ) with Bezier curves

#OpenUniversity #M336

Although the friezes in post 'Frieze group pmm2' consisted of only straight lines it is possible to create friezes containing Bezier curves in Mathematica using the BezierCurve function.

The following frieze will look familiar to M336 students. ;-)

Selasa, 14 Februari 2012

Frieze group pmm2

#OpenUniversity little success story

The most common barrier to effective study is the so called 'Lack of Mass' ( Applied Scholastics ). A subject has not enough mass -for you- when you don't like it, aren't interested in it, can't see the purpose of studying it, etc.

If this situation occurs then you simply (...) have to 'add mass'. I did it for Open University course M336 IB3 Frieze Patterns by programming a frieze pattern tool in Mathematica. I like programming and if you can program a topic it is proof that you understand the topic. Now friezes live for me. I know them all, including the recognition algorithm.

Here are some applications of the tool I made.

A graphical proof that a frieze containing the letter H ( i.e. HHH... ) has symmetry group pmm2.


Or do it the other way around: take a letter R frieze and transform it to a frieze with p1a1 symmetry.



And now I can't wait to start with the Wallpaper Patterns. So, if you don't like a subject you can do two things: wait until you start liking it which may be never, or take creative action so that you -do- like it.

Jumat, 27 Januari 2012

Mathematica Stack Exchange in Public Beta

If you are into Mathematica then this site is worth a visit. They are now in Public Beta.

Stack Exchange Q&A site proposal: Mathematica

You will find expert advise on that site. It is absolutely amazing. Entire issues are solved. I dealt a lot with commercial support organizations charging millions (!) in license fees every year for which they gave crap support in return ( not referring to Wolfram ). Sites like Stack Exchange are -in part- an answer to that, I suppose. They are like a wake-up-call for the very expensive low quality commercial support sites.

Kamis, 26 Januari 2012

Affine transformation rules - Revisited

Following yesterday's post here are the 'five rules' which aren't rules in Mathematica. Basically there is only one rule where the affine transformation consisting of invertible matrix $A$ and vector $t$ are mapped to a 3-by-3 matrix after which composition of affine transformations ( including translations only ) can be done by multiplying matrices.


f[A_, t_] := ArrayFlatten[{{A, Transpose[{t}]}, {0, 1}}]


Click to enlarge size.

Sabtu, 21 Januari 2012

Tiling Constructors in Mathematica

Go to the Wolfram Demonstrations site or write your own, in Mathematica. ( Shamelessly plugging Mathematica, I am just a devoted fan of the product. )

http://demonstrations.wolfram.com/TilingConstructor/

Kamis, 19 Januari 2012

Guessing the Frieze Group

There are probably as many Frieze Group ( and Wallpaper Group ) 'guesser programs' as there are programming languages. I chose a Frieze Group guesser that has been written in Mathematica.

http://demonstrations.wolfram.com/GuessingTheFriezeGroup/

If you don't have Mathematica, there is a free Mathematica Player. There are also Student and Home Editions ( with all functionality ) at a much reduced price.

Kamis, 12 Januari 2012

Sabtu, 24 Desember 2011

Calculating Galois Groups in Mathematica

If you are ( like me ):
- ( relatively ) new to Galois Theory
- looking for software to support your study of Galois Theory
- prefer software written in Mathematica because you know your way around in it,
then you should continue reading this post.

This year I became quite a fan of the sites of StackExchange. It is a priceless source of readily available know-how. I did not know where to begin looking for Galois Theory Software ( although I knew it existed ) so I posted a question in Mathematics StackExchange here: http://math.stackexchange.com/questions/93689/software-for-galois-theory As you can see I got answers fairly quick. It seemed that Sage, Magma have built-in support for Galois Theory. Both Mathematica and GAP have add-on package solutions. Needless to say these solutions will differ in capabilities, speed and so forth. But I wanted to focus on studying Galois Theorym and not wander off in software land. I accepted the Mathematica answer and pursued that route.

The package did not work!

Written more than a decade ( make that a century or more in software time ) ago or FIVE major releases of Mathematica ago. It got terminally deprecated. Function names used in the package were used in later releases of Mathematica with other, new functions. Other used functions got deprecated and were finally terminated. Software written with an older release can only be opened through the compatibility manager in Mathematica which is quite good at fixing issues. Not this time, which I ascribe to the sheer age of the package. In my confusion I posted the following question in Stack Overflow : http://stackoverflow.com/questions/8624000/how-to-handle-tag-arrow-is-protected-message-in-mathematica

With some help I was able to correct the issues. I don't know how or where to post it because the download came from here: http://library.wolfram.com/infocenter/Articles/2872/

So if you don't want to go the same issues just follow the posts above. I am of course willing to share my version 8 compatible version of the package.

Kamis, 15 Desember 2011

Stirling numbers of the first kind.

Definition. S1[n,k] (Stirling number of the first kind) is the number of permutations of length n containing k cycles, multiplied by the sign of these permutations.

Example: 
Permutation Cycles
123 (1)(2)(3)
132 (1)(23)
213 (12)(3)
231 (123)
312 (132)
321 (13)(2)
Thus:
S1[3,1]=2
S1[3,2]=-3
S1[3,3]=1

Stirling Numbers of the first kind are implemented in Mathematica as StirlingS1.

Jumat, 09 Desember 2011

Solving the Königsberg Bridge Problem with Mathematica

One of the most famous problems in the history of mathematics is the Königsberg Bridge Problem because it clearly marks the beginning of Graph Theory.


"... In addition to that branch of geometry which is concerned with magnitudes, and which has always received the greatest attention, there is another branch, previously almost unknown, which Leibniz first mentioned, calling it the geometry of position. ..."
Soluti problematis ad geometriam situs pertinentis, Euler 1736

The Königsberg bridge problem asks if the seven bridges of the city of Konigsberg (*) over the river Preger can all be traversed in a single trip without doubling back, with the additional requirement that the trip ends in the same place it began. Euler proved in 1736 that there is no such traversal. (*) Königsberg = Kaliningrad in the Russian exclave between Poland and Lithuania.

Using Graph Theory the problem is equivalent to asking if the multigraph on four nodes and seven edges (see figure) has an Eulerian cycle. Using Mathematica we would model each bridge as an edge and the parts of the city as a vertex. There are different ways to create a graph in Mathematica, but this problem suits the method of creating a graph from an adjacency matrix. Since EulerianQ returns false we know that Mathematica confirms Euler's original answer.

Kamis, 08 Desember 2011

Combinatorica

The following function in the Mathematica Combinatorica package ShowGraphArray[Partition[FiniteGraphs, 4]] produces the following graphic.


I found it in the book 'Computational Discrete Mathematics, Combinatorics and Graph Theory with Mathematica, by Sriram Pemmaraju and Steven Skiena, Cambridge 2003.' It's not the typical Proposition / Proof mathematics book but it does give you access to about 450 -practical- freely available ( if you have Mathematica ) tools to extend your problem solving toolkit.

Selasa, 08 November 2011

Graphica at Google Code

Graphica is now a real project. I don't know how many projects get started, I do know a lot of them die unfinished. I can only say that I hope this won't happen to Graphica. I will try to push it forward at a steady pace. It is not that I thought about it yesterday and well, started a project to 'see what happens'.

- I have been thinking about it for years.
- I silently programmed a prototype in Mathematica,
- made an extensive study of Mathematica graphics,
- studied how to develop a language-to-language compiler in Java,
- spec'ed the language,
- selected the Java frameworks, and tools to start with,
- chose a license

so: it's time to start hacking! At last. All I need now is a home for my code to live:


Graphica at Google Code.

Senin, 07 November 2011

Graphica preview

I don't think there are much limits, if any, to the graphics you can create with Mathematica, besides your own imagination of course.

My study project involves mathematics, computer science and art. It is called Graphica, it is basically an IDE to develop applications using Mathematica Graphics. For this I have designed a new simplified language to create -and animate- graphics. The most basic application is of course creating graphics. I have included some pics. Of course this is a project 'in progress'. I intend to release it as an open source app. More as the project develops.

The following images are candidates for the standard object library. They are created in Mathematica with SphericalPlot3D and are called 'butterfly' in Graphica.



Various polyhedra which are easy to create in Mathematica by accessing the PolyhedronData database functions.


More examples in one of my facebook albums, if you are interested.

Senin, 31 Oktober 2011

Graphica - Scene Graph Language

Like everyone else, I suppose, I have a need to express my creativity. To facilitate this I am coding a small programming language to create graphical art. Although, for me, Mathematica is -the- language to do that I want to have a language that kids of age 8 to 88 ( TinTin or Donald Duck readers ) could learn. By using it geometric transformations like rotations and translations are learned in a natural way.

The graphic like the one below, including the rotation, is an example what the language could create with a few lines, a Mathematica Kernel is required but will run in the background only.



To be continued.

Sabtu, 22 Oktober 2011

Solving quadratic congruence equations in Mathematica

This is as yet the last post in the LQR series. If you are only interested in -solving- ( quadratic ) congruence equations then this is the way to do it in Mathematica:

As a general Diophantic equation:
In[1]:= Reduce[x^2==123456+1299709 k,{x,k},Integers]

Out[1]= (C[1]\[Element]Integers&&x==427784-1299709 C[1]&&k==140800-855568 C[1]+1299709 C[1]^2)||(C[1]\[Element]Integers&&x==871925-1299709 C[1]&&k==584941-1743850 C[1]+1299709 C[1]^2)


Or slightly more elegant as a pure congruence equation ( thanks to: Mr. Wizard ):
In[2]:= Reduce[x^2 == 123456, x, Modulus -> 1299709]

Out[2]= x == 427784 || x == 871925