[sage-support] Re: Optimized

2011-08-01 Thread Jason Grout

On 8/1/11 4:05 PM, William Stein wrote:

On Mon, Aug 1, 2011 at 2:28 PM, Spencermalibuworkc...@gmail.com  wrote:

Alright, it took a lot of rewrites but the optimizer is up and
running, and its really quick (the slow part is looking up and
processing stock info).  It allows for one to put in an accepted risk
free rate (as a proportion not a percent), or an index of acceptable
risk [0,inf] and then the program will find your proportions.  Short
selling is allowed and there is no way to turn it off yet (limiting
the answers to positive values would make the calculation much more
complicated).

Think I'll quickly pop in a confidence interval function then maybe go
on to spread unless there is something else I should do first.  I also
want to take some time to put CovMatrix up for review so that I don't
have to copy paste it into every worksheet I make.


Hi,

Using pastebin.com, I pasted this file:

def profit(n):
 return 1.1*n

Then I clicked on Raw to get this URL:
http://pastebin.com/raw.php?i=Y6zkrjUp

In a worksheet I can now paste the following, the file I put at
pastebin then gets loaded as a .sage file (so with full Sage
preparsing):

f = get_remote_file(http://pastebin.com/raw.php?i=Y6zkrjUp;)
import shutil; shutil.move(f, f+'.sage')
load f+'.sage'


Then I can use the code that was defined in that paste.  Anybody else
can do the same.

You can edit the code, but then I think it has to be a new paste,
which has a new URL.


If you use gist (by github), which keeps track of filenames, you can 
shorten your instructions.


Go to https://gist.github.com/

name this file: myfile.sage
type your code in.
Create public gist

Then click on raw to get the url, for example:

https://raw.github.com/gist/1119259/199adeabc1e4fdefa1ccac395149d96c65b9f938/myfile.sage

Then in sage:

load 
'https://raw.github.com/gist/1119259/199adeabc1e4fdefa1ccac395149d96c65b9f938/myfile.sage'


As a bonus, your paste is version controlled and people can make 
branches of it.


Thanks,

Jason

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Optimized

2011-08-01 Thread William Stein
On Mon, Aug 1, 2011 at 4:43 PM, Jason Grout jason-s...@creativetrax.com wrote:
 On 8/1/11 4:05 PM, William Stein wrote:

 On Mon, Aug 1, 2011 at 2:28 PM, Spencermalibuworkc...@gmail.com  wrote:

 Alright, it took a lot of rewrites but the optimizer is up and
 running, and its really quick (the slow part is looking up and
 processing stock info).  It allows for one to put in an accepted risk
 free rate (as a proportion not a percent), or an index of acceptable
 risk [0,inf] and then the program will find your proportions.  Short
 selling is allowed and there is no way to turn it off yet (limiting
 the answers to positive values would make the calculation much more
 complicated).

 Think I'll quickly pop in a confidence interval function then maybe go
 on to spread unless there is something else I should do first.  I also
 want to take some time to put CovMatrix up for review so that I don't
 have to copy paste it into every worksheet I make.

 Hi,

 Using pastebin.com, I pasted this file:

 def profit(n):
     return 1.1*n

 Then I clicked on Raw to get this URL:
 http://pastebin.com/raw.php?i=Y6zkrjUp

 In a worksheet I can now paste the following, the file I put at
 pastebin then gets loaded as a .sage file (so with full Sage
 preparsing):

 f = get_remote_file(http://pastebin.com/raw.php?i=Y6zkrjUp;)
 import shutil; shutil.move(f, f+'.sage')
 load f+'.sage'


 Then I can use the code that was defined in that paste.  Anybody else
 can do the same.

 You can edit the code, but then I think it has to be a new paste,
 which has a new URL.

 If you use gist (by github), which keeps track of filenames, you can shorten
 your instructions.

 Go to https://gist.github.com/

 name this file: myfile.sage
 type your code in.
 Create public gist

 Then click on raw to get the url, for example:

 https://raw.github.com/gist/1119259/199adeabc1e4fdefa1ccac395149d96c65b9f938/myfile.sage

 Then in sage:

 load
 'https://raw.github.com/gist/1119259/199adeabc1e4fdefa1ccac395149d96c65b9f938/myfile.sage'

 As a bonus, your paste is version controlled and people can make branches of
 it.

Very, very nice!



 Thanks,

 Jason

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org




-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org