Mathematics to solve real-world problem

Analysing problem of global warming using Mathematics

we studied mathematics in high-school, degree college but never tried to apply the concepts in real-world. I was just thinking what example I shall take and how to write a program for the same. I got to know an interesting problem, only the problem is interesting but in real the problem is really worrying.

Problem – WRITING SOME WHAT DIFFERENT PROGRAM, SIMPLE BUT DIFFERENT

in Arctic the ice surface reflects 90% of the radiation but the water surface reflects only 10% of the radiation. Considering the fact in last two decades the Arctic like places showing effect of climate change. The water surface absorbs 90% of the radiation and hence leads to chain reaction. Assuming for every 1000 gray radiation, 0.65 sqft/hr water formation from ice surface, to predict how much ice surface might vanish and what could be the impact on global warming in next two decades?

To solve this problem one must apply integration which we study in Mathematics calculus, the same problem in other way to find out the rate of change of water surface can be evaluated using differential calculus.

Let me try out this problem with a C program, definitely I still didn’t find the integration or differential calculus equation to solve, but let me prepare set of simulated data with certain assumptions.

C Program

#include 
#include 
#include 
/*
    Ice surface - reflects 90% of the sun light
    Water surface - reflects 10% of the sub light
    100 ice surface             - 10% absorbs
    100 water surface           - 90%
    Radiation = 100 gray
    100 * 90 = 9000 gray
    100 * 10 = 1000 gray
    assume that as temperature decreases ice surface increases, at the rate say 0.6 sqft per 1000 gray
*/
struct ICE_RADIATION_INFO{
    float iceSurfaceArea;
    float waterSurfaceArea;
    float radiationQuantity;
    
    float iceSurfaceAbsorption;
    float waterSurfaceAbsorption;
    
    float waterFormationPerHour;
};
typedef struct ICE_RADIATION_INFO ICE_RADIATION_INFO;
int main(int argc, const char * argv[])
{
    ICE_RADIATION_INFO iceRadiationSamples[100];
    short int index;
    
// Just to initialise the set of data for analysis - 
    for (index = 0; index < 100; ++index) {
        ICE_RADIATION_INFO  *iceRadiationSample = &iceRadiationSamples[index];
        // 1.5 is constant taken to generate area in floating point number
        iceRadiationSample->iceSurfaceArea = (rand() % 100) * 1.5;
        iceRadiationSample->waterSurfaceArea = iceRadiationSample->iceSurfaceArea;
     
        iceRadiationSample->radiationQuantity = (rand() % 1000) * 1.5;
        
      // absorption is as per discussion 90% from water surface and 10% from ice surface
        iceRadiationSample->iceSurfaceAbsorption = iceRadiationSample->radiationQuantity * 0.1;
        iceRadiationSample->waterSurfaceAbsorption = iceRadiationSample->radiationQuantity * 0.9;
    // with an assumption for every 1000 gray radiation, 0.65 sqft water forms
        iceRadiationSample->waterFormationPerHour = ( 0.65 * iceRadiationSample->radiationQuantity) / 1000; // 0.65 sqft/hr for 1000 gray
        /*
            Every hour 0.65 sqft water occumulation , this intern absorbs 90% of radiation , here have to apply integration
            dx/dt = 0.65
         */
    }
    
    printf("Surface Area \t Radiation \t\t Ice Absorption \t Water absorption\n");
    
    for (index = 0; index < 50; ++index) {
        ICE_RADIATION_INFO iceRadiationSample = iceRadiationSamples[index];
        printf("%f\t\t %f \t\t %f \t\t %f\n",iceRadiationSample.iceSurfaceArea,iceRadiationSample.radiationQuantity,iceRadiationSample.iceSurfaceAbsorption,iceRadiationSample.waterSurfaceAbsorption);
    }
    return 0;
}

OUTPUT -

Surface Area              Radiation                    Ice Absorption                  Water absorption

10.500000                   373.500000                  37.349998                           336.149994

109.500000                 987.000000                  98.699997                            888.299988

45.000000                   408.000000                   40.799999                           367.200012

66.000000                   1317.000000                 131.699997                         1185.300049

34.500000                   1063.500000                 106.349998                         957.150024

Understanding of computer Memory With a C Program

Memory is one of the important resource , we can say its a crucial resource in computers. In a limited amount of memory an operating system tries to satisfy all the applications and the need of memory.

Let us try to understand how a memory looks – the theory and an example simple program to understand the concept in a better way.

Memory –

 memory

 Understanding Of Memory

When we say a memory is allocated for an instance ! How exactly you visualise the memory and allocation ?

A memory is array of smallest unit of space which is nothing but a byte of space location. If a variable holds an integer, float or any type of data, it occupies certain set of such memory locations. Typically it looks like below.

Array of memory locations

In the above memory structure we can see how data is stored in memory.

The String “XYZ” , the number 15 , it looks like at location 12, number 15 is stored, starting from location 21, string XYZ is stored.

If I dig into the depth of it, every thing in computers will be converted into binary , so ‘X’ will be converted into binary which occupies 8 bits , similarly each character will be converted to its ASCII and the ASCII value will be converted to binary ( Ref – http://sticksandstones.kstrom.com/appen.html )

Let us consider one example and try to fill the memory locations 

char subjects[3][2][25] ;

The above character multidimensional array will holds 2 subjects of 3 semesters each of length 25 characters.

subjects[0] -> will give you 2 subjects of first sem, each subject of 25 characters.

subjects[1] -> will give you 2 subjects of second sem, each subject of 25 characters.

If I assign the subjects to this array , the subject names in memory looks like below

charArrayinMemory

For better understanding just check the below diagram of memory layout

Memory Layout