Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Negative Numbers for input parameters. Post 302335842 by Gussifinknottle on Monday 20th of July 2009 03:39:22 PM
Old 07-20-2009
Hi BubbaJoe,

Actually the flag is for a command that is in a shell script. It just tells me that the flag value is unrecognized and the command gets aborted.

The command is supposed to take both -ve and +ve values and works fine when the latter is supplied.

Thanks,
Gussi
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Input parameters

I have a script which take 3 input parameters 1st - a date (i.e. current date) 2nd - type (i.e. A) 3rd - limit (i.e. 40) normally the date parameter would be current date, so I thought I could do this calculate.sh $(date +%Y-%m-%d) A 40 however, it seems like it can't be done,... (3 Replies)
Discussion started by: mpang_
3 Replies

2. UNIX for Dummies Questions & Answers

Negative Numbers and If Statements

Hi, Can anyone explain what is going on here: michael-browns-powerbook-g4-15:~ msb65$ start=-1 michael-browns-powerbook-g4-15:~ msb65$ stop=1 michael-browns-powerbook-g4-15:~ msb65$ if ; then echo hello; fi -bash: ; then echo hello; fi hello Are you not allowed to compare negative... (6 Replies)
Discussion started by: msb65
6 Replies

3. Shell Programming and Scripting

Perl output with negative and positive numbers

Hello, For my weather station I have made a little perl script to put the data into cacti. The next problem I have. I can only get positive numbers or negative numbers. What do I do: Though a shell scrip I call the perl script. Shell script: #!/bin/sh cat data.txt | stats.pl Perl... (4 Replies)
Discussion started by: rbl-blacklight
4 Replies

4. Shell Programming and Scripting

addition of both positive and negative numbers

Let, I have three numbers +00123.25 -00256.54 +00489.23 I need to sum up all those three numbers, after storing them in three variables (say var1, var2, var3). I used both expr and BC, but they didn't work for me. But, I am not able to sum up them, as I don't have any idea how to... (13 Replies)
Discussion started by: mady135
13 Replies

5. Shell Programming and Scripting

Comparing Negative Numbers with If/Else

ValA=-29344 if ; then echo "NEGATIVE" else echo "POSITIVE" fi Can someone please tell me how else they would go about doing the above? When i do it, i get errors such as: (10 Replies)
Discussion started by: SkySmart
10 Replies

6. Shell Programming and Scripting

Splitting a file based on positive and negative numbers

Dear All, I have to split a tab delimited file in two files based on the presence of a positive or negative in column number 9 , for example file: A 1 5 erg + 6766 0.9889 0.9817 9.01882 erg inside upstream B 1 8 erg2 + 6766 0.9889 0.9817 -9.22 erg2 inside... (3 Replies)
Discussion started by: paolo.kunder
3 Replies

7. UNIX for Dummies Questions & Answers

Sed/awk to find negative numbers and replace with 1?

Greetings. I have a three column file, and there are some numbers in the second column that are <1. However I need all numbers to be positive, thus need to replace all those numbers with just one. I feel like there must be a simple way to use awk to find these numbers and sed to replace but can't... (5 Replies)
Discussion started by: Twinklefingers
5 Replies

8. AIX

Input parameters

friends and I can validate whether to run the shell has input parameters m event date, I occasionally happen something like this does not work if $ 1 is null then echo has entered input parameters else echo "parameter ok" fi (2 Replies)
Discussion started by: tricampeon81
2 Replies

9. UNIX for Dummies Questions & Answers

Sorting numerically considering both negative and positve numbers

Dear Experts, I have an IP file which looks like below ---- 100 200 5.02 100 200 -2.99 100 200 -3.01 200 300 2.05 200 300 3.01 200 300 -5.06 I want an OP which looks like (decreasing numerically)-- 100 200 5.02 100 200 -2.99 100 200 -3.01 200 300 3.01 200 300 2.05 200 300 -5.06 (2 Replies)
Discussion started by: Indra2011
2 Replies

10. UNIX for Beginners Questions & Answers

Splitting a file based on negative and positive numbers

I have a file that is pipe delimited and in Column F they have number values, both positive and negative. I need to take the one file I am starting with and split it into two separate files based on negative and positive numbers. What is the command to do so? And then I need to also transfer... (4 Replies)
Discussion started by: cckaiser15
4 Replies
Minuit(3pm)						User Contributed Perl Documentation					       Minuit(3pm)

