Sunday, November 30, 2025

Ancient Coins in India

Ancient coins -> source of history

Inscriptions on the coins provide plenty of information about the empire

{economy of empire, about the ruler, his achievements, about the culture of the dynasty}

 Gold coins -> Wealthy dynasty              

 Copper coins -> Poor dynasty

 Engraved figures -> Nature of the king who issued

 King issues a coin celebrating his victory over another king -> Tells us of warfare

Thursday, February 2, 2023

When to use Old Tax Regime

I have written a python script to calculate when to use old tax regime compare to new tax regime, below table conveys:

If your salary is 8L and if your exemption is more than 1.6L then choose old tax regime, if your salary is more than 15L and if your exemption is more than 3.75L choose old tax regime

Exemption does not include standard deduction since standard deduction is common to both, so it is deducted in both the incomes

Script can calculate upto 50L salary, to make it simple it does not contain surcharges !! 



import math
oldRegimeIncomeTaxSlabs = [[0, 2.5], [5, 2.5], [20, 5], [30, math.inf]]
newRegimeIncomeTaxSlabs = [[0, 3], [5, 3], [10, 3], [15, 3], [20, 3],[30, math.inf]]
standard_ded = 50000
#nps = 0
def taxCalculation(totalSalary, regime, totalExemption):
if regime == 'old':
regimeSlabs = oldRegimeIncomeTaxSlabs
else:
regimeSlabs = newRegimeIncomeTaxSlabs
totalExemption = 0
taxableIncome = totalSalary - totalExemption -standard_ded
tax = 0
index = 0
taxableIncomeAux = taxableIncome
while(index < len(regimeSlabs) and taxableIncomeAux > 0):
if taxableIncomeAux >= regimeSlabs[index][1] * 100000:
tax = tax + regimeSlabs[index][1] * 100000 * regimeSlabs[index][0] * 0.01
else:
tax = tax + taxableIncomeAux * \
regimeSlabs[index][0] * 0.01
taxableIncomeAux = taxableIncomeAux - regimeSlabs[index][1] * 100000
index += 1
return tax

income_min = 800000
income_max = 2500000
exemption_min = 0
exemption_max = 500000
income_temp = income_min
exemption_temp = 0
x = 0
income_exempt = {}
while income_temp < income_max:
exemption_temp = 0
newTax = taxCalculation(income_temp, 'new', 0)
while exemption_temp < exemption_max and exemption_temp < income_temp:
exemption_temp += 5000
oldTax = taxCalculation(income_temp, 'old', exemption_temp)
print(income_temp, exemption_temp, newTax, oldTax)
if(oldTax <= newTax):
if income_temp not in income_exempt:
income_exempt[income_temp] = exemption_temp
income_temp += 100000

print(income_exempt)
for key, value in income_exempt.items():
print(key, value)



Monday, April 27, 2020

Docker

This is for MAC users.

Get the docker from the below website

https://hub.docker.com/editions/community/docker-ce-desktop-mac/

After downloading and place it in application folder

then check

jitsunda@JITSUNDA-M-C3T1 ~ % docker --version        
Docker version 19.03.8, build afacb8b
jitsunda@JITSUNDA-M-C3T1 ~ % 


Wednesday, July 4, 2018

Form 26 AS View [for my reference]

In order to file an income tax, we need to have Form 26 AS

