Changeset 1dd938 in git
 Timestamp:
 Apr 17, 2015, 10:51:08 AM (8 years ago)
 Branches:
 (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
 Children:
 7cb9b47e0c889244f467795deb33c7c8156369b4
 Parents:
 7203f75e9a4e317e9e009db8a853ed8c0e6be635
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/LIB/standard.lib
r7203f7 r1dd938 17 17 par2varRing([i]) create a ring making pars to vars, together with i 18 18 datetime() return date and time as a string 19 max(i ,j) maximum of i and j20 min(i ,j) minimum of i and j19 max(i_1,...,i_k) maximum of i_1, ..., i_k 20 min(i_1,...,i_k) minimum of i_1, ..., i_k 21 21 22 22 "; … … 2185 2185 2186 2186 /////////////////////////////////////////////////////////////////////////////// 2187 proc max(def i, def j)2188 "SYNTAX: max (i , j)2189 TYPE: same as type of i resp. j2190 PURPOSE: returns the maximum for any 2arguments of a type2187 proc max(def i,list #) 2188 "SYNTAX: max (i_1, ..., i_k) 2189 TYPE: same as type of i_1, ..., i_k resp. 2190 PURPOSE: returns the maximum for any arguments of a type 2191 2191 for which '>' is defined 2192 2192 SEE ALSO: min 2193 2193 EXAMPLE: example max; shows an example" 2194 2194 { 2195 if(i>j){return(i);} 2196 return(j); 2195 def maximum = i; 2196 for (int j=1; j<=size(#); j++) 2197 { 2198 if(#[j]>maximum) 2199 { 2200 maximum = #[j]; 2201 } 2202 } 2203 return(maximum); 2197 2204 } 2198 2205 example … … 2202 2209 } 2203 2210 /////////////////////////////////////////////////////////////////////////////// 2204 proc min(def i, def j)2205 "SYNTAX: min (i , j)2206 TYPE: same as type of i resp. j2207 PURPOSE: returns the minimum for any 2arguments of a type2211 proc min(def i,list #) 2212 "SYNTAX: min (i_1, ..., i_k) 2213 TYPE: same as type of i_1, ..., i_k resp. 2214 PURPOSE: returns the minimum for any arguments of a type 2208 2215 for which '>' is defined 2209 2216 SEE ALSO: max 2210 2217 EXAMPLE: example min; shows an example" 2211 2218 { 2212 if(i>j){return(j);} 2213 return(i); 2219 def minimum = i; 2220 for (int j=1; j<=size(#); j++) 2221 { 2222 if(#[j]<minimum) 2223 { 2224 minimum = #[j]; 2225 } 2226 } 2227 return(minimum); 2214 2228 } 2215 2229 example
Note: See TracChangeset
for help on using the changeset viewer.