Symbolic Computation – Differential Calculus using Prolog – Part 1

Note: It seemed that there was some kind of publishing Error in this post. Few symbols were missing. Now things are rectified and post is clear.

I write this after I got impressed with the Prolog’s powerful pattern matching stuff. There should be a alternative to Prolog in the pattern matching stuff, RegEx sounds convincing, but not as much like prolog.

Symbolic Computation is one of the interesting fields of mathematical computation that is implemented in computer for performing the symbolic mathematical operations such as Algebra, Differentiation, Integration. Lot of computer software packages like MatLab, Mathematics supports symbolic computations.

So what is symbolic computation?

Symbolic Computation is just performing the mathematical computation on symbols like , “x”, “y”, “dx” etc. in computer using some computer programming languages.

All the mathematical expression, including variable (with numeric sometime) based expression which are computed under certain mathematical rules are known as symbolic computation. Integrations are computed by integral rules, differentiation is differential calculus rules and so on.

The above are some examples of symbolic computing. But in manual work this seems to be easier, because humans know how to perform a simple simplification, derivative and integral.

But for computers, it is not possible. It need to be teached by writing programs to perform these operations. But now the question is, which programming language to use. Let’s have a brief discussion.

Which Programming Language?

Prolog was one of popular language used for Some of the AI stuffs . Since my problem is some what related to applying intelligence for a machine to perform symbolic computation, I choose Prolog. Since prolog language works on pattern matching, My symbolic computation also works in the same way i.e. pattern matching. if I have two “x” ( say, “x + x”) then I would add these two and write it as “x”. The same applies to y, x, a and any variable.

Prolog is easy to write and understand. I wrote all the things as Facts, as what we write in Java or C++ known as Methods encapsulated inside the Objects. All the function in prolog are named as Facts.

Getting Prolog :

Prolog is freely dustributed programming language, available for both windows and Linux platforms.

  • For Linux, gnu-prolog is available
  • For windows Amzi Prolog – Students Version is one of the freely available prolog.

Here in this article I take an example of Differential Calculus (derivative) i.e. how to differentiate a given expression with respect to a variable and produce the result.

First I need to know the basic rules for differentiation:
  • d ( C , x ) = 0
  • d ( x , x ) = 1
  • d ( x^n , x ) = x * x ^ ( n – 1 )
  • d ( u ± v , x ) = du/dx ± dv/dx
  • d ( u * v , x ) = u * dv/dx + v * du/dx
  • d ( sin(x) , x ) = cos (x)

The above are some rules for basic differentiation. So the notation here I used are easily understandable, any way I explain them.

Notation

Meaning

d

Differentiation Function

1st argument

Function to be differentiated

2nd argument

With respect to variable

^

Raised to the poIr of

*

Multiplication

+

Addition

Subtraction

/

division

Now let us define the above rules in the prolog as facts. I first describe a structure for the differentiation function.

d ( f(x) , x , R ).

f(x) => function to be differentiated

x => with respect to variable

R => Result
Now let us define the facts in prolog.


Continued with Part – 2

Symbolic Computation – Differential Calculus using Prolog – Part 2

6 thoughts on “Symbolic Computation – Differential Calculus using Prolog – Part 1

  1. Slightly off topic perhaps, but a plea for people to think about the ethics of purchasing wetsuits. Please try and consider, for example, the things the product is manufactured with, the human rights of the factories where they’re manufactured and the ethics of retailers. And try to recycle rather than discarding. Thanks!!!!

  2. Something is wrong, may be
    d ( x^n , x ) = x * x ^ ( n – 1 ) =>
    d ( x^n , x ) = n * x ^ ( n – 1 )

  3. I drop a leave a response each time I appreciate a post on
    a website or if I have something to contribute to the conversation.
    Usually it’s triggered by the passion displayed in the post I looked at. And on this post Symbolic Computation – Differential Calculus using Prolog – Part 1 | Moved to mymindleaks.com. I was excited enough to drop a comment😉 I actually do have a few questions for you if you tend not to mind. Is it only me or does it look like like a few of these comments come across like coming from brain dead people?😛 And, if you are writing on additional social sites, I would like to follow you. Could you list all of all your communal sites like your linkedin profile, Facebook page or twitter feed?

  4. hey there and thank you for your info – I have definitely picked up
    something new from right here. I did however expertise some technical points using this site, since I
    experienced to reload the website lots of times previous to I could
    get it to load properly. I had been wondering if your hosting is OK?
    Not that I am complaining, but sluggish loading instances times will very frequently affect your placement in google and can damage your
    high-quality score if advertising and marketing with Adwords.
    Well I’m adding this RSS to my email and could look out for much more of your respective exciting content. Make sure you update this again soon.

  5. It is appropriate time to make some plans for the long run and it is time to
    be happy. I’ve read this publish and if I may I want to counsel you some interesting issues or tips. Maybe you could write next articles regarding this article. I desire to learn more things approximately it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s