#!/usr/bin/perl
use warnings;
use strict;
#3_3.pl
#loop over drop radius from 1 micron to 100 microns in steps of 2 micr
+ons
#use each radius to compute cross section
#if radius <20 microns, use (pi)*(r^2)*a*(1-exp(-c*r))
#if radius >= 20 microns, use 2*pi*(r^2)
my @radii = grep $_ & 1, 1 .. 100;
my $pi = atan2 0, -1;
my $twopi = 2 * $pi;
my $a0 = 1.18;
my $c0 = 0.28e6;
my ( @rads, @sigs );
foreach my $r ( @radii )
{
push @rads, 1e-6 * $r;
# push @sigs, $r > 20 ? $twopi * $rad ** 2 : $pi * $rad ** 2 * $a0 *
+ ( 1 - exp -$c0 * $rad );
# **Update: Oops, changed $rad to $rads[-1]
push @sigs, $r > 20 ? $twopi * $rads[-1] ** 2 : $pi * $rads[-1] **
+ 2 * $a0 * ( 1 - exp -$c0 * $rads[-1] );
}
print "@rads\n";
print "@sigs\n";
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.