For the past two weeks whenever I click, I have been re-directing to nri services !! :(

(I am connected to (vpn) in my laptop and the browser assumes that the client is from outside India) !!

once I disconnect vpn, it lands up in proper TDS website instead of asking for nri registration




Thanks and Regards
Jith

Wednesday, January 3, 2018

First python script

Open an editor with first.py

type below lines

print("hi")

print("jith")

Now run it in terminal,

JITSUNDA-M-C2XF:~ jitsunda$ python3 first.py
hi
jith

JITSUNDA-M-C2XF:~ jitsunda$ 

Python interactive mode - REPL

Read–Eval–Print Loop (REPL) is an interactive language shell or interactive computer programming environment. The advantage of having REPL is that the environment receives input from user, evaluates and results in an interactive manner. No need for scripting.


JITSUNDA-M-C2XF:~ jitsunda$ python3
Python 3.6.3 (default, Oct  4 2017, 06:09:15) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> 

I use python3, 

Simply type python3, we will get ">>>" prompt, we can write simple instructions and get the results as shown below



JITSUNDA-M-C2XF:~ jitsunda$ python3
Python 3.6.3 (default, Oct  4 2017, 06:09:15) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print("hi")
hi
>>> 4+3
7
>>> x = "jith"
>>> x
'jith'

>>> 

Intro to Python

Introduction to Python

Python is a computer language similar to C, C++, Java, C# etc .. However there are lot of features in python make it unique compare to other languages. Especially, the unprecedented growth of data science and machine learning is making Python as most popular language at present. This is due to the flexibility and computational friendly nature of Python.

Advantages of Python

Very high level language, so we can prototype rapidly an idea or an algorithm
Object oriented programming, Interpreted, Interactive and Portable
It can interact with C and C++ well (Extensibility feature of Python)
Large set of packages
Easy integration
Apt for scientific computing
Dynamically typed

Limitations of Python

In my opinion, Still it is considered as glue language or just scripting language or language for automating tasks in industry rather than being used as a main-stream language such as Java, C#, C etc ..
Slow compare to C






Sunday, October 11, 2015

pthread

#include "stdio.h"
#include "stdlib.h"
#include "pthread.h"

void thread_run(int m){

    int i = 0;
    while( i < 100 ){
        printf("I am in thread %d\t %d\n", m, i);
        i++;
    }

}

int main()
{
int i;
pthread_t tid;

    for(i = 0; i < 5; i++){
   pthread_create(&tid, NULL, thread_run, i);
    }

pthread_exit(NULL);
return 0;
}

 gcc -lpthread -o pt examp_1.c

Monday, October 21, 2013

Need for 'Pi'

'Pi' the miracle number
-----------------------------


I was asked( long back may be 4 years) to write which known formula provides maximum number of digits to the value of 'pi'. Since my tutor is soft enough, I bravely (rare thing from me :) ) wrote in the paper that "I do not know the formula, but using Ramanujan's formula( which is what he expected, he is a fan/ devotee of great Ramanujan) we can calculate up to some thousands and lakhs of digits, at the same time, in my opinion, the universe radius is in the order of 10 to the power 15 or 20, even if we want to calculate the volume of the universe, it is enough to find around 60 to 70 digits accuracy, I do not know the motivation of finding so many digits for pi, may be this is due to mathematicians' dream/ ego to find out this miracle (maximum number of digits)" !!
Then he explained one of the applications is to test the computation complexity using 'pi' related findings !! 

Now when I saw this article, I remember those days !!


I should have read this article before writing in the paper, but what to do I thought about this after when I read the question !! 


Thursday, October 17, 2013

Sum of cube of first n natural numbers is the square of the sum of first n natural numbers !!

Proof for (Simple Try) !!
Sum of cube of first n natural numbers is the square of the sum of first n natural numbers !!

13+23 + 33+ … +n3 = (1 + 2 + 3+...+n) 2 

As we know the simple formula
----------------------------------
(a + b) 2 = a2 + 2*ab + b 2

(a + b + c) 2 = a2+ b2+ c 2+ 2 (ab + ac 
                                                    + bc)

(a + b + c + d) 2= a2+ b2+c2+ d2+ 
                                                     2(ab + ac + ad 
                                                             + bc + bd 
                                                                     + cd )

The above algebric formula has some pattern ( marked as bold) .. 2 ( a (b+c+d) + b (c+d) + cd))

Now let us look into (1 + 2 … + n) 2

(1 + 2 … + n) 2   = 
             
           12+ 22 + 32 .. + n2 + 2*{1(2+3+4..n) + 2 (3+4+...+n) + ... (n-1)(n)}

             
 (1 + 2 … + n) 2= 
                             12+ 22 + 32 .. + n2 +  2*{1*2 + 1*3 + 1*4 + …+ 1*n
                                           + 2*3 + 2*4+ … + 2*n
                                                    + 3*4+…. + 3*n
                                                             +…..+ (n-1) (n)}

Consider the violet terms, this can be written as

2 * 1 + 3 (1+2) + 4 (1+2+3) + …+ (n)(1+2+…(n-1))

using some of first n terms formula ... ( n * (n+1) / 2)) 

The above terms can be rewritten as

2 + 3(2 * 3/2) + 4(3*4/2) + 5(4*5/2) + …. +n((n-1)n/2))

After simplifying, This can be written as

(1 + 2 … + n) 2= 12+ 22 + 32 … + n2 + 2 {2 + 3(2*3/2) + 4 (3*4/3) + ….. n ((n-1) (n/2)}

                          = 12+ 22 + 32 … + n2 + {1*22+2*32 + 3*42….+ (n-1)n2}

                          = 12+ 22 + 32 … + n2 + 22 + 2*32 + 3*42 + ... + (n-1)n2 

upon rearranging the terms

                           = 12+ (22 +  22) + (32 + 2*32) + … + ((n-1)n2 + n2) 

                            = 12+ (2 * 22 ) + ( 3 * 32) + … + (n* n2) 

                            =13+ 2 3+ …+ n 3  
                
(1 + 2 + 3 … +n) 2 = 13+ 2 3+ … +n 3          
                                              
Change LHS to RHS and vice –versa

13+ 2 3+ … +n3    =    (1 + 2 + 3 … +n) 2

FROM the induction ( 1 + 2 + 3 … n ) = ( n (n+1) / 2 ) the above equation can be written as

13+ 2 3+ … n3     =    (n (n+1)/ 2) 2  

Tuesday, September 3, 2013

Optimized Bubble Sort - for my reference

#include "stdio.h"
#include "conio.h"


//swapping function

void swap(int* a, int *b){
      int temp;
      temp = *a;
      *a = *b;
      *b = temp;
}

//sorting function

void sort(int* a){
          
     int i = 0;
     int j = 0;
     int temp = 0;
     int flag = 1;
     int m =0;
    //optimized bubble sort using flag Variable which stops the loop after the array is sorted
    
    for (i = 0; ((i < 5) && (flag == 1)); i++ ){
       
         flag = 0;
         m = i;
         for (j = 0; j < 5-i; j++){
             
              if(a[j] > a[j+1]){
                      
                      swap(&a[j],&a[j+1]);                     
                      flag = 1;
              }
         }         
     }     
}

//main function

int main(){ 
    
    int* array;
    int i = 0;
    
    //Array creation dynamically
    array = (int*) malloc (5*sizeof(int));
    
    //Sample array
    array[0] = 78;
    array[1] = 56;
    array[2] = 93;
    array[3] = 19;
    array[4] = 104;
    
    for( i = 0; i < 5; i++){
         
         printf("%d \t", array[i]);
    }
    printf("\n\nAfter Sorting \n\n");
    sort(array);
    
    for( i = 0; i < 5; i++){
         
         printf("%d \t", array[i]);
    }
    getch();
    return 0;
}
   

Tuesday, August 13, 2013

Java Linear and Binary Searching - For my reference


public class Searching {

/**
* @param args
*/
public static void main(String[] args) {

int arrayNumbers[] = new int[] {55, 65, 76, 89, 123, 43, 56, 23, 11, 107, 98 };
int searchNumber = 89;
int pos = 0;
int posB = 0;
int unsortedArray[] = new int[arrayNumbers.length];
System.arraycopy( arrayNumbers, 0, unsortedArray, 0, arrayNumbers.length);
arrayNumbers = sort(arrayNumbers);

for (int i = 0; i < unsortedArray.length;i++){


pos = linearSearch(arrayNumbers, unsortedArray[i]);
posB = binarysearch(arrayNumbers, unsortedArray[i]);
System.out.println(unsortedArray[i] + "\t" + pos + "\t" + posB + "\t" + arrayNumbers[i]);
}
}

private static int binarysearch(int[] arrayNumbers, int i) {

int lower = 0;
int upper = arrayNumbers.length - 1;
int cur = 0;

while (true){

cur = (lower + upper) / 2;

if(i == arrayNumbers[cur])

return cur;
else if (lower > upper) 

return arrayNumbers.length;

else {

if(i > arrayNumbers[cur])

lower = cur + 1;

else 

upper = cur - 1;
}
}


}

private static int linearSearch(int[] arrayNumbers, int searchNumber) {

for(int i = 0; i < arrayNumbers.length; i++){

if(searchNumber == arrayNumbers[i]){

return i;
}

}
return 0;
}

public static int[] sort (int[] arrayNumbers){

int temp = 0;
for (int i = 0; i < arrayNumbers.length ; i ++ ){

for (int j = 0; j < arrayNumbers.length; j++) {

if(arrayNumbers[i] < arrayNumbers[j]){

temp = arrayNumbers[i];
arrayNumbers[i] = arrayNumbers[j];
arrayNumbers[j] = temp;
}
}
}
return arrayNumbers;
}
}


Friday, August 9, 2013

linked list - simple adding and deleting in between - for my reference

#include "stdio.h"
#include "stdlib.h"

struct node {
   
   int   data;
   struct node* next;
};

int length(struct node *head){
    
    struct node* current = head;
    int count = 0;
    while ( current != NULL ){
          
          count++;
          current = current -> next;
    }
return count;
}

void display(struct node *head) {
     
      
    struct node* current = head;
    int count = 0;
    while ( current != NULL ){
          
          printf("%d \t", current -> data);
          current = current -> next;
    } 
    printf("\n \n");
}

void delete ( struct node* head, int pos) {
     
     int k = 0;
     struct node* current = head;
     for( k = 0; k < pos; k++){
          
          current = current -> next;
     }
     current -> next = current -> next -> next;
}

void add ( struct node* head, int pos, int data) {
     
     int k = 0;
     struct node* current = head;
     struct node* newNode = malloc(sizeof(struct node));
     for( k = 0; k < pos; k++){
          
         current = current -> next;
     }
     
     newNode -> next = current -> next;
     newNode -> data = data;
     current -> next = newNode;
}         
     
int main(){

    int k = 0;
    int m = 0;
    int i =0;
    int pos = 3;
    struct node* head = NULL;
    struct node* current = NULL;
    struct node* nextCur = NULL;
    
    head = malloc (sizeof (struct node));
    current = malloc (sizeof (struct node));
    head -> data = 1;
    head -> next = current;
    current -> next = NULL;
    
    for(i = 0; i < 5; i++){  
          
         current -> data = i;
         nextCur = malloc (sizeof (struct node));
         current -> next = nextCur;
         current = nextCur;
     }
   current -> data = i; 
   current -> next = NULL; 
      
   display(head);    
   
   delete (head, pos);
   
   display(head);   
   
   add (head, pos, 10); 
   
   display(head); 
    
getch();
return 0;
}
    

Simple Linked List -for my reference !!


#include "stdio.h"
#include "stdlib.h"


struct node {
   
   int   data;
   struct node* next;
};

int length(struct node *head){
    
    struct node* current = head;
    int count = 0;
    while ( current != NULL ){
          
          count++;
          current = current -> next;
    }
return count;
}

void display(struct node *head) {
     
      
    struct node* current = head;
    int count = 0;
    while ( current != NULL ){
          
          printf("%d \t", current -> data);
          current = current -> next;
    } 
    printf("\n \n");
}
     
int main(){

    int k = 0;
    struct node* head = NULL;
    struct node* second = NULL;
    struct node* third = NULL;
    struct node* twothree = NULL;
    
    head = malloc (sizeof (struct node));
    second = malloc (sizeof (struct node));
    third = malloc (sizeof (struct node));
    twothree = malloc (sizeof(struct node));
  
    head -> data = 1;
    head -> next = second ;
    
    second -> data = 2;
    second -> next = third;
    
    third -> data = 3;
    third -> next = NULL;
    
    printf("List with three elements \n");
   
    display(head);
    k = length(head);
    printf("\n adding a node in between second and third \n");
    
    twothree -> data = 10;
    second -> next = twothree;
    twothree -> next = third;
    
    display(head);
    k = length(head);
    display(head);
    
    printf ("\nThe length of the list %d\n \n", k);
    
    printf ("\nDeleting a node twothree \n \n");
    
    second -> next = third;
    
    k = length(head);
    display(head);
    printf ("The length of the list %d \n \n", k);
    
    
getch();
return 0;
}
    

Wednesday, June 27, 2012

How to be confident

Confidence = Trust in your own power and judgment

1. Changing dressing style and hair style
2. Go to gym to have fitness
3. Powerful walking style
4. Good posture
5. Take up spaces
6. Compliment other and be gracious
7. Sit in the front row
8. Be vocal
9. Focus on others
10. Involve charity work
11. Do outside your normal activity
12. Distinguishing from others
13. Have an eye contact
14. use words like Man/ Dude
15. Nod up
16. Smile when you walk into a room
17. Talk to people
18. Do not compare yourself with anyone
19. Help one person per day
20. Follow your passion
21. Label yourself positively

Ref : http://www.youtube.com/watch?v=8SC7-EUkFNo

Friday, June 1, 2012

Lyrics

Desh Mere 

Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu
Mitta Ne Se Nahin Mitte
Mitta Ne Se Nahin Mitte Darrane Se Nahin Darrte 
Watan Ke Naam Pe 
Watan Ke Naam Pe Hum Sar Katane Se Nahin Darrte
Mitta Ne Se Nahin Mitte
Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu

Hazaron Khwaab Roshan Ke Sulagti Si Nigaahon Mein 
Sulagti Si Nigaahon Mein 
Kafan Hum Baandh Ke Nikle Hai Azadi Ki Rahon Mein
Kafan Hum Baandh Ke Nikle Hai Azadi Ki Rahon Mein
Nishaane Pe Jo Rehte Hai Nishaane Se Nahin Darrte 
Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu

Hamari Ek Manzil Hai Hamara Ek Naara Hai 
Dharm Se Jaat Se Zyaada Humme Yeh Mulk Pyaara Hai
Dharm Se Jaat Se Zyaada Humme Yeh Mulk Pyaara Hai
Hum Is Pe Zindagi Apni Mittane Se Nahin Darrthe
Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu

Mitta Ne Se Nahin Mitte Darrane Se Nahin Darrte 
Watan Ke Naam Pe 
Watan Ke Naam Pe Hum Sar Katane Se Nahin Darrte
Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu
Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Jaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu
Desh Mere Desh Mere Meri Shaan Hai Tu 
 
Meaning
 
 

Wednesday, May 30, 2012

Economic Crisis

Last two decades, India has been exporting software and last decade, decrease in Indian rupee use to have good impact much, because quantity (in dollars) of exports (software) is greater than quantity of imports (in dollars).

But, now decrease in rupee value creates issue because of

1) We import more (oil, cosmetics, food items etc..) compare to exports (Softwares and other products)
2) Our deficit is in dollar rather than in rupees to the world bank
3) Decrease in rupees creates instability and  investment unfriendliness for the foreign companies..

I am in Singapore (1 SGD = 39 Rs (Feb) and now 1 SGD = 43 Rs (May)), I should be happy but I can not be happy and I can not enjoy/ diggest the drastic decrease in Indian rupee..  India does not deserve to be in this situation !! 


Around 300 million Indians are getting benefited because of liberalization in the year 1991, credit goes to Dr. Manmohan singh. PM (Pranab Mukharjee) , please do something with the help of PM (Prime minister) !!


Am I right ?

Vande Mataram and Bharath Matha Ki Jai !!