http://wattsupwiththat.com/2015/09/30/rico20-4-million-nsf-grant-while-shuklas-organization-is-being-dissolved/ ps. I visited the center recently, to lecture on scientific writing. I was not a part of the center, but could have been (because I was asked to join by my first boss). pps. It's not a good idea to hire your daughters to run a company, even if it's a not-for-profit one.
Sunday evening saw the last session of competition at Luzhniki Stadium in Moscow, wrapping up the 2013 IAAF World Championships. Usain Bolt capped the competition with another scorching performance, running away from the 4x100m Relay field to give Jamaica gold for the third consecutive championships and secure a relay double for Jamaica, who also won the women’s race. Titles were also decided in the women’s 800m, men’s 1500m, and on the field, the men’s Triple Jump and the women’s Javelin Throw. Bolt blasts anchor leg The shorter relay was a wild affair with several teams in contention up to the last exchange. There, at the top of the homestretch, Bolt got the baton from Nickel Ashmeade more or less equal with the USA quartet. Bolt then simply left Justin Gatlin in his wake, opening a gap immediately and bringing the Jamaican squad home in 37.36 to the USA’s 37.66. Crossing the line third was the team from Great Britain, then Canada in 37.92. However, Great Britain were disqualified for passing the baton outside the second exchange zone, and Canada wound up in bronze position. Jamaican relay double Bolt’s successful anchor leg, while impressive, was equalled in its dominance by the performance of the women’s team. The quartet of Carrie Russell, Kerron Stewart, Schillonie Calvert, and double sprint champion Shelly-Ann Fraser-Pryce set a championship and national record of 41.29 by handing Fraser-Pryce the baton with a sizeable lead and pointing the “Pocket Rocket” at the finish line. Behind them was some confusion. France crossed the line next and was in silver medal position as of the medal ceremony, where they were given the medals for their 42.73 finish. The USA, which struggled through the second exchange but recovered quickly to finish in 42.75, were given bronze. However, a late protest reopened the results, and France was disqualified under rule 170.7, which pertains to exchanging the baton within the exchange zone. As a result, the USA team was elevated to silver, and bronze went to Great Britain, who had finished in 42.87. Sum victory in 800m Defending champion Marya Savinova was, understandably, the crowd favourite in the women’s 800m final, and as she moved to pass early leader Alysia Johnson Montano, they roared their approval. Savinova, however, had just started on her frantic, and ultimately unsuccessful, sprint to catch Eunice Sum. The Kenyan had moved earliest to catch the fast-starting Montano, and as a result built a lead over Savinova that the Russian was unable to close. Sum won gold in 1:57.38, with Savinova in silver (1:57.80) and a hard-charging Brenda Martinez of the USA in bronze (1:57.91). Johnson Montano tumbled to the track fourth in 1:57.95. Kiprop unbeatable Asbel Kiprop dominated the men’s 1500m final in much the same way that Mo Farah dominated the longer races, controlling the pace throughout and setting up his own victory. The defending champion (and 2008 Olympic champion), still only 24, dictated a slow pace at first, held the pack back from pursuing team-mate Nixon Chepseba, and finally launched an unbeatable drive to the finish which brought him to the line in 3:36.28. Behind him, Daegu bronze medallist Matt Centrowitz improved to silver with a 3:36.78; the surprise of the race was Johan Cronje of South Africa in third with 3:36.83. Tamgho transcendent The men’s Triple Jump was, improbably, tied going in to the last round, with both Teddy Tamgho and Cuba’s Pedro Pechardo at 17.68m. The tie would have been decided in Tamgho’s favour due to his better second jump (17.65m) but after a series of fouls which saw him very far out in the pit, he sprung out to 18.04m in the sixth and last round. It would be the only effort over 18 metres of the competition. Pechardo, forced to respond with only his last remaining attempt, was unable, and the Frenchman took the title. Behind Tamgho and Pechardo came USA’s Will Claye with a 17.52m mark. Defending World champion and Olympic champion Christian Taylor came fourth, only able to manage 17.20m. Obergfoll over all Maria Abakumova was the competitive favourite and the crowd favourite for the women’s Javelin Throw, but in the end she was one of the few Russians to under-perform expectations, managing only 65.09m, well off her best this year and exactly four metres shy of her qualifying throw. Christina Obergfoll, on the other hand, was masterful, reaching 69.05m in the fifth round, good enough to win by more than two meters. The surprise of the night was Australia’s Kimberly Mickle, who capitalized on Abakumova’s lack of form with a 66.60m PB, good enough to earn her silver. Like her husband Dmitri Tarabin, Abakumova had to settle for bronze. Parker Morse for the IAAF 原文见 http://www.iaaf.org/competitions/iaaf-world-championships/news/jamaican-relay-double-day-9-wrap-moscow-201
import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import java.util.Vector; public class ListOfNumbersDeclared { public static void main(String[] a) { Vector victor; int size = 10; victor = new Vector(size); for ( int i = 0; i size; i++) victor.addElement( new Integer(i)); try { PrintStream out = new PrintStream( new FileOutputStream( OutFile.txt)); for ( int i = 0; i size; i++) out.println(Value at: + i + = + victor.elementAt(i)); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } }
http://wonderwall.msn.com/movies/angelina-jolie-reveals-double-mastectomy-in-ny-times-op-ed-piece-24886.gallery Angelina Jolie reveals she recently underwent a double mastectomy Photo: KH1/WENN 1 of 25 In a jaw-dropping and moving op-ed in the New York Times , Angelina Jolie has revealed she recently underwent a double mastectomy after testing positive for the gene that predisposes her to breast and ovarian cancer. My mother fought cancer for almost a decade and died at 56, writes the 37-year-old Oscar winner and U.N. goodwill ambassador. She held out long enough to meet the first of her grandchildren and to hold them in her arms. ... We often speak of 'Mommy's mommy,' and I find myself trying to explain the illness that took her away from us. They have asked if the same could happen to me. I have always told them not to worry, but the truth is I carry a 'faulty' gene, BRCA1, which sharply increases my risk of developing breast cancer and ovarian cancer. She acknowledges that the odds were not in her favor: My doctors estimated that I had an 87 percent risk of breast cancer and a 50 percent risk of ovarian cancer, although the risk is different in the case of each woman. According to Jolie, Once I knew that this was my reality, I decided to be proactive and to minimize the risk as much I could. I made a decision to have a preventive double mastectomy. I started with the breasts, as my risk of breast cancer is higher than my risk of ovarian cancer, and the surgery is more complex. On April 27, she completed three months of medical procedures that the mastectomies involved. During that time I have been able to keep this private and to carry on with my work. But she's writing about it now because I hope that other women can benefit from my experience, she explains. Cancer is still a word that strikes fear into people's hearts, producing a deep sense of powerlessness. But today it is possible to find out through a blood test whether you are highly susceptible to breast and ovarian cancer, and then take action. Jolie goes on to describe her surgeries, her reasons for going public and the loving support she's received from Brad Pitt . Read on for more of her gut-wrenching decision
int转string:int2str(m) double转string:num2str(m) 在matlanb中help uint8,就可以看到matlab中常用的数据类型,如double, single, datatypes, isinteger, uint16, uint32, uint64, int8, int16, int32, int64,等,至于每种数据类型在计算机中占几个字节,精度高的向精度低的转换会丢失哪些信息则没有仔细研究。如果部考虑信息损失问题,类型转换就比较 简单了。假如现在有一double型的变量i要转换成uint8型,则只需i=uint8(i)就行了。datatypes没去研究过,应当跟一般的数值 类型有所区别,其它的数值类型就以此类推,v=datatype(v)。 读取图像:用imread函数读取图像文件,文件格式可以是TIFF、JPEG、GIF、BMP、PNG等。比如 f = imread('chestxray.jpg'); 读进来的图像数据被保存在变量f中。尾部的分号用来抑制输出。如果图片是彩色的,可以用rgb2gray转换成灰度图: f = rgb2gray(f); 然后可以用size函数看图像的大小 size(f) 如果f是灰度图像,则可以用下面的命令把这个图像的大小赋给变量M和N = size(f); 用whos命令查看变量的属性 whos f 显示图像:用imshow显示图像 imshow(f, G) 其中f是图像矩阵,G是像素的灰度级,G可以省略。比如 imshow(f, ) 图像上所有小于等于100的数值都会显示成黑色,所有大于等于200的数值都会显示成白色。pixval命令可以用来查看图像上光标所指位置的像素值。 pixval 例如 f = imread('rose_512.tif'); whos f imshow(f) 如果要同时显示两幅图像,可以用figure命令,比如 figure, imshow(g) 用逗号可以分割一行中的多个命令。imshow的第二个参数用一个空的中括号: imshow(h, D = uint8(C) 图像类型分为: Intensity image 灰度图 Binary image 二值图 Indexed image 索引图 RGB image 彩色图 在灰度图中每个像素可以是整型、浮点型或者逻辑型。图像类型的像素类型可以转换 function to from im2uint8 uint8 logical,uint8,uint16,double im2uint16 uint16 logical,uint8,uint16,double mat2gray double double im2double double logical,uint8,uint16,double im2bw logical uint8,uint16,double 比如 g = mat2gray(A, ); g = mat2gray(A); g = im2double(h); g = im2bw(f, T) 其中A是浮点型的图像,Amin和Amax是浮点数的范围,h和f是任意类型的图像,T是分割的阈值。 数组(向量)索引:创建向量(数组): v = 用小括号对向量进行索引(取数组中的某个元素): v(2) 转置(将行向量通过转置变成列向量): w = v.' 取向量其中的一部分: v(1:3) 第1个到第3个 v(2:4) v(3:end) 第3个到最后一个 v(1:end) v(:) 全部 v(1:2:end) 第1个到最后一个,每次增加2 v(end:-2:1) 最后一个到第1个,每次减2 其中end总是表示最后一个。 x = linspace(1, 5, 10) v( ) linspace函数产生一个范围内的平均分布。 矩阵索引:创建矩阵 A = 取矩阵中的一个元素 A(2, 3) 取矩阵中的一行或者一列 C3 = A(:, 3) R2 = A(2, :) 取矩阵中某些行某些列 T2 = A(1:2, 1:3) 对矩阵中某些元素进行赋值: B = A; B(:, 3) = 0 用end表示最后一行或者最后一列: A(end, end) 最后一行最后一列 A(end, end-2) 最后一行倒数第三列 A(2:end, end:-2:1) 第2行到最后一行,最后一列到第一列,每次减2 E = A( , ) 第1、3行,第2、3列 D = logical( ) A(D) 取A中由D指定的位置上的元素 v = T2(:) 把矩阵变成一个向量 s = sum(A(:)) 求和 sum(sum(A)) 可以把矩阵操作用在图像上 f = imread('filename'); fp = 矩阵列倒转 imshow(fp) fc = imshow(fc) fs = imshow(fs) plot(f(512,:)) 矩阵可以是多维的,用size看矩阵大小,用ndims命令常看矩阵的维数 size(A, 1) ndims(A) 一些常用的矩阵 zeroes(M, N) ones(M, N) true(M, N) false(M, N) magic(M) rand(M, N) randn(M, N) 其中M、N表示矩阵的行数和列数。比如 A = 5 * ones(3, 3) magic(3) B = rand(2, 4) 函数:可以把一系列的MATLAB语句或者一个带参数的函数放在扩展名叫做m的文件中。一个带函数的m文件有一下部分组成 函数定义行 H1行 帮助部分 函数体 注释 函数定义行的格式是 function = name(inputs) 比如要写一个函数计算两个图像的和以及乘积 function = sumprod(f, g) 其中f和g是输入的图像,而s是和,p是乘积。返回值用中括号括起来,如果返回值只有一个,可以省略中括号。如果函数没有输出,则中括号和等号都可以省略。函数名字的命名规则和C语言是相同的。定义好的函数可以在命令行调用: = sumprod(f, g); 也可以被其它函数调用。如果只有一个返回值,调用时中括号也是可以省略的,比如 y = sum(x); H1行是文本的第一行,是一个单行的注释,紧跟在函数定义行后面,之间不能有空行。比如 % SUMPROD Computes the sum and product of two images. 百分号开始的文字表示注释。当使用帮助命令 help function_name 时,这个H1行会被首先显示出来。如果使用lookfor命令,则会在所有H1行中查找指定的关键字。这一行应该提供这个函数功能的一个概述。帮助部分是紧跟在H1后的文本块,中间没有空行,用来提供对这个函数更详细的帮助说明。在使用help命令时会显示所有这部分内容。这部分内容由注释语句构成,全部由%开始。接下来第一个非注释语句表示函数体的开始。函数体包含进行计算的语句和给返回值赋值的语句。函数题中的所有注释(百分号开始的行)被认为是普通的注释,不是H1或者帮助部分。m文件可以用任何文本编辑器创建和编辑,只要用.m扩展名保存在MATLAB可以搜索到的路径里面。另一个创建和编辑函数的方法是在命令行输入edit命令,比如 edit sumprod 这命令会编辑已经存在的sumprod.m文件,如果没有则自动在当前目录中创建一个sumprod.m并开始编辑。 运算符。运算符可以分为算术运算符,关系运算符和逻辑运算符。算术运算符分为矩阵算术运算符和数组算术运算符。 + 矩阵和数组加法 plus(A, B) a+b, A+B - 矩阵和数组减法 minus(A,B) a-b, A-B .* 数组乘法 times(A,B) C=A.*B, 意味着C(I,J) = A(I,J)*B(I,J) * 矩阵乘法 mtimes(A,B) A*B, 表示线性代数中的矩阵运算,或者a*A ./ 数组右除 rdivide(A,B) C=A./B, 意味着C(I,J)=A(I,J)/B(I,J) .\ 数组左除 ldivide(A,B) C=A.\B, 意味着C(I,J)=B(I,J)/A(I,J) / 矩阵右除 mrdivide(A,B) A/B 意味着A*inv(B), inv是矩阵求逆 \ 矩阵左除 mldivide(A,B) A\B 意味着inv(A)*B .^ 数组指数 power(A, B) C=A.^B,意味着C(I,J)=A(I,J)^B(I,J) ^ 矩阵指数 mpower(A,B) 请查看帮助 .' 向量和矩阵转置 transpose(A) A.' ' 复数的共轭 ctranspose(A) A' + 单目加号 uplus(A) +A 与0+A相同 - 单目负号 uminus(A) -A 与0-A相同 图像处理工具包还提供其他一些算术运算 imadd 两个图像相加,或者一个图像加上一个常量 imsubstract 两个图像相减,或者一个图像减掉一个常量 immultiply 两个图像相乘,或者一个图像乘上一个常量 imdivide 两个图像相除,或者一个图像除以一个常量 imabsdiff 两个图像的差的绝对值 imcomplement 求一个图像的反色图 inlincomb 求一组图像的线性组合 关系运算符包括 = = == ~= 关系运算符的结果是逻辑型的矩阵,比如 A = B = A == B A = B 如果关系运算符两边都是矩阵,则要求两边的矩阵是同样大小的。或者一边是矩阵一边是常数,或者两边都是常数,那也是可以。 A 3 3 ~= 4 逻辑运算符包括与、或、非三个运算 AND | OR ~ NOT 在matlab中非0被认为是真,0被认为是假。比如 A = B = A B MATLAB还有其它一些逻辑运算函数: xor 异或 all 如果一整列都是真,则结果是真 any 如果一整列只要有一个是真,则结果是真 比如 xor(A, B) all(A) any(A) all(B) any(B) 一些重要的常量 ans eps i(或者j) NaN或者nan pi realmax realmin computer version MATLAB中一般常量的写法 3 -99 0.00001 9.6397238 1.60210e-20 6.02252e23 1i -3.14159j 3e5j 控制流。包括 if if和else, elseif组合,条件执行一组语句 for 指定次数重复执行一组语句 while 按条件反复执行一组语句 break 终止for或者while循环 continue 马上开始下一次for或者while循环 switch switch和case,otherwise结合,按照条件值的不同执行不同的语句块 return 终止当前函数,返回到调用它的地方 try...catch 捕获异常状况 if语句 if expression_r1 statements1 elseif expression_r2 statements2 else statements3 end for循环 for index = start:increment:end statements end 比如 count = 0; for k = 0:0.1:1 count = count +1 end while循环 while expression_r statements end 比如 a = 10; b = 5; while a a = a - 1; while b b = b - 1; end end switch语句 switch switch_expression_r case case_expression_r statements case {case_expression_r1, case_expression_r2} statements otherwise statements end 比如 switch newclass case 'uint8' g = im2uint8(f); case 'uint16' g = im2uint16(f); case 'double' g = im2double(f); otherwise error('Unknown or improper image class.') end 例子:写一个函数计算一幅灰度图像所有像素的平均值 function av = average(A) %AVERAGE Computes the average value of an array % AV = AVERAGE(A) computes the average value of input array, A, % which must be a 1D or 2D array. % Check the validity of input. if ndims(A) 2 error('The dimensions of the input cannot exceed 2.') end % Computes the average av = 例子:比较各种不同的JPEG质量下的图像质量 for q = 0:5:100 filename = sprintf('series_%3d.jpg', q); imwrite(f, filename, 'quality', q); end 其中sprintf语句和c语言的fprintf语句用法类似。例子:写一个函数从一个图像中取出一个矩形的子图。 function s = subdim(f, m, n, rx, cy) %SUBDIM Extracts a subimage, s, from a given image, f. % The subimage is of size m-by-n, and the coordinates of its top, left % corner are (rx, cy). s = zeros(m, n); rowhigh = rx + m - 1; colhigh = cy + n - 1; xcount = 0; for r = rx:rowhigh xcount = xcount + 1; ycount = 0; for c = cy:colhigh ycount = ycount + 1; s(xcount, ycount) = f(r, c); end end 实际上这个功能可以用一个matlab语句就可以实现了。 循环优化。一些循环可以被转换成同样向量计算来代替,比如f(x)=Asin(x/2pi),生成一个向量包含一组函数的值: for x = 1:M f(x) = A*sin((x-1)/(2*pi)); end 可以用下面两个语句来代替 x = f = A*sin(x/2(*pi)) 向量运算要比循环快得多。对于二维的情况,MATLAB提供了一个meshgrid函数 = meshgrid(c, r) 比如 r = ; c = ; = meshgrid(c, r) h = R.^2 + C.^2 例子:f(x, y) = Asin(ux + vy),生成一个矩阵,包含这个函数的值: function = twodsin(A, u0, v0, M, N) %TWODSIN compare for loops vs vectorization % The comparision is based on implementing the function % f(x, y) = Asin(u0x+v0y) for x = 0, 1, 2,..., M-1, and % y = 0, 1, 2, ..., N-1. The inputs to the function are % M and N and the constants in the function. tic for r = 1:M u0x = u0*(r-1); for c = 1:N v0y = v0*(c-1) f(r, c) = A*sin(u0x + v0y); end end t1 = toc; tic r = c = = meshgrid(c, r); g = A*sin(u0*R + v0*C) t2 = toc; rt = t1/t2; 运行这个例子可以看出,向量计算至少比循环要快30倍。如果只是针对图像的一部分进行操作,可以简单的提取出来,比如 rowhigh = rx + m - 1; colhigh = cy + n - 1; s = 同样功能的程序,这个写法比前面例子看到的写法要快1000倍。 用户交互。函数disp用来提示用户一些信息。比如 A = ; disp(A) sc = 'Digital Image Processing.'; disp(sc) disp('This is another way to display text.') input函数用来提示用户输入某些值: t = input('message') 这个函数可以显示message,并等待用户输入一个值,并存到t中。输入的值可以是MATLAB允许的任何类型的值。而如下的格式只接受字符串输入 t = input('message', 's') 如果字符串中包含的都是数字,则可以用函数str2num进行转换 n = str2num(t) 比如 t = input('Enter your data: ', 's') class(t) size(t) n = str2num(t) size(n) class(n) 如果混合输入字符串和数值,可以全部按照字符串读入,再使用字符串处理函数strread,比如: t = '12.6, x2y, z'; = strread(t, '%f%q%q', 'delimiter', ',') d = char(b) 其中%f表示浮点数,%q表示字符串。delimiter参数表示分割符。函数strcmp用来比较字符串,如果两个字符串相等返回真,否则返回假。lower函数可以把字符串中的大写字母全部变成小写,upper函数可以把字符串中所有小写字母全部变成大写。 Cell数组和结构体。Cell数组是指数组的元素本身还是一个数组,比如 c = {'gause', , 3} c{1} c{2} c{3} 结构体和Cell数组类似,但是其中的元素是用一个名字去访问的,比如 S.char_string = 'gause'; S.matrix = ; S.scalar = 3; S.matrix 实验任务 MATLAB 没有提供一个函数来确定数组的每个元素是不是整数(即...,-2,-1,0,1,2,...)。写一个函数来实现这个功能,并满足下面的格式: function I = isinteger(A) %ISINTEGER Determines which elements of an array are integers. % I = ISINTEGER(A) returns a logical array, I, of the same size % as A, with 1s (TRUE) in the locations corresponding to integers % (i.e., . . . -2 -1 0 1 2 . . . )in A, and 0s (FALSE) elsewhere. % A must be a numeric array. 要求不能使用while或者for循环。提示:使用floor函数。如果你要做到能够处理复数,那么可以使用real和imag函数。 MATLAB没有提供一个函数用来确定数组的每个元素是不是偶数(即...,-4,-2,0,2,4,...)。写一个函数来实现这个功能,并满足下面的格式: function E = iseven(A) %ISEVEN Determines which elements of an array are even numbers. % E = ISEVEN(A) returns a logical array, E, of the same size as A, % with 1s (TRUE) in the locations corresponding to even numbers % (i.e., . . . -3, -1, 0, 2, 4, . . . )in A, and 0s (FALSE) elsewhere. % A must be a numeric array. 要求不能使用while或者for循环。提示:使用floor函数。 MATLAB没有提供一个函数用来确定数组的每个元素是不是奇数(即...,?3,?1,1,3,...)。写一个函数实现这个功能,并满足下面的格式: function D = isodd(A) %ISODD Determines which elements of an array are odd numbers. % E = ISODD(A) returns a logical array, D, of the same size as A, % with 1s (TRUE) in the locations corresponding to odd numbers % (i.e., . . . -3, -1, 1, 3, . . . )in A, and 0s (FALSE) elsewhere. % A must be a numeric array. 要求不能使用while或者for循环。提示:使用floor函数。 写一个函数满足下面的规定: function H = imcircle(R, M, N) %IMCIRCLE Generates a circle inside a rectangle. % H = IMCIRCLE(R, M, N) generates a circle of radius R centered % on a rectangle of height M and width N. H is a binary image with % 1s on the circle and 0s elsewhere. R must be an integer = 1. 你的程序应该检查R的合理性,使它能够在矩形的内部。要求不能使用for或者while循环。提示:使用函数meshgrid和floor函数。 这个实验主要目的是学习如何显示和改变目录,并利用目录信息来读取图像。写一个函数满足下面的规定: function = imagein(path) %IMAGEIN Read image in from current-working or specified directory. % I = IMAGEIN displays a window containing all the files in the % current directory, and saves in I the image selected from the % current directory. % = IMAGEIN variable MAP is required to be an output % argument when the image being read is an indexed image. % = IMAGEIN('PATH') is used when the image to be read % resides in a specified directory. For example, the input % argument 'C:\MY_WORK\MY_IMAGES' opens a window showing % the contents of directory MY_IMAGES. An image selected from % that directory is read in as image I. 提示:使用在线帮助来熟悉cd,pwd,uigetfile函数的使用。或者也可以采用fullfile函数来代替cd函数
Function radec_str2dbl, string_input, select ;+ ;NAME: ; radec_str2dbl ;PURPOSE: ; transform string to double for RA or DEC ;CALLING SEQUENCE: ; rah=radec_str2dbl(ra) ;EXAMPLE: ; IDL ra='00 06 23.0' ; IDL rah=radec_str2dbl(ra,0) ; IDL print,rah ; 0.10638889 ;INPUT: ; string_input --- Right ascension (J2000) ; select ---- 0: blank space separated ; 1: hms separated ; 2: dms separated ; 3: : separated ;OUTPUT: ; outdata ;REVISION HISTORY: ; Original by DL.Wang,30-Dec-2008 ;- if n_elements(select) eq 0 then begin print,'Please select the format input string' print,'0: blank space separated' print,'1: hms separated' print,'2: dms separated' print,'3: : separated' stop endif n=n_elements(string_input) x=strarr(n,3) case select of 0:begin for i=0L,n-1 do begin x =strsplit(string_input ,'( )',/extract) endfor end 1:begin for i=0L,n-1 do begin x =strsplit(string_input ,'(h)(m)(s)( )',/extract) endfor end 2:begin for i=0L,n-1 do begin x =strsplit(string_input ,'(d)(m)(s)( )',/extract) endfor end 3:begin for i=0L,n-1 do begin x =strsplit(string_input ,'(:)( )',/extract) endfor end endcase hd=double(x ) mm=double(x ) ss=double(x ) outdata=tenv(hd,mm,ss) return,double(outdata) End
People who analyze algorithms have double happiness. First of all they experience the sheer beauty of elegant mathematical patterns that surround elegant computational procedures. Then they receive a practical payoff when their theories make it possible to get other jobs done more quickly and more economically. –Donald Knuth
问:有人告诉我不能在printf中使用%lf。为什么printf()用%f输出double型,而scanf却用%lf呢? 答:printf的%f说明符的确既可以输出float型又可以输出double型。 根据"默认参数提升"规则(在printf这样的函数的可变参数列表中 ,不论作用域内有没有原型,都适用这一规则)float型会被提升为double型。因此printf()只会看到双精度数。参见问题15.2。 对于scanf,情况就完全不同了,它接受指针,这里没有类似的类型提升。(通过指针)向float存储和向double存储大不一样,因此,scanf区别%f和%lf。 下表列出了printf和scanf对于各种格式说明符可以接受的参数类型。 格式 printf scanf %c int char * %d, %i int int * %o, %u, %x unsigned int unsigned int * (续) 格式 printf scanf %ld, %li long int long int * %lo, %lu, %lx unsinged long int unsigned long int * %hd, %hi int short int * %ho, %hu, %hx unsigned int unsigned short int * %e, %f, %g double float * %le, %lf, %lg n/a double * %s char * char * % n/a char * %p void void ** %n int * int * %% none none (严格地讲,%lf在printf下是未定义的,但是很多系统可能会接受它。要确保可移植性,就要坚持使用%f。) 参见问题12.15和15.2。 参考资料:
http://images.wellcome.ac.uk/indexplus/image/B0004367.html 这幅双螺旋—扭曲阶梯的图片描述了地球上生命体各种类型的代码—追溯到 1953 年,以及描述了英国科学家弗朗西斯·克里克及其美国合作者詹姆斯·沃森创建的自制金属模型。 为了解决当时研究证据提出的难题,他们通过物理模型结构复杂的分子,获取了新的发现。 这幅 DNA 铅笔草图为克里克所作,构成维康图书馆大量克里克作品的一部分。 这幅图说明了双螺旋的几个机构特征:首先为右旋,双链以相反的方向运转;核苷酸,即链的构成块,具有形成骨骼的一个部分和伸向螺旋中间的一个部分(碱基);一个链中的内部伸向碱基相互对齐,因此能够与相反链中的碱基配对。 最后一个特征对 DNA 十分关键,这个特征能够执行将基因信息从一代传给下一代的功能。 克里克是在他和沃森创建出著名的模型之前还是之后绘制了这幅草图,至今无法得知,但这幅草图诠释了简单的图解能够帮助人们理解复杂问题的作用。 创作者 克里克, 弗朗西斯 (1916-2004) 创建日期 公元 1953年 标题原文 Sketch of the DNA Double Helix by Francis Crick 《自然》杂志上的经典短文是美国生物学家詹姆斯·杜威·沃森(James Dewey Watson)与英国生物学家弗朗西斯·克里克(Francis Crick)的神来之笔。1953年4月25日,沃森和克里克在这篇题为“核酸的分子结构”的论文中向世人宣告:引导生物发育和生命机能运作的脱氧核糖核酸(DNA)具有双螺旋结构。他们用了大约1100个单词和1张图阐述他们的重大发现,整篇文章的长度仅仅一页出头。1962年,沃森和克里克与英国分子生物学家莫里斯·威尔金斯(Maurice Wilkins)分享了诺贝尔生理学或医学奖。
很久以前知道咖啡里面有一种叫做espresso,似乎需要蒸馏,压制出来的,似是咖啡中非常经典的一种。今天下午16:00有课,忽然涌起一股冲动去 Portland Building 里的COSTA买杯咖啡来提提神。上次Lu推荐喝的一种味道非常不错,叫做Cacha(希望名字我没有记错),但今天店员告诉我没有巧克力了,所以无法调 制由咖啡和巧克力混合而成的Cacha,索性就来一杯espresso吧,“for single or double, stay or for take-away?” 一分钟前在menu上看见espresso是Classic里排在第一位的,应该不会让我失望。 排在我前面的两 位顾客都拿到很大的纸杯,我满怀期待我的espresso。只见店员盖上一仅有2.5厘米半径,高约5厘米的袖珍纸杯,颇为熟练的轻 唤:“espresso!”我大跌眼镜了,是在糊弄我吗?打开杯盖,发现里面的液体不足1/5,我惊讶的望着店员:“espresso? espresso with single?”难道是平常人们都喝double的吗?店员肯定的望着我“yes, this is espresso! ,for single!”不想再进一步出洋相,我准备离开,至少我知道下一回我再也不会点espresso了。我品尝了一小口,味道相当的浓烈,难以下咽,但是不 能浪费,1.35镑呢!在Blackwell书店里逛了一会,我发现我并没有刚来时的好心情了,相反想拿一些甜的东西来补偿一下,学生活动中心 (student union's shop)买了一小袋酸奶葡萄干,还是挺郁闷的! 准备回来office时刚好下着雨,英国的天气总是 这样一会晴一会雨。虽然回到office不需要一分钟,这一分钟,雨却是越来越大了,奔跑中我想着回来的第一件事是查字典,确定COSTA的店员没有愚弄 我。到了office门口,我已经成了落汤鸡了。犹豫了一下这副样子被同学看见会不会被笑话了,管他呢!可一开门我就后悔了,本想不知不觉进 来,Marta见我的样子已忍不住哈哈笑了起来,大家都望着我。 “So heavy!” “The moment I decided to come back, it began to rain, and got heavier and heavier.”大家轻松的笑起来。 “Marta, may I ask you what's espress?”来自意大利的Marta,我猜测她应该对咖啡深有研究。 “It's very strong and condensed. In Italy, we only drink espresso, but the espresso in the UK is something like rubbish. Uh, I mean , in fact, it's quite different here.” 我略微relieved。 “Is it so small like this?”我向她展示我那个袖珍纸杯。 “Yes, though the flavor is differnt, the amount is the same, they are very strong. You didn't add sugar in it? You are supposed to add sugar in it!” 得,还是没有掌握方法。 Marta再次下我强调了在英国espresso是多么多么的不正宗。 “I hope I may go to Italy, and try some decent ones! It's so bitter that it tastes like Chinese medicine!” 好啦,得到的教训,下回品尝咖啡,还是不要擅自行动的好!呵呵
29 September 2010 Last updated at 18:43 'Lost' letters show strain between DNA pioneers By Katia Moskvitch Science reporter, BBC News James Watson (left) was only 24 when together with Francis Crick (right) he published the paper that first described the structure of DNA Newly-found letters of the scientists who discovered the structure of DNA highlight tensions around this major scientific breakthrough. Extracts from the missing correspondence are published in the journal Nature. The smoke of witchcraft will soon be getting out of our eyes Maurice Wilkins Biologist Maurice Wilkins, James Watson and Francis Crick won the 1962 Nobel Prize in Medicine for the DNA-related work. But many others contributed, including Rosalind Franklin - whose efforts were called witchcraft in one letter. All three Nobel Prizewinners worked in molecular biology, but in different labs. Essentially, there were two main groups, pursuing the discovery of the DNA (deoxyribonucleic acid) structure: Dr Wilkins and Dr Franklin at King's College in London, and Dr Watson and Dr Crick at the Cavendish Laboratory at Cambridge University. Besides strained relationships, the letters and postcards also give insights into the personalities of the key players. Rosalind Franklin's work was crucial in the discovery of the structure of DNA The Cambridge team used some of Dr Franklin's results to build their first DNA model in December 1951. This triple-helix model was wrong, and the scientists were barred from doing any further DNA work. Dr Wilkins then wrote to his colleagues: This is to say how bloody browned off I am entirely, and how rotten I feel about it all, and how entirely friendly I am (though it may appear differently). We are really between forces which may grind all of us into little pieces But Dr Crick and Dr Watson appeared to be rather breezy: cheer up, and take it from us that even if we kicked you in the pants, it was between friends, the pair wrote in response. We hope our little burglary will at least produce a united front in your group! The last phrase referred to strained relations between Dr Wilkins and Dr Franklin. When the latter arrived to King's College, her colleague thought that she would be working for him, but she believed otherwise. This misunderstanding poisoned their relationship, and the tensions were highlighted even further in other letters. Just before Dr Franklin was to leave King's College, Dr Wilkins wrote to the Cambridge scientists that the smoke of witchcraft will soon be getting out of our eyes. Sexism Explaining the situation to BBC News, Nature's commissioning editor Sara Abdullah said it added to the canon of awful things said about . I think 'sexist' is what we are groping around for. Maurice Wilkins shared the Nobel Prize with Dr Watson and Dr Crick Obviously, this is a different time, it's 1953. There was personal tension; she was very unusual in being a leading woman in science at that time. And there were these different styles of working - all these things are captured there, in those few words. In early 1953, Maurice Wilkins showed James Watson the famous Photograph 51. It was the crucial X-ray image of DNA made by Dr Franklin in the previous months, and it helped the two Cambridge biologists to develop the historic - and correct - double-helix model. To think that Rosie had all the 3D data for nine months and wouldn't fit a helix to it, and there was I taking her word for it that the data was anti-helical, wrote Dr Wilkins to Dr Crick. Christ. And when the study was published in Nature in April 1953, there were only vague references to Dr Franklin's contribution to the titanic achievement in molecular biology. The correspondence had been thought lost. The famous paper on the structure of DNA was published on 25 April, 1953 But it was found earlier this year by Alexander Gann and Jan Witkowski of Cold Spring Harbor Laboratory in New York among papers that had belonged to another scientist, Sydney Brenner, who had shared an office with Francis Crick in Cambridge. Related Internet links Nature: The lost correspondence of Francis Crick