Contact:
sales@biotechnologyforums.com to feature here

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PERL Program - BINC 2015 question
#1
Question :
i) An autocatalytic reaction is described by the expression
x/P = [exp(at) -1]/ [1 + b exp(at)], with a= ( A +P)k and b = P/A.
Write a program in C or JAVA or Perl or PYTHON to calculate x/P for three values of t (t =1,2 and 3)
using a & b as given in the input file autocat.dat.
Report if the saturation is reached by printing a string, “The saturation is reached. The values
are” and then print the value of ( x/P, a, b and t) for the saturation point.
Otherwise, print the message “ The Saturation is not reached” . All your output, including
these messages is to be saved in a file called autocat.out.



Solution :


#!/usr/bin/perl -w
# BINC 2015 sample question paper 3 solution
use strict;
my ($line,@arraya,@arrayb,$xp,$t,$j);
my $i=0;
open (FILE, "autocat.dat.txt") or
die "Cannot open file \n\n" ;

while ($line = <FILE>)
{
if ($line =~ /^a/ )
{ next; } 
else

$arraya[$i] = (split (/\s+/, $line))[0];
$arrayb[$i] = (split (/\s+/, $line))[1];
$i++; 
}
}
close FILE;

$j=$i; 
print "The value of J=$j \n";
open (OUTPUT, ">autocat.out");
for ($t=1;$t<4;$t++)
{
for($i=0;$i<$j;$i++)
{
$xp = (exp($arraya[$i]*$t) -1) / (1 + ($arrayb[$i]*exp($arraya[$i]*$t))); 
print "When T=$t the value of XP=$xp \n";
if ($xp==100)

print "The saturation is reached. The values are : \nXP=$xp \na=$arraya[$i] \nb=$arrayb[$i] \nt=$t\n\n";
print OUTPUT "The saturation is reached. The values are : \nXP=$xp \na=$arraya[$i] \nb=$arrayb[$i] \nt=$t\n\n";
}
else

print "The Saturation is not reached \n\n";
print OUTPUT "The Saturation is not reached \n\n";
}

}
close OUTPUT;

  

Possibly Related Threads...
Thread
Author
  /  
Last Post
Replies: 0
Views: 594
04-25-2017, 03:18 PM
Last Postbinu
Replies: 0
Views: 369
04-25-2017, 03:05 PM
Last Postbinu
Replies: 0
Views: 379
04-25-2017, 03:04 PM
Last Postbinu
Replies: 1
Views: 701
04-25-2017, 03:39 AM
Last PostSaurabh R.
Replies: 0
Views: 583
04-24-2017, 05:46 PM
Last Postbinu



Users browsing this thread:
1 Guest(s)

PERL Program - BINC 2015 question00