Sponsored Content
Top Forums Shell Programming and Scripting Simple maths calculator loop. Post 302583077 by methyl on Monday 19th of December 2011 01:26:13 PM
Old 12-19-2011
And the cheats method ... using the unix command "bc".

Code:
echo "Enter calculation" ; read calc
echo "${calc}"|bc

10+10+10
30

1024*1024
1048576

((1000*1000)/25+(20*20))
40400

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with Maths

Heres a script i wrote as a bit of practise. What it does is insert a line in the middle of a file. The line being $1 and the file being $2 #!/bin/bash rm tempfile touch tempfile count=1 linenum= `wc -l < $2` if then echo $1 >> $2 else even=`expr "$linenum" % 2` if then... (3 Replies)
Discussion started by: Quesa
3 Replies

2. Shell Programming and Scripting

a simple while loop

Hallo everyone I might just be being dumb, but I am using the BASH shell and cannot get the following script to work: x=0 while do echo $x x=´echo "$x + 1" | bc´ done Can anybody help me out. I am just get a repeating output saying: bc: command not found 0 + 1: command not... (5 Replies)
Discussion started by: syno
5 Replies

3. Shell Programming and Scripting

simple for loop

i have the following process running in background: when i give "ps -lef" ------------------------------------------------------------------------ user2 user1 user1 user3 user1 user4 user5 user4 user3 user4 user2 user1 user1 user3 user1 user4 (3 Replies)
Discussion started by: ali560045
3 Replies

4. Shell Programming and Scripting

Simple using For loop

Hi expert, I'm using csh Code: #!/bin/csh set x = 0 set number = `awk '{array=$0} END {print array;}'` i want to use for loop to store data to $number repeatly untill x = 23 How to use c shell for loop? (2 Replies)
Discussion started by: vincyoxy
2 Replies

5. UNIX for Dummies Questions & Answers

Simple loop

I need to chmod a bunch of files with a specific extension in one directory. If I understand correctly first I would run ls command like this ls -R | grep .mp3 > /tmp/list once I have the output file I should be able to run a loop to chmod all the files in the list created. This is where... (5 Replies)
Discussion started by: eugenes18t
5 Replies

6. Shell Programming and Scripting

Maths with variables

Hello, I'm trying to write a while loop for a decimal value in tcsh which I know can't be done. Instead I want my increments to be one order of magnitude too large and then divide it by 10 when I use the variable. However, I don't know how to divide my variable and set it as another. set... (1 Reply)
Discussion started by: DFr0st
1 Replies

7. Shell Programming and Scripting

a simple loop

Does any body can help me with a loop in this example? if then if then runner=$(grep "$1" "$2") runne=$(grep "$1" "$3") run=$(grep "$1" "$4") fi fi # # Message on screen... (3 Replies)
Discussion started by: bartsimpsong
3 Replies

8. Shell Programming and Scripting

Simple calculator with menu input - Need Help

I am trying to make a calculator. The user Enters number 1, chooses and operation, enters number 2, then chooses another operation or for the answer to be displayed. eg. 1 + 1 = or 1 + 1 + 2 + 1 = Both of these should be possible. #!/bin/bash read -p "what's the first number? " n1... (3 Replies)
Discussion started by: redshine6
3 Replies

9. Homework & Coursework Questions

Simple Calculator

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known/data: Script a simple calculator. In the command line enter the script file /home/etc/mycalc or /home/etc/mycalc 1 +... (6 Replies)
Discussion started by: herb bertz
6 Replies

10. Shell Programming and Scripting

Simple Scientific calculator for ADE, the UNIX environment for the AMIGA A1200(HD).

ADE is a UNIX environment for the ancient AMIGA A1200. By default this does NOT have the 'bc' command line calculator. Although I did a DEMO code to create a C source and compile it under python 1.4.0 and ADE using ksh88 and the gcc of the day, I decided to create this baby that requires no Python... (2 Replies)
Discussion started by: wisecracker
2 Replies
Bio::Tools::pICalculator(3pm)				User Contributed Perl Documentation			     Bio::Tools::pICalculator(3pm)

NAME
Bio::Tools::pICalculator - calculate the isoelectric point of a protein DESCRIPTION
Calculates the isoelectric point of a protein, the pH at which there is no overall charge on the protein. Calculates the charge on a protein at a given pH. Can use built-in sets of pK values or custom pK sets. SYNOPSIS
use Bio::Tools::pICalculator; use Bio::SeqIO; my $in = Bio::SeqIO->new( -fh => *STDIN , -format => 'Fasta' ); my $calc = Bio::Tools::pICalculator->new(-places => 2, -pKset => 'EMBOSS'); while ( my $seq = $in->next_seq ) { $calc->seq($seq); my $iep = $calc->iep; print sprintf( "%s %s %.2f ", $seq->id, $iep, $calc->charge_at_pH($iep) ); for( my $i = 0; $i <= 14; $i += 0.5 ){ print sprintf( "pH = %.2f Charge = %.2f ", $i, $calc->charge_at_pH($i) ); } } SEE ALSO
http://fields.scripps.edu/DTASelect/20010710-pI-Algorithm.pdf http://emboss.sourceforge.net/apps/cvs/emboss/apps/iep.html http://us.expasy.org/tools/pi_tool.html LIMITATIONS
There are various sources for the pK values of the amino acids. The set of pK values chosen will affect the pI reported. The charge state of each residue is assumed to be independent of the others. Protein modifications (such as a phosphate group) that have a charge are ignored. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Bugs Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR
Mark Southern (mark_southern@merck.com). From an algorithm by David Tabb found at http://fields.scripps.edu/DTASelect/20010710-pI-Algorithm.pdf. Modification for Bioperl, additional documentation by Brian Osborne. COPYRIGHT
Copyright (c) 2002, Merck & Co. Inc. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the terms of the Perl Artistic License (see http://www.perl.com/perl/misc/Artistic.html) APPENDIX
The rest of the documentation details each of the object methods. Private methods are usually preceded by a _. desc Title : new Usage : Bio::Tools::pICalculator->new Function: Instantiates the Bio::Tools::pICalculator object Example : $calc = Bio::Tools::pICalculator->new( -pKset => \%pKvalues, # a Bio::Seq object -seq => $seq, -places => 2 ); or: $calc = Bio::Tools::pICalculator->new( -pKset => 'string', # a Bio::Seq object -seq => $seq, -places => 1 ); Constructs a new pICalculator. Arguments are a flattened hash. Valid, optional keys are: pKset - A reference to a hash with key value pairs for the pK values of the charged amino acids. Required keys are: N_term C_term K R H D E C Y pKset - A string ( 'DTASelect' or 'EMBOSS' ) that will specify an internal set of pK values to be used. The default is 'EMBOSS' seq - A Bio::Seq sequence object to analyze places - The number of decimal places to use in the isoelectric point calculation. The default is 2. Returns : The description Args : The description or none seq Title : seq Usage : $calc->seq($seqobj) Function: Sets or returns the Bio::Seq used in the calculation Example : $seqobj = Bio::Seq->new(-seq=>"gghhhmmm",-id=>"GHM"); $calc = Bio::Tools::pICalculator->new; $calc->seq($seqobj); Returns : Bio::Seq object Args : Bio::Seq object or none pKset Title : pKset Usage : $pkSet = $calc->pKSet(\%pKSet) Function: Sets or returns the hash of pK values used in the calculation Example : $calc->pKset('emboss') Returns : reference to pKset hash Args : The reference to a pKset hash, a string, or none. Examples: pKset - A reference to a hash with key value pairs for the pK values of the charged amino acids. Required keys are: N_term C_term K R H D E C Y pKset - A valid string ( 'DTASelect' or 'EMBOSS' ) that will specify an internal set of pK values to be used. The default is 'EMBOSS' iep Title : iep Usage : $calc->iep Function: Returns the isoelectric point Example : $calc = Bio::Tools::pICalculator->new(-places => 2); $calc->seq($seqobj); $iep = $calc->iep; Returns : The isoelectric point of the sequence in the Bio::Seq object Args : None charge_at_pH Title : charge_at_pH Usage : $charge = $calc->charge_at_pH($pH) Function: Sets or gets the description of the sequence Example : $calc = Bio::Tools::pICalculator->new(-places => 2); $calc->seq($seqobj); $charge = $calc->charge_at_ph("7"); Returns : The predicted charge at the given pH Args : pH perl v5.14.2 2012-03-02 Bio::Tools::pICalculator(3pm)
All times are GMT -4. The time now is 07:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy