Posts

Showing posts from March, 2017

Featured Post

পরিত্যাক্ত শহর হাওড়া

  তৃতীয় বিশ্বযুদ্ধ শেষ হবার পরে অনেক কিছুর বদল হয়েছে। এখন পৃথিবী সূর্যের চারিদিকে ঘরে না বরং সূর্য সহ অন্য সকল গ্রহকে কৃত্রিম ভাবে পৃথিবীর চারিদিকে ঘোরানো হচ্ছে।সেই সময় এর কথা মৃত নগর হাওড়া। তৃতীয় বিশযুদ্ধের সময় চিনা বোমা বর্ষণের ভয়ে সমস্ত নগরবাসী পলায়ন করেছিলো। ডাঃ কেসি পাল এর নেতৃত্বে ওরা মোট চারজন মানে রমেশ, সুমিত ও মাধব সেই রহস্যময় তেজস্ক্রিয় উৎসের সন্ধানে এসেছে। সকাল এগারোটা ঝোঁপ ঝাড় ভর্তি গলি রাস্তা যেখানে বহুবছর কোনো লোকের পা পড়েনি। রাস্তার ধারে ভগ্নপ্রায় লতা পাতা দ্বারা আচ্ছাদিত হয়ে সারি সারি বাড়ি দাড়িয়ে আছে। মাঝে মাঝে কিছু বন্য পাখির ডাক শোনা যাচ্ছে। ঝিঁঝিঁ পোকার ডাকে ওদের পায়ের শব্দ ঢাকা পড়ে গেলেও ওদের যাবার রাস্তার সামনে দিয়ে কি যেনো সর সর করে রাস্তার দুদিকে নেমে যাচ্ছে।ওদের পায়ের কম্পনে রাস্তার উপর ঘাস থেকে ছোটো ছোট পোকা উড়ছে। বাতাসে ঘেঁটু ফুলের গন্ধে ছেয়ে আছে। কিছুদিন আগে ইসরোর এক কৃত্রিম উপগ্রহ ছবিতে এই পরিত্যাক্ত মৃত নগরীর উপর এক রহস্যময় আলোর সন্ধান জানা যায়। তারপর অন্য স্যাটেলাইট এর স্পেকট্রোস্কোপি বিশ্লেষণ এর মাধ্যমে জানা যায় ঐ আলোক কোনো তেজস্

Fibonacci number

Image

a function f(x).....in fortran

!Write a function for the function f(x) defiend as followos !f(x)=2*x*x+3*x+4      for  x<2 !f(x)=0                for  x=2 !f(x)=2*x*x+3*x-4      for  x>2 program function_f_x implicit none interface function f(x) real ::f real,intent(in)::x end function f end interface real::x print*,"Please entre value of x" read*,x                   if(x==2)then                   print*,"f(x)=0"                   elseif(x>2)then                   print*,"f(x)=2*x*x+3*x-4"                   else                   print*,"f(x)=2*x*x+3*x+4"                   endif print*,"x=",x print*,f(x) end program function_f_x function f(x) implicit none real::f real,intent(in)::x if(abs(x)<2.0)then f=(2.0*x**2)+(3.0*x)+4.0        elseif(abs(x)==2.0)then         f=0.0        else         f=(2.0*x**2)+(3.0*x)-4.0        endif end function f

A function in fortran.

Image
!Illustrate use of function sub program !function sub program is given below program func_use implicit none interface function S(x) real::S real,intent(in)::x end function end interface real::x,g print*,"Please entre the value of x" read*,x print*,"x=",x g=S(x+2)+S(x**2) print*,"g=",g end program func_use function S(x) implicit none real::S real,intent(in)::x S=x**2+x+4 end function

Fortran function example(interest calculation)

Image
   program interest_calculation!This program finding interest by the formula I=P*R*T/100                                implicit none                                                        interface                                                         function interest(bal,intr_rate,time)                                                          real interest                                                          real, intent(in)::bal,intr_rate,time                                                         end function interest                                                         end interface                                                        real::bal,intr_rate,time!Declare local variable                                                  print*,"Entre the balence,interest rate and time(years)"                                                      read*,bal,intr_rate,time                                                  print*,"bal=",bal,"interest rate
!Tabulate the function !f(x,y)=(x**2+y**2+2*x*y)/(x**2+y**2+8*x*y) !for the following set of values of (x,y) !(x,y)=(0,-10);(2,-8);(4,-6);(6,-4);(8,-2);(10,0) and  (12,2). program  two_diomonsional_function_tabulation implicit none real ::f_x,x,y integer ::i print*,"      x","  ","              y","  ","               f(x)" do i=0,12,2 x=i y=i-10 f_x=(x**2+y**2+2*x*y)/(x**2+y**2+8*x*y) print*,x,y,f_x enddo end program two_diomonsional_function_tabulation
!write a program to evaluate the following sum: !S=summetion(-1)**n*(x)**(n/2)/(n*(n+1)) for n=1 to 10 program sum_of_a_series implicit none real::x,s_x integer::n print*,"Type value of x" read*,x print*,"x=",x s_x=-.5*sqrt(x) do n=2,10,1 s_x=s_x+s_x*(-1)**n*x**(.5*n+.5)/(n*(n+2)) enddo print*,"S=",s_x end program sum_of_a_series
!given an integer, write aprogram to reverse and print it. program reverse_integer implicit none integer::n,digit,reverse_number reverse_number=0 print*,"type the number" read*,n print*,"      number=",n do if(n==0)then exit else digit=mod(n,10) reverse_number=(digit+reverse_number)*10 n=n/10 endif enddo reverse_number=reverse_number/10 print*,"reverse_number=",reverse_number end program reverse_integer
program point_position implicit none real ::x,y print*,"Please type point x,y"!this program find the position of a point among four quadrant read*,x,y print*,"x=",x,"y=",y if (x>0)then    if(y>0) then    print*,"the point lies on First quadrant"    else    print*,"The point lies on Fourth quadrant"    endif else  if(y>0)then      print*,"The point lies on Second quadrant"      else      print*,"The point lies on Fourth quadrant"      endif endif end program point_position
!Given a set of integers write a program to find those which are palindromes. !For example ,the number 123321 is a palindrome as it reads the same !from left to right and from rigfht to left program palindrome implicit none integer::x,digit,rev_x,y rev_x=0 print*,"Type the number" read*,y print*,"number is",y x=y do if(x==0)then exit else digit=mod(x,10) x=x*0.1 rev_x=(rev_x+digit)*10 endif enddo rev_x=rev_x/10 print*,"The reverse of the typed number is=",rev_x if(y==rev_x)then PRINT*,"The number is a palindrome number" else print*,"The number is not a palindrome number" endif print*,y end program palindrome
! Given an octal number (a number in base 8) of arbitrary length write a program to !find its decimal equivalent of the octal number 2673 is !2*8**3+6*8**2+7*8**1+3*8**0 program octal_decimal implicit none integer::octal_num,decimal_num,octal_digit,decimal_digit,i decimal_num=0 i=-1 print*,"Input the octal number" read*,octal_num print*,"The Octal number is=",octal_num do if(octal_num==0)then exit else octal_digit=mod(octal_num,10) octal_num=octal_num/10 i=i+1 decimal_num=octal_digit*(8**i)+decimal_num endif enddo print*,"Decimal equivalent number is=",decimal_num print*,"last power",i end program octal_decimal
!Write a program which will evaluate the function f for the set of values of x(0.5,1,1.5,2,2.5,3) !and tabulate the results. !f=1+x**2/2!,+x**4/4!-50*(sinx)**2+(4-x**2)**(1/2) program func_tabulation implicit none real::f_x,x integer::i!how many do reapet perfrom x=0!initial value its value changing with 0.5 inside of do loop print*,"x","  ","f(x)" do i=1,6,1!we get six result x=x+.5 f_x=1+(x**2)/(2*1)+(x**4)/(4*3*2*1)-50*(sin(x))**2+(4-(x**2))**.5 print*,x,f_x enddo end program func_tabulation
!Given values for a,b,c and d and a set of values for the variable x evaluate the function defiend by !f(x)=a*x**2+b*x+c  if=x<d !f(x)=0             ifx=d !f(x)=-a*x**2+b*x-c if x>d program function_x implicit none real::f_x,x,a,b,c,d print*,"Input a,b,c,d" read*,a,b,c,d,x print*,"a=",a,"b=",b,"c=",c,"d=",d,"x=",x if(x<d)then f_x=a*(x**2)+b*x+c else if (x==d)then f_x=0 else if(f_x>d)then f_x=-a*(x**2)+b*x-c endif endif print*,"f(x)=",f_x end program function_x

Fortran Examples...........

1 !write a program to read the radius of acircle and compute its area and circumference program circular_case implicit none real :: radius,area,circumference read*,radius print*,"radius=",radius,"unit" circumference=2*22*radius/7 print*,"circumference=",circumference,"unit" area= 22*(radius**2)/7 print*,"area=",area,"square unit" end program circular_case 2!Write a program to convert Celsius  temperature to  fahrenheit Program fahrenheit_celsius!Write aprogram to convert cuselsi  temperature to  fahrenheit Program fahrenheit_celsius implicit none real :: fahrenheit,celsius read*,celsius fahrenheit=(9*celsius)/5+32 print*,"celsius=",celsius," ","fahrenheit=",fahrenheit end program fahrenheit_celsius implicit none real :: fahrenheit,celsius read*,celsius fahrenheit=(9*celsius)/5+32 print*,"celsius=",celsius," ","fahrenheit=",fahrenheit end program fahrenheit_celsiu
                                                           some Important ubuntu command! 0.pwd(print working directory) 1.sudo (superuser do---to handel a root account,you can see I gonna using a sudo in front of many comand) 2.whoami(Identifying computer) 3.sudo su(switch to other user i.e we can using command without using sudo) 4.sudo apt-get install application_name/package_name(For installing a application without using softwar centre or installing a package) 5.cd(change directory or going to a specified directory location,cd .. for using going to back) 6.ls(list of file and folder in the current directory) 7.sl(steam engine,For making a funny animation) 8.mkdir directory-name(For making a directory with name as directory-name inside of  current directory) 9.rmdir directory-name(remove the directory which name is directory-name and also empty) 10.nano(For making a file) 11.sudo rm filename(delete a file which name is filename) 12.sudo nautilus(For opening/deleting/editing a file
Image