NAME
PDL::Minuit -- a PDL interface to the Minuit library DESCRIPTION
This package implements an interface to the Minuit minimization routines (part of the CERN Library) SYNOPSIS
A basic fit with Minuit will call three functions in this package. First, a basic initialization is done with mn_init(). Then, the parameters are defined via the function mn_def_pars(), which allows to set upper and lower bounds. Then the function mn_excm() can be used to issue many Minuit commands, including simplex and migrad minimization algorithms (see Minuit manual for more details). See the test file minuit.t in the test (t/) directory for a basic example. FUNCTIONS
mn_init() The function mn_init() does the basic initialization of the fit. The first argument has to be a reference to the function to be minimized. The function to be minimized has to receive five arguments ($npar,$grad,$fval,$xval,$iflag). The first is the number of parameters currently variable. The second is the gradient of the function (which is not necessarily used, see the Minuit documentation). The third is the current value of the function. The fourth is a piddle with the values of the parameters. The fifth is an integer flag, which indicates what the function is supposed to calculate. The function has to return the values ($fval,$grad), the function value and the function gradient. There are three optional arguments to mn_init(). By default, the output of Minuit will come through STDOUT unless a filename $logfile is given in the Log option. Note that this will mercilessly erase $logfile if it already exists. Aditionally, a title can be given to the fit by the Title option, the default is 'Minuit Fit'. If the output is written to a logfile, this is assigned Fortran unit number 88. If for whatever reason you want to have control over the unit number that Fortran associates to the logfile, you can pass the number through the Unit option. Usage: mn_init($function_ref,{Log=>$logfile,Title=>$title,Unit=>$unit}) Example: mn_init(&my_function); #same as above but outputting to a file 'log.out'. #title for fit is 'My fit' mn_init(&my_function, {Log => 'log.out', Title => 'My fit'}); sub my_function{ # the five variables input to the function to be minimized # xval is a piddle containing the current values of the parameters my ($npar,$grad,$fval,$xval,$iflag) = @_; # Here is code computing the value of the function # and potentially also its gradient # ...... # return the two variables. If no gradient is being computed # just return the $grad that came as input return ($fval, $grad); } mn_def_pars() The function mn_def_pars() defines the initial values of the parameters of the function to be minimized and the value of the initial steps around these values that the minimizer will use for the first variations of the parameters in the search for the minimum. There are several optional arguments. One allows to assign names to these parameters which otherwise get names (Par_0, Par_1,....,Par_n) by default. Another two arguments can give lower and upper bounds for the parameters via two piddles. If the lower and upper bound for a given parameter are both equal to 0 then the parameter is unbound. By default these lower and upper bound piddles are set to zeroes(n), where n is the number of parameters, i.e. the parameters are unbound by default. The function needs two input variables: a piddle giving the initial values of the parameters and another piddle giving the initial steps. An optional reference to a perl array with the variable names can be passed, as well as piddles with upper and lower bounds for the parameters (see example below). It returns an integer variable which is 0 upon success. Usage: $iflag = mn_def_pars($pars, $steps,{Names => @names, Lower_bounds => $lbounds, Upper_bounds => $ubounds}) Example: #initial parameter values my $pars = pdl(2.5,3.0); #steps my $steps = pdl(0.3,0.5); #parameter names my @names = ('intercept','slope'); #use mn_def_pars with default parameter names (Par_0,Par_1,...) my $iflag = mn_def_pars($pars,$steps); #use of mn_def_pars explictly specify parameter names $iflag = mn_def_pars($pars,$steps,{Names => @names}); # specify lower and upper bounds for the parameters. # The example below leaves parameter 1 (intercept) unconstrained # and constrains parameter 2 (slope) to be betwen 0 and 100 my $lbounds = pdl(0, 0); my $ubounds = pdl(0, 100); $iflag = mn_def_pars($pars,$steps,{Names => @names, Lower_bounds => $lbounds, Upper_bounds => $ubounds}}); #same as above because $lbounds is by default zeroes(n) $iflag = mn_def_pars($pars,$steps,{Names => @names, Upper_bounds => $ubounds}}); mn_excm() The function mn_excm() executes a Minuit command passed as a string. The first argument is the command string and an optional second argument is a piddle with arguments to the command. The available commands are listed in Chapter 4 of the Minuit manual (see url below). It returns an integer variable which is 0 upon success. Usage: $iflag = mn_excm($command_string, {$arglis}) Example: #start a simplex minimization my $iflag = mn_excm('simplex'); #same as above but specify the maximum allowed numbers of #function calls in the minimization my $arglist = pdl(1000); $iflag = mn_excm('simplex',$arglist); #start a migrad minimization $iflag = mn_excm('migrad') #set Minuit strategy in order to get the most reliable results $arglist = pdl(2) $iflag = mn_excm('set strategy',$arglist); # each command can be specified by a minimal string that uniquely # identifies it (see Chapter 4 of Minuit manual). The comannd above # is equivalent to: $iflag = mn_excm('set stra',$arglis); mn_pout() The function mn_pout() gets the current value of a parameter. It takes as input the parameter number and returns an array with the parameter value, the current estimate of its uncertainty (0 if parameter is constant), lower bound on the parameter, if any (otherwise 0), upper bound on the parameter, if any (otherwise 0), integer flag (which is equal to the parameter number if variable, zero if the parameter is constant and negative if parameter is not defined) and the parameter name. Usage: ($val,$err,$bnd1,$bnd2,$ivarbl,$par_name) = mn_pout($par_number); mn_stat() The function mn_stat() gets the current status of the minimization. It returns an array with the best function value found so far, the estimated vertical distance remaining to minimum, the value of UP defining parameter uncertainties (default is 1), the number of currently variable parameters, the highest parameter defined and an integer flag indicating how good the covariance matrix is (0=not calculated at all; 1=diagonal approximation, not accurate; 2=full matrix, but forced positive definite; 3=full accurate matrix) Usage: ($fmin,$fedm,$errdef,$npari,$nparx,$istat) = mn_stat(); mn_emat() The function mn_emat returns the covariance matrix as a piddle. Usage: $emat = mn_emat(); mn_err() The function mn_err() returns the current existing values for the error in the fitted parameters. It returns an array with the positive error, the negative error, the "parabolic" parameter error from the error matrix and the global correlation coefficient, which is a number between 0 and 1 which gives the correlation between the requested parameter and that linear combination of all other parameters which is most strongly correlated with it. Unless the command 'MINOS' has been issued via the function mn_excm(), the first three values will be equal. Usage: ($eplus,$eminus,$eparab,$globcc) = mn_err($par_number); mn_contour() The function mn_contour() finds contours of the function being minimized with respect to two chosen parameters. The contour level is given by F_min + UP, where F_min is the minimum of the function and UP is the ERRordef specfied by the user, or 1.0 by default (see Minuit manual). The contour calculated by this function is dynamic, in the sense that it represents the minimum of the funcion being minimized with respect to all the other NPAR-2 parameters (if any). The function takes as input the parameter numbers with respect to which the contour is to be determined (two) and the number of points $npt required on the contour (>4). It returns an array with piddles $xpt,$ypt containing the coordinates of the contour and a variable $nfound indicating the number of points actually found in the contour. If all goes well $nfound will be equal to $npt, but it can be negative if the input arguments are not valid, zero if less than four points have been found or <$npt if the program could not find $npt points. Usage: ($xpt,$ypt,$nfound) = mn_contour($par_number_1,$par_number_2,$npt) SEE ALSO
PDL The Minuit documentation is online at http://wwwasdoc.web.cern.ch/wwwasdoc/minuit/minmain.html AUTHOR
This file copyright (C) 2007 Andres Jordan <ajordan@eso.org>. All rights reserved. There is no warranty. You are allowed to redistribute this software/documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file. FUNCTIONS
mninit Signature: (int a();int b(); int c()) info not available mninit does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. mn_abre Signature: (int l(); char* nombre; char* mode) info not available mn_abre does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. mn_cierra Signature: (int l()) info not available mn_cierra does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. mnparm Signature: (int a(); double b(); double c(); double d(); double e(); int [o] ia(); char* str) info not available mnparm does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. mnexcm Signature: (double a(n); int ia(); int [o] ib(); char* str; SV* funcion; int numelem) info not available mnexcm does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. mnpout Signature: (int ia(); double [o] a(); double [o] b(); double [o] c(); double [o] d();int [o] ib(); SV* str) info not available mnpout does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. mnstat Signature: (double [o] a(); double [o] b(); double [o] c(); int [o] ia(); int [o] ib(); int [o] ic()) info not available mnstat does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. mnemat Signature: (double [o] mat(n,n)) info not available mnemat does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. mnerrs Signature: (int ia(); double [o] a(); double [o] b(); double [o] c(); double [o] d()) info not available mnerrs does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. mncont Signature: (int ia(); int ib(); int ic(); double [o] a(n); double [o] b(n); int [o] id(); SV* funcion; int numelem) info not available mncont does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. perl v5.14.2 2012-05-30 Minuit(3pm)
All times are GMT -4. The time now is 05:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy