Re: [sage-support] The sage notebook does not show results

2015-09-02 Thread Oscar Lazo
Point 6 says "I don't thing the following sudo syntax works anymore. I 

> had to do this by hand now." Did you do that? 
>
>
I wouldn't know how to do that, but it ran smoothly, asked me for a path to 
place the key, a passphrase and it all worked seemingly fine. 

What happened on point 7 of instructions? If it worked, have you tried it 
> with accounts sage1, sage2 and so on? 
>
>
This did not work at all. It asked me for sage0's password, though I did 
not think it had one. I tried with oscarlazo's password which has root 
powers, but that didn't work either.

oscarlazo@VIDEO-AF:~$ sudo -u sageserver ssh sage0@localhost echo Done
sage0@localhost's password: 
Permission denied, please try again.
sage0@localhost's password: 
Permission denied, please try again.
sage0@localhost's password: 
Permission denied (publickey,password).

 How could the sage0, sage1,... passwords be changed?

Thank you!

Oscar

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] The sage notebook does not show results

2015-09-01 Thread Oscar Lazo

Hello Sage people!

I am setting up a sage notebook server at my research institute to showcase 
software I have been writing in atomic physics. So I followed the 
instructions in

http://wiki.sagemath.org/SageServer

and now I can point the browser of a computer within the institute to the 
local static ip and I see the sage notebook as expected. The problem is 
that although I could create a new account, and notebooks, when I type in a 
cell say:

2+2

the notebook waits a little while and then shows no result. The 
corresponding message in the notebook terminal is

2015-09-01 14:20:37-0500 [HTTPChannel,13,127.0.0.1] 
2015-09-01 14:20:37-0500 [HTTPChannel,13,127.0.0.1] 
2015-09-01 14:20:49-0500 [HTTPChannel,8,127.0.0.1] got EOF subprocess must 
have crashed...
2015-09-01 14:20:49-0500 [HTTPChannel,8,127.0.0.1] 
2015-09-01 14:20:49-0500 [HTTPChannel,8,127.0.0.1] Permission denied 
(publickey,password).

what is wrong?

Thank you very much!

Oscar Lazo.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: The sage notebook does not show results

2015-09-01 Thread Oscar Lazo
That seems to work without a problem. I even wrote some rich text without
problem. I saved and quit the worksheet and when I reopened it, the text
was still there.

Oscar.

2015-09-01 14:35 GMT-05:00 kcrisman <kcris...@gmail.com>:

> I'm cc:ing to sage-notebook as well.  Sorry that I can't help but it does
> seem to be a permissions thing.  What happens if you start a new worksheet
> and then just try to save it, or to start a new worksheet, make a *text*
> cell change, and then save it?
>
>
>
>> Hello Sage people!
>>
>> I am setting up a sage notebook server at my research institute to
>> showcase software I have been writing in atomic physics. So I followed the
>> instructions in
>>
>> http://wiki.sagemath.org/SageServer
>>
>> and now I can point the browser of a computer within the institute to the
>> local static ip and I see the sage notebook as expected. The problem is
>> that although I could create a new account, and notebooks, when I type in a
>> cell say:
>>
>> 2+2
>>
>> the notebook waits a little while and then shows no result. The
>> corresponding message in the notebook terminal is
>>
>> 2015-09-01 14:20:37-0500 [HTTPChannel,13,127.0.0.1]
>> 2015-09-01 14:20:37-0500 [HTTPChannel,13,127.0.0.1]
>> 2015-09-01 14:20:49-0500 [HTTPChannel,8,127.0.0.1] got EOF subprocess
>> must have crashed...
>> 2015-09-01 14:20:49-0500 [HTTPChannel,8,127.0.0.1]
>> 2015-09-01 14:20:49-0500 [HTTPChannel,8,127.0.0.1] Permission denied
>> (publickey,password).
>>
>> what is wrong?
>>
>> Thank you very much!
>>
>> Oscar Lazo.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-support/I4uk2EbO6q4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Strange characters in sage terminal

2014-08-18 Thread Oscar Lazo
Hi!

I used to see some straight lines when I started the sage command-line (the 
ones surrounding the header), but now I see some question marks of the kind 
you see when your system doesn't recognize some character. What do you 
think I'm missing? I have an Ubuntu system.

http://i.imgur.com/NItMB21.png

Thank you!

Oscar Lazo

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Strange characters in sage terminal

2014-08-18 Thread Oscar Lazo
Yes, I ran uxterm and I still see strange characters there. Any ideas?

Thank you,

Oscar.

El lunes, 18 de agosto de 2014 14:41:42 UTC-5, Dima Pasechnik escribió:

 On 2014-08-18, Oscar Lazo algebra...@gmail.com javascript: wrote: 
  --=_Part_1633_1643381375.1408388447844 
  Content-Type: text/plain; charset=UTF-8 
  
  Hi! 
  
  I used to see some straight lines when I started the sage command-line 
 (the 
  ones surrounding the header), but now I see some question marks of the 
 kind 
  you see when your system doesn't recognize some character. What do you 
  think I'm missing? I have an Ubuntu system. 

 probably your terminal is not UTF-8 - aware. 
 (these symbols are from UTF-8, not just ASCII) 

 Try opening uxterm and running Sage there. 
 If you still see these, this would indicate weird locale settings... 


  
  http://i.imgur.com/NItMB21.png 
  
  Thank you! 
  
  Oscar Lazo 
  



-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Sage giving wrong answer to simple question.

2014-08-18 Thread Oscar Lazo
Well, the limit of your expression as x goes to 3 does exist.

Oscar.

El lunes, 18 de agosto de 2014 15:07:47 UTC-5, Ron Bannon escribió:

 solve( (x^2-9)/(x-3) = 0, x) should yield x = -3, x neq 3, but Sage just 
 gives x = -3. Any thoughts?


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: configuring tachyon's camera center

2013-08-03 Thread Oscar Lazo
Thank you! that was exactly what I needed.

Oscar.

El jueves, 1 de agosto de 2013 18:55:38 UTC-5, Nils Bruin escribió:

 On Wednesday, July 31, 2013 4:09:45 PM UTC-7, Oscar Lazo wrote:

 Hello dear sage users! 

 I would like to view a 3d plot from a specific viewpoint using tachyon.


 It requires a bit of surgery. Presently, viewpoint and direction are not 
 part of the configurable scenery parameters (and they clearly should be). 
 The just get hard-wired into the input to tachyon. You can intercept the 
 scenery string, however, and edit it to your liking before sending it to 
 the raytracer:

 var('s')
 spiral=parametric_plot3d((cos(s),sin(s),s/8),
 (s,-16*pi,16*pi),aspect_ratio=1,plot_points=200)
 S=spiral.tachyon()
 S=S.replace('center  2.3 2.4 2.0','center 0.0 0.0 0.0')
 S=S.replace('viewdir  -2.3 -2.4 -2.0','viewdir  0.0 1.0 1.0')
 tachyon_rt(S)

 in the notebook, this now just displays. From the command line, you'd have 
 to view the just produced `sage.png`.

 Be careful. for non-standard viewing directions, you may have to add some 
 backdrop planes to avoid looking into a big black abyss.


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] Re: configuring tachyon's camera center

2013-08-03 Thread Oscar Lazo
Is there some way to change the opening angle of the camera? As a default 
it seems to me that it is 2*atan(1/2), that is little more than 53 degrees, 
but that is too little for my purposes.

Oscar.

El jueves, 1 de agosto de 2013 18:55:38 UTC-5, Nils Bruin escribió:

 On Wednesday, July 31, 2013 4:09:45 PM UTC-7, Oscar Lazo wrote:

 Hello dear sage users! 

 I would like to view a 3d plot from a specific viewpoint using tachyon.


 It requires a bit of surgery. Presently, viewpoint and direction are not 
 part of the configurable scenery parameters (and they clearly should be). 
 The just get hard-wired into the input to tachyon. You can intercept the 
 scenery string, however, and edit it to your liking before sending it to 
 the raytracer:

 var('s')
 spiral=parametric_plot3d((cos(s),sin(s),s/8),
 (s,-16*pi,16*pi),aspect_ratio=1,plot_points=200)
 S=spiral.tachyon()
 S=S.replace('center  2.3 2.4 2.0','center 0.0 0.0 0.0')
 S=S.replace('viewdir  -2.3 -2.4 -2.0','viewdir  0.0 1.0 1.0')
 tachyon_rt(S)

 in the notebook, this now just displays. From the command line, you'd have 
 to view the just produced `sage.png`.

 Be careful. for non-standard viewing directions, you may have to add some 
 backdrop planes to avoid looking into a big black abyss.


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] configuring tachyon's camera center

2013-07-31 Thread Oscar Lazo

Hello dear sage users!

I would like to view a 3d plot from a specific viewpoint using tachyon. 
For instance


save: var('s')
sage: spiral=parametric_plot3d((cos(s),sin(s),s/8), 
(s,-16*pi,16*pi),aspect_ratio=1,plot_points=200)

sage: show(spiral, viewer='tachyon')

shows me a spiral from some default viewpoint. However i would like to 
view it from inside that is setting the camera center in (0,0,0) 
viewing towards (0,0,1). Is this posible?


Using tachyon with something like

sage: t = Tachyon(xres=512,yres=512, camera_center=(0,0,0), 
look_at=(0,0,1), raydepth=4)


doesn't allow me to use parametric_plot3d or any other of sage's nice 
plotting functions as far as I can see.


Thanks!

Oscar

--
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] java plugin for JMOL

2012-08-13 Thread Oscar Lazo
Hello, I have just upgraded my ubuntu distribution, and JMOL has stopped 
working for me. It gives me the familiar yellow square advising to 
install java and allow firefox to use it.


I've done:

$ sudo apt-get install sun-java6-jre sun-java6-plugin
...
sun-java6-jre is already the newest version.
sun-java6-plugin is already the newest version.
...

To no avail, I still get the same yellow box. I also tried to check 
whether firefox might be blocking the plugin, but the options only 
include allowing/disallowing javascript. Please help!


Oscar.

--
--
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





[sage-support] Re: Changing the latex representation of the output of derivative.

2012-02-07 Thread Oscar Lazo
Done:

http://trac.sagemath.org/sage_trac/ticket/12455

I've added a patch, which should do the job, but it has a few
shortcomings:

1.-The resulting symbolic functions seem to remain on hold:

sage: airy_ai(1.0)
airy_ai(1.00)

You need to force it to evaluate:

sage: airy_ai(1.0).n()
0.135292416313

2.- This doesn't work:

sage: airy_ai(2.0).n(digits=100)
0.0349241304233

3.- There is no evaluation for airy_ai_prime or airy_bi_prime

4.- I'm not sure about how should the functions be called, some
possible schemes are

{ai,bi,aip,bip} {ai,bai,aip,baip}
{airy_ai,airy_bi,airy_ai_prime,airy_bi_prime}

And also whether the latex representation should be capitalized or
not. I chose the third scheme, and capitalized typesetting.

Cheers!

Oscar


On 6 feb, 19:37, kcrisman kcris...@gmail.com wrote:
 On Feb 6, 4:22 pm, Oscar Lazo algebraicame...@gmail.com wrote:









  That worked excelent! I made the following code:

  from sage.symbolic.function import BuiltinFunction
  class AiryAi(BuiltinFunction):
  def __init__(self):
  BuiltinFunction.__init__(self, ai,
  latex_name=r\operatorname{Ai})
  def _derivative_(self, x, diff_param=None): return aip(x)

  class AiryAiPrime(BuiltinFunction):
  def __init__(self):
  BuiltinFunction.__init__(self, aip,
  latex_name=r\operatorname{Ai}')

  class AiryBi(BuiltinFunction):
  def __init__(self):
  BuiltinFunction.__init__(self, bi,
  latex_name=r\operatorname{Bi})
  def _derivative_(self, x, diff_param=None): return bip(x)

  class AiryBiPrime(BuiltinFunction):
  def __init__(self):
  BuiltinFunction.__init__(self, bip,
  latex_name=r\operatorname{Bi}')

  ai=AiryAi()
  bi=AiryBi()
  aip=AiryAiPrime()
  bip=AiryBiPrime()
  ai(x)+bi(x)+aip(x)+bip(x)

  And now stuff like
  f=A1*ai(k*x)+B1*bi(k*x)
  f
  diff(f,x).subs(x=x0)

  works exactly the way I wanted.

  Thank you!

 Great!

 Oscar, you have a Trac account, right?  Would you mind opening up a
 ticket to make these functions symbolic, put your code up as a
 protopatch, add the ticket to an appropriate place 
 onhttp://trac.sagemath.org/sage_trac/wiki/symbolics/functions, and cc:
 users kcrisman, burcin, and benjaminfjones on the ticket?Since we
 have robust numerical evaluation for this, we might as well add them
 in this way.

 Thanks!

 - kcrisman

On 6 feb, 19:37, kcrisman kcris...@gmail.com wrote:
 On Feb 6, 4:22 pm, Oscar Lazo algebraicame...@gmail.com wrote:









  That worked excelent! I made the following code:

  from sage.symbolic.function import BuiltinFunction
  class AiryAi(BuiltinFunction):
      def __init__(self):
          BuiltinFunction.__init__(self, ai,
  latex_name=r\operatorname{Ai})
      def _derivative_(self, x, diff_param=None): return aip(x)

  class AiryAiPrime(BuiltinFunction):
      def __init__(self):
          BuiltinFunction.__init__(self, aip,
  latex_name=r\operatorname{Ai}')

  class AiryBi(BuiltinFunction):
      def __init__(self):
          BuiltinFunction.__init__(self, bi,
  latex_name=r\operatorname{Bi})
      def _derivative_(self, x, diff_param=None): return bip(x)

  class AiryBiPrime(BuiltinFunction):
      def __init__(self):
          BuiltinFunction.__init__(self, bip,
  latex_name=r\operatorname{Bi}')

  ai=AiryAi()
  bi=AiryBi()
  aip=AiryAiPrime()
  bip=AiryBiPrime()
  ai(x)+bi(x)+aip(x)+bip(x)

  And now stuff like
  f=A1*ai(k*x)+B1*bi(k*x)
  f
  diff(f,x).subs(x=x0)

  works exactly the way I wanted.

  Thank you!

 Great!

 Oscar, you have a Trac account, right?  Would you mind opening up a
 ticket to make these functions symbolic, put your code up as a
 protopatch, add the ticket to an appropriate place 
 onhttp://trac.sagemath.org/sage_trac/wiki/symbolics/functions, and cc:
 users kcrisman, burcin, and benjaminfjones on the ticket?    Since we
 have robust numerical evaluation for this, we might as well add them
 in this way.

 Thanks!

 - kcrisman

-- 
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


[sage-support] Re: Changing the latex representation of the output of derivative.

2012-02-07 Thread Oscar Lazo


On 7 feb, 04:48, Burcin Erocal bur...@erocal.org wrote:
 You need to add an _eval_() function which calls _evalf_() if the
 argument is not exact. See this patch for an example:

 http://trac.sagemath.org/sage_trac/attachment/ticket/4498/trac_4498-s...

Done :)

 The _evalf_() function in your patch hard codes RDF. You need to do
 something like this:

 sage: from sage.libs.mpmath import utils as mpmath_utils
 sage: import mpmath
 sage: mpmath_utils.call(mpmath.airyai, 1, parent=RR)
 0.135292416312881

mpmath seems to be around 35 times faster than the RDF version, (which
was the way things were done before my patch).

 I don't think we want to have separate functions for the derivatives in
 Sage. These might help you get around the printing problem for now, but
 they are not useful in general.

I disagree here, Mathematica has got the AiryAiPrime function. And
mpmath supports calculating derivatives and integrals of arbitrary
order! I think it would be best if we could do something like:

sage: airy_ai(x)
airy_ai(x)
sage: airy_ai(x,1)
airy_ai_prime(x)
sage: airy_ai(x,-2)
airy_ai(x,-2)

that is, make a single object that returns arbitrary derivatives or
integrals.

Cheers!

Oscar

-- 
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


[sage-support] Re: Changing the latex representation of the output of derivative.

2012-02-07 Thread Oscar Lazo
On second thought, I think it would be better to use the airy equation
to calculate derivatives or order higher than 1. Like

sage: airy_ai(2,x)
x*airy_ai(x)
sage: airy_ai(3,x)
airy_ai(x)+x*airy_ai_prime(x)
sage: diff(airy_ai(x),x,2)
x*airy_ai(x)
sage: diff(airy_ai(x),x,3)
airy_ai(x)+x*airy_ai_prime(x)

which is very likey to be the way mpmath calculates higher order
derivatives. Integrals however, would be returned as:

sage: airy_ai(-1,x)
airy_ai(-1,x)
sage: integral(airy_ai(x),x)
airy_ai(-1,x)

what do you think?

Oscar

On 7 feb, 09:15, Burcin Erocal bur...@erocal.org wrote:
 On Tue, 7 Feb 2012 06:56:30 -0800 (PST)









 Oscar Lazo algebraicame...@gmail.com wrote:
  On 7 feb, 04:48, Burcin Erocal bur...@erocal.org wrote:
   I don't think we want to have separate functions for the
   derivatives in Sage. These might help you get around the printing
   problem for now, but they are not useful in general.
  I disagree here, Mathematica has got the AiryAiPrime function. And
  mpmath supports calculating derivatives and integrals of arbitrary
  order! I think it would be best if we could do something like:

  sage: airy_ai(x)
  airy_ai(x)
  sage: airy_ai(x,1)
  airy_ai_prime(x)
  sage: airy_ai(x,-2)
  airy_ai(x,-2)

  that is, make a single object that returns arbitrary derivatives or
  integrals.

 You're right, I didn't know mpmath supported this. We can have a main
 function that takes a single argument and another one with two
 arguments to represent the derivatives. This is similar to how maple
 implements the airy function:

 http://www.maplesoft.com/support/help/Maple/view.aspx?path=Airy

 The implementation would be similar to that of the psi function:

 http://hg.sagemath.org/sage-main/file/tip/sage/functions/other.py#l810

 Note that there are two symbolic functions Function_psi1 and
 Function_psi2, with a regular python function names psi() that
 wraps these.

 You can also put the new functions in a new file sage/functions/airy.py.

 Cheers,
 Burcin

-- 
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


[sage-support] Re: Evaluate quickly a complex expression

2012-02-06 Thread Oscar Lazo
That is very nice! Unfortunately I need to evaluate many different
expressions quickly, so the copy-paste aproach is not an option.
That's why I wrote the fast_complex function. I'll be working in such
a general implementation, do you think it's worth getting it into
sage, or should fast_float be modified to accept complex expressions?

Thanks!

Oscar

On 3 feb, 08:04, Jason Grout jason-s...@creativetrax.com wrote:
 On 2/3/12 8:02 AM, Jason Grout wrote:

  The end result was that the straight Cython version was about 13.6 us,
  the expanded version (where e**(k*I) were precomputed) was about 9 us.
  The straight fortran version was 10.2 us, and the expanded fortran
  version (with the powers of e precomputed) was an amazing 3.26 us!

 Seehttp://sagenb.org/home/pub/4204/for details

 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


[sage-support] Changing the latex representation of the output of derivative.

2012-02-06 Thread Oscar Lazo

Hello

I'm working with Airy functions. Although sage can evaluate 
airy_ai(1.0), it cannot form a symbolic expression like: 
A*airy_ai(x)+B*airy_bi, which is what i need.


So I decided to define the symbolic functions:

ai=function('ai',x,latex_name='Ai')
bi=function('bi',x,latex_name='Bi')

this way

f=A*airy_ai(x)+B*airy_bi
f

looks nice, but I also need to use their derivatives,

un fortunately, the diff function returns a rather ugly output:
A1*D[0](ai)(x) + B1*D[0](bi)(x)

I can live with that, but I also need to be able to visualize in 
typesetted form some complicated expressions involving the derivatives 
of Airy functions, so I would very much prefer if diff(ai) would be 
typesetted the same way as


aip=function('aip',x,latex_name='Ai\'')

Can this be done?

Thank you!

Oscar


--
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


[sage-support] Re: Changing the latex representation of the output of derivative.

2012-02-06 Thread Oscar Lazo
That worked excelent! I made the following code:

from sage.symbolic.function import BuiltinFunction
class AiryAi(BuiltinFunction):
def __init__(self):
BuiltinFunction.__init__(self, ai,
latex_name=r\operatorname{Ai})
def _derivative_(self, x, diff_param=None): return aip(x)

class AiryAiPrime(BuiltinFunction):
def __init__(self):
BuiltinFunction.__init__(self, aip,
latex_name=r\operatorname{Ai}')

class AiryBi(BuiltinFunction):
def __init__(self):
BuiltinFunction.__init__(self, bi,
latex_name=r\operatorname{Bi})
def _derivative_(self, x, diff_param=None): return bip(x)

class AiryBiPrime(BuiltinFunction):
def __init__(self):
BuiltinFunction.__init__(self, bip,
latex_name=r\operatorname{Bi}')

ai=AiryAi()
bi=AiryBi()
aip=AiryAiPrime()
bip=AiryBiPrime()
ai(x)+bi(x)+aip(x)+bip(x)

And now stuff like
f=A1*ai(k*x)+B1*bi(k*x)
f
diff(f,x).subs(x=x0)

works exactly the way I wanted.

Thank you!

Oscar

On 6 feb, 14:32, kcrisman kcris...@gmail.com wrote:
  I can live with that, but I also need to be able to visualize in
  typesetted form some complicated expressions involving the derivatives
  of Airy functions, so I would very much prefer if diff(ai) would be
  typesetted the same way as

  aip=function('aip',x,latex_name='Ai\'')

 Airy functions are in 
 Maximahttp://maxima.sourceforge.net/docs/manual/en/maxima_15.html#Item_003a...
 and 
 mpmathhttp://docs.sympy.org/0.7.0/modules/mpmath/functions/bessel.html#airyai
 so we should be able to make them symbolic and evaluate them and get
 derivatives and related integrals nicely.

 Seehttp://hg.sagemath.org/sage-main/file/tip/sage/functions/trig.py#l305
 for a class definition you could mimic.  I don't think there is any
 other way to get custom derivatives, not on the fly, and not with
 'function'.

 Though if there is, that would be very useful! It would be nice to
 have something like this work.

 sage: F = function('ai',x)
 sage: F
 ai(x)
 sage: G = function('aip',x)
 sage: G
 aip(x)
 sage: F._derivative = G
 ---
 AttributeError: 'sage.symbolic.expression.Expression' object attribute
 '_derivative' is read-only
 sage: F.__setattr__('_derivative',G)
 ---
 AttributeError: 'sage.symbolic.expression.Expression' object attribute
 '_derivative' is read-only

 - kcrisman

-- 
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


[sage-support] f2py throws strange error

2012-02-06 Thread Oscar Lazo

Hello

I've got this code in fortran:

!f90

!f90

! ALGORITHM 819, COLLECTED ALGORITHMS FROM ACM.
! THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE,
! VOL. 28,NO. 3, September, 2002, P. 325--336.

! Code converted using TO_F90 by Alan Miller
! Date: 2002-11-04 Time: 15:13:16


MODULE AiryFunction
IMPLICIT NONE
!INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(12, 60)

PRIVATE
PUBLIC :: aiz, biz

! COMMON /param1/ pi, pihal

REAL , PARAMETER :: pi = 3.1415926535897932385, 
pihal = 1.5707963267948966192

! COMMON /param2/ pih3, pisr, a, alf

REAL , PARAMETER :: pih3 = 4.71238898038469, 
pisr = 1.77245385090552
REAL , SAVE :: a, alf

! COMMON /param3/ thet, r, th15, s1, c1, r32

REAL , SAVE :: thet, r, th15, s1, c1, r32

! COMMON /param4/ facto, th025, s3, c3

REAL , SAVE :: facto, th025, s3, c3


CONTAINS


SUBROUTINE aiz(ifun, ifac, x0, y0, gair, gaii, ierro)

!
! COMPUTATION OF THE AIRY FUNCTION AI(Z) OR ITS DERIVATIVE AI'(Z)
! THE CODE USES:
! 1. MACLAURIN SERIES FOR |Y|  3 AND -2.6  X 1.3 (Z=X + I*Y)
! 2. GAUSS-LAGUERRE QUADRATURE FOR |Z|  15 AND WHEN
! MACLAURIN SERIES ARE NOT USED.
! 3. ASYMPTOTIC EXPANSION FOR |Z|  15.
!
! INPUTS:
! IFUN:
! * IFUN=1, THE CODE COMPUTES AI(Z)
! * IFUN=2, THE CODE COMPUTES AI'(Z)
! IFAC:
! * IFAC=1, THE CODE COMPUTES AI(Z) OR AI'(Z)
! * IFAC=2, THE CODE COMPUTES NORMALIZED AI(Z) OR AI'(Z)
! X0: REAL PART OF THE ARGUMENT Z
! Y0: IMAGINARY PART OF THE ARGUMENT Z

! OUTPUTS:
! GAIR: REAL PART OF AI(Z) OR AI'(Z)
! GAII: IMAGINARY PART OF AI(Z) OR AI'(Z)

! IERRO: ERROR FLAG
! * IERRO=0, SUCCESSFUL COMPUTATION
! * IERRO=1, COMPUTATION OUT OF RANGE
!
! ACCURACY:

! 1) SCALED AIRY FUNCTIONS:
! RELATIVE ACCURACY BETTER THAN 10**(-13) EXCEPT CLOSE TO THE ZEROS,
! WHERE 10**(-13) IS THE ABSOLUTE PRECISION.
! GRADUAL LOSS OF PRECISION TAKES PLACE FOR |Z|1000
! (REACHING 10**(-8) ABSOLUTE ACCURACY FOR |Z| CLOSE TO 10**(6))
! IN THE CASE OF PHASE(Z) CLOSE TO PI OR -PI.
! 2) UNSCALED AIRY FUNCTIONS:
! THE FUNCTION OVERFLOWS/UNDERFLOWS FOR
! 3/2*|Z|**(3/2)  LOG(OVER).
! FOR |Z|  30:
! A) RELATIVE ACCURACY FOR THE MODULUS (EXCEPT AT THE ZEROS)
! BETTER THAN 10**(-13).
! B) ABSOLUTE ACCURACY FOR MIN(R(Z),1/R(Z)) BETTER THAN 10**(-13),
! WHERE R(Z)=REAL(AI)/IMAG(AI) OR R(Z)=REAL(AI')/IMAG(AI').
! FOR |Z|  30, GRADUAL LOSS OF PRECISION TAKES PLACE AS |Z| INCREASES.
!CCC
! AUTHORS:
! AMPARO GIL (U. AUTONOMA DE MADRID, MADRID, SPAIN).
! E-MAIL: amparo@uam.es
! JAVIER SEGURA (U. CARLOS III DE MADRID, MADRID, SPAIN).
! E-MAIL: jseg...@math.uc3m.es
! NICO M. TEMME (CWI, AMSTERDAM, THE NETHERLANDS).
! E-MAIL: nico.te...@cwi.nl
!
! REFERENCES:
! COMPUTING AIRY FUNCTIONS BY NUMERICAL QUADRATURE.
! NUMERICAL ALGORITHMS (2002).
! A. GIL, J. SEGURA, N.M. TEMME
!

INTEGER, INTENT(IN) :: ifun
INTEGER, INTENT(IN) :: ifac
REAL , INTENT(IN) :: x0
REAL , INTENT(IN) :: y0
REAL , INTENT(OUT) :: gair
REAL , INTENT(OUT) :: gaii
INTEGER, INTENT(OUT) :: ierro

REAL :: over, under, dl1, dl2, cover
REAL :: f23, pi23, sqrt3, xa, ya, f23r, df1, df2, s11, c11, dex, dre, 
dima, gar, gai, c, s, u, v, v0, ar, ai, ar1, ai1, ro, coe1, 
coe2, rex, dfr, dfi, ar11, ai11
INTEGER :: iexpf, iexpf2, n
! COMMON /param1/ pi, pihal
! COMMON /param2/ pih3, pisr, a, alf
! COMMON /param3/ thet, r, th15, s1, c1, r32
! COMMON /param4/ facto, th025, s3, c3
REAL , PARAMETER :: x(1:25) = (/ 
.283891417994567679D-1, .170985378860034935D0, 
.435871678341770460D0, .823518257913030858D0, 
1.33452543254227372D0, 1.96968293206435071D0, 
2.72998134002859938D0, 3.61662161916100897D0, 
4.63102611052654146D0, 5.77485171830547694D0, 
7.05000568630218682D0, 8.45866437513237792D0, 
10.0032955242749393D0, 11.6866845947722423D0, 
13.5119659344693551D0, 15.4826596959377140D0, 
17.6027156808069112D0, 19.8765656022785451D0, 
22.3091856773962780D0, 24.9061720212974207D0, 
27.6738320739497190D0, 30.6192963295084111D0, 
33.7506560850239946D0, 37.0771349708391198D0, 
40.6093049694341322D0 /)
REAL , PARAMETER :: w(1:25) = (/ 
.143720408803313866D0, 
.230407559241880881D0, .242253045521327626D0, 
.203636639103440807D0, .143760630622921410D0, 
.869128834706078120D-1, .454175001832915883D-1, 
.206118031206069497D-1, .814278821268606972D-2, 
.280266075663377634D-2, .840337441621719716D-3, 
.219303732907765020D-3, .497401659009257760D-4, 
.978508095920717661D-5, .166542824603725563D-5, 
.244502736801316287D-6, .308537034236207072D-7, 
.333296072940112245D-8, .306781892316295828D-9, 
.239331309885375719D-10, .157294707710054952D-11, 
.864936011664392267D-13, .394819815638647111D-14, 
.148271173082850884D-15, .453390377327054458D-17 /)
REAL , PARAMETER :: xd(1:25) = (/ 

[sage-support] Evaluate quickly a complex expression

2012-02-02 Thread Oscar Lazo

Hello

I've got the following expression:

z=(24*K1**2*K2**2*e**(4*I) + (24*K2**2 - 32*I*K2 + 32)*K1**2 +
(-48*I*K2**2 - 64*K2 - 64*I)*K1 - ((48*K2**2 - 32*I*K2)*K1**2 -
(48*I*K2**2 + 32*K2)*K1)*e**(2*I))*(24*K1**2*K2**2*e**(-4*I) + (24*K2**2
+ 32*I*K2 + 32)*K1**2 + (48*I*K2**2 - 64*K2 + 64*I)*K1 - ((48*K2**2 +
32*I*K2)*K1**2 - (-48*I*K2**2 +
32*K2)*K1)*e**(-2*I))/((9*K1**3*K2**3*e**(6*I) - (9*K2**3 - 30*I*K2**2 -
12*K2 - 24*I)*K1**3 + (30*I*K2**3 + 100*K2**2 - 40*I*K2 + 80)*K1**2 +
24*I*K2**3 - ((27*K2**3 - 30*I*K2**2)*K1**3 - (30*I*K2**3 +
28*K2**2)*K1**2)*e**(4*I) + (12*K2**3 - 40*I*K2**2 - 16*K2 - 32*I)*K1 +
((27*K2**3 - 60*I*K2**2 - 12*K2)*K1**3 + (-60*I*K2**3 - 128*K2**2 +
16*I*K2)*K1**2 - (12*K2**3 - 16*I*K2**2 + 16*K2)*K1)*e**(2*I) + 80*K2**2
- 32*I*K2 + 64)*(9*K1**3*K2**3*e**(-6*I) - (9*K2**3 + 30*I*K2**2 - 12*K2
+ 24*I)*K1**3 + (-30*I*K2**3 + 100*K2**2 + 40*I*K2 + 80)*K1**2 -
24*I*K2**3 - ((27*K2**3 + 30*I*K2**2)*K1**3 - (-30*I*K2**3 +
28*K2**2)*K1**2)*e**(-4*I) + (12*K2**3 + 40*I*K2**2 - 16*K2 + 32*I)*K1 +
((27*K2**3 + 60*I*K2**2 - 12*K2)*K1**3 + (60*I*K2**3 - 128*K2**2 -
16*I*K2)*K1**2 - (12*K2**3 + 16*I*K2**2 + 16*K2)*K1)*e**(-2*I) +
80*K2**2 + 32*I*K2 + 64)) + (8*K1**2*K2**2*e**(4*I) + (8*K2**2 -
16*I*K2)*K1**2 - ((16*K2**2 - 16*I*K2)*K1**2 + 32*K1*K2)*e**(2*I) +
32*K2**2 - 64*I*K2)*(8*K1**2*K2**2*e**(-4*I) + (8*K2**2 + 16*I*K2)*K1**2
- ((16*K2**2 + 16*I*K2)*K1**2 + 32*K1*K2)*e**(-2*I) + 32*K2**2 +
64*I*K2)/((9*K1**3*K2**3*e**(6*I) - (9*K2**3 - 30*I*K2**2 - 12*K2 -
24*I)*K1**3 + (30*I*K2**3 + 100*K2**2 - 40*I*K2 + 80)*K1**2 + 24*I*K2**3
- ((27*K2**3 - 30*I*K2**2)*K1**3 - (30*I*K2**3 +
28*K2**2)*K1**2)*e**(4*I) + (12*K2**3 - 40*I*K2**2 - 16*K2 - 32*I)*K1 +
((27*K2**3 - 60*I*K2**2 - 12*K2)*K1**3 + (-60*I*K2**3 - 128*K2**2 +
16*I*K2)*K1**2 - (12*K2**3 - 16*I*K2**2 + 16*K2)*K1)*e**(2*I) + 80*K2**2
- 32*I*K2 + 64)*(9*K1**3*K2**3*e**(-6*I) - (9*K2**3 + 30*I*K2**2 - 12*K2
+ 24*I)*K1**3 + (-30*I*K2**3 + 100*K2**2 + 40*I*K2 + 80)*K1**2 -
24*I*K2**3 - ((27*K2**3 + 30*I*K2**2)*K1**3 - (-30*I*K2**3 +
28*K2**2)*K1**2)*e**(-4*I) + (12*K2**3 + 40*I*K2**2 - 16*K2 + 32*I)*K1 +
((27*K2**3 + 60*I*K2**2 - 12*K2)*K1**3 + (60*I*K2**3 - 128*K2**2 -
16*I*K2)*K1**2 - (12*K2**3 + 16*I*K2**2 + 16*K2)*K1)*e**(-2*I) +
80*K2**2 + 32*I*K2 + 64))


which depends on K1 and K2. I need to evaluate for many values of K1 and 
K2. I know it to be real, but doing


real(z)

takes forever, so I tried using simply

z.subs(K1=k1,K2=k2)

inside two nested for loops, but that also takes very long. Next I tried 
to use fast_float, but that won't accept my complex expression. I also 
tried fast_callable, but it takes even longer than z.subs.


So, Is there some way to evaluate fastly a complex expression?

thanks!

Oscar

--
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


[sage-support] Re: Evaluate quickly a complex expression

2012-02-02 Thread Oscar Lazo
On 3 feb, 00:45, Simon King simon.k...@uni-jena.de wrote:
 Hi Jason,

 On 3 Feb., 05:41, Jason Grout jason-s...@creativetrax.com wrote:

  ...
  I would use fast_callable (which for me is 5x faster than subs), ...

 Note that the OP stated that he did try fast_callable, and it was
 *slower* than z.subs(K1=k1,K2=k2). Perhaps that indicates a bug?

Well, I may be wrong on that one, at this point I don't remember what
the results were
 Cheers,
 Simon

Thank you all for your suggestions, which seem very good :). I was
away from the internet for most of today, so I couldn't read your
replies until now. I made a function called fast_complex which takes a
symbolic expression, generates the corresponding fortran code, and
compiles it using f2py. It seems fast enough for what I need, though I
wonder whether some of the suggestions here might be better. I'll post
the code:


def fast_complex(expr,name,vars,domain=CC):
varlist=''
for i in vars:
varlist+=str(i)+','
varlist=varlist[:-1]

s='!f90\n'
#s='program programa_x\n'
#s+='implicit none\n'
#s+='end program\n\n'


s+='subroutine '+name+'('+varlist+',output_var)\n'
s+='implicit none\n'
s+='real, intent(in)  ::'+varlist
s+='\n'
if domain==RR:
s+='real, intent(out) :: output_var\n'
else:
s+='complex, intent(out) :: output_var\n'
s+='complex :: I,e,z\n'
s+='e=exp(1.0)\n'
s+='I=(0,1)\n'

fun='z='
fun+= str(expr).replace('^','**')
nums=['0','1','2','3','4','5','6','7','8','9','*','(',')']
while True:
maxi=70
while True:
c1=fun[maxi-1:maxi]; c2=fun[maxi:maxi+1]
if (c1 in nums) or (c2 in nums):
maxi-=1
else:
break
s+=fun[:maxi]+'\n'
if len(fun)maxi:
break
fun=fun[maxi:]
s=s[:-2]
s+='\n\n'
if domain==RR:
s+='output_var=real(z)\n'
else:
s+='output_var=z\n'
s+='end subroutine\n'


f=file('/home/oscar/Escritorio/tesis/calculos/ejem.f90','w')
f.write(s)
f.close()

return fortran(s)

I'll try to check this on the weekend, and maybe make a ticket and
patch :)

thank you all!

Oscar

-- 
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


[sage-support] Elliptic Jacobi functions

2011-11-15 Thread Oscar Lazo

Hi

Is there some way to calculate elliptic Jacobi functions in sage?

http://en.wikipedia.org/wiki/Jacobi_elliptic_function

thanks!

Oscar

--
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


[sage-support] Re: Suse binary doesn't work

2011-03-16 Thread Oscar Lazo
Sorry, I forgot to describe what's going on. It's this friend of mine,
Luis, who is using Suse now, and wants to run sage. But he gets the
error above.

Thank you!

Oscar.

-- 
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


[sage-support] Re: Can't build ATLAS on Ubuntu 10.04

2010-10-16 Thread Oscar Lazo
This is a known bug:

http://trac.sagemath.org/sage_trac/ticket/9385

So far we've been unable to explain it...

Oscar

On Oct 16, 3:09 am, Rodolfo Navarrete rhopark...@gmail.com wrote:
 Hello, I'm trying to compile Sage 4.5.3 on my HP laptop running Ubuntu
 10.04. I have followed the instructions and recommendations on the
 documentation, I even installed bison. I get this error message when
 compiling at the tail of the log file:

    STAGE 2-1-2: CacheEdge DETECTION
 make -f Makefile INSTALL_LOG/atlas_cacheedge.h pre=d 21 | ./xatlas_tee
 INSTALL_LOG/dMMCACHEEDGE.LOG
 make[3]: *** [build] Error 255
 make[3]: Leaving directory
 `/media/Data/Packages/sage-4.5.3/spkg/build/atlas-3.8.3.p14/ATLAS-build'
 make[2]: *** [build] Error 2
 make[2]: Leaving directory
 `/media/Data/Packages/sage-4.5.3/spkg/build/atlas-3.8.3.p14/ATLAS-build'
 Failed to build ATLAS.

   The precompiled binaries seem to work fine, it is the building from source
 I have problems on.

   I have attached the complete gigantic log file for reference as a tarball.

 Thank you for your time,
   Rodolfo Navarrete

  install.log.tar.gz
 481KViewDownload

-- 
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


[sage-support] Re: total differentiation

2010-10-09 Thread Oscar Lazo
On Oct 8, 7:54 pm, Nils Bruin nbr...@sfu.ca wrote:
 If you define x,y,z to be functions of m, it does what you want:

 sage: var(m)
 sage: x=function(x,m)
 sage: y=function(y,m)
 sage: z=function(z,m)
 sage: diff(f,m)
 cos(z(m))*D[0](z)(m) + 2*x(m)*D[0](x)(m) + D[0](y)(m)

Yes, but the point of total differentiation is that the parameter m
should be arbitrary. We should be able to handdle the differentials
without the need to specify with respect to what we are
differentiating, for instance:

In[1]:= Dt[x y]

Out[1]= y Dt[x] + x Dt[y]

Before reading your reply I had though it would be easy to implement
total differentiation in sage with the stuff we've already got, but on
a second thought i don't think sage can express diffrentials by
themselves right now...

Oscar

-- 
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


[sage-support] Re: total differentiation

2010-10-09 Thread Oscar Lazo
On Oct 9, 2:58 pm, jvkersch joris.vankerscha...@gmail.com wrote:
 Hi Oscar,

 In Sage 4.6 (currently 4.6alpha2) you will be able to do this using
 differential forms:

 sage: x, y, z = var('x, y, z')
 sage: U = CoordinatePatch((x, y, z))
 sage: F = DifferentialForms(U)

 sage: f = F(x^2 + y + sin(z)); f
 (x^2 + y + sin(z))
 sage: g = f.diff(); g
 cos(z)*dz + 2*x*dx + dy

 sage: g.parent()
 Algebra of differential forms in the variables x, y, z

 It's only a small step from having d f to obtaining D f.

 All the best,
 J.

That's great, from your example it seems like it shouldn't be too
difficult to make an analog to mathematicas Dt. I'm not familiarized
with differential forms. I what way is your f=f = F(x^2 + y + sin(z))
different to f(x,y,z) = x^2 + y + sin(z) ?

Oscar

-- 
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


[sage-support] total differentiation

2010-10-08 Thread Oscar Lazo

Hello!

Is there some way to calculate a total differential in sage? I'm 
thinking of something that in mathematica would be done like this:


In[1]:= f=x^2+y+Sin[z]

 2
Out[1]= x  + y + Sin[z]

In[2]:= Dt[f,m]

Out[2]= 2 x Dt[x, m] + Dt[y, m] + Cos[z] Dt[z, m]

In sage I get:

sage: var('x y z m')
sage: f=x^2+y+sin(z)
sage: diff(x,m)
0

My guess is there's no way to do this yet, but I also think It shouldn't 
be too hard to implement.


thanks!

Oscar

--
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


[sage-support] Re: wrong model fitting

2010-08-29 Thread Oscar Lazo
One last thing, Is there some way to calculate the correlation index
(R^2) of the fit in sage?

thanks!

Oscar

On Aug 29, 12:15 pm, Oscar Lazo estadisticame...@gmail.com wrote:
 Thank you very much, that worked perfect. Though I must say I expected
 not having to determine the period myself. I thought find_fit would do
 that for me. This way all it does is refine my estimate. But thanks
 again.

 Oscar.

 On Aug 29, 2:05 am, Yann yannlaiglecha...@gmail.com wrote:

  On Aug 29, 4:50 am, Oscar Gerardo Lazo Arjona

  algebraicame...@gmail.com wrote:
   Hello!

   I have tried to fit some data about an harmonic oscillator to a sine
   function, but without success.

   Well, the find_fit command does return the values of constants, but they
   don't fit the data at all!

   I've attatched a worksheet showing this. The first cells are for
   retrieving the data from a file, just look at the two plots and how the
   fitted function (in red) doesn't match the data at all...

   Any ideas?

   Thanks

   Oscar

  Basically, the find_fit function has problems to find a good initial
  guess (especially for the period)
  You could try to help it.
  I can see two ways to do it, using the fact that you expect a sin
  function.

  First, guess the parameters yourself:

  you could look for sign changes to guess the period, this would give
  you:
  sage: initial_omega = pi.n()/mean(differences([0.5*(data1[i][0]+data1[i
  +1][0]) for i in range(len(data1)-1) if data1[i][1]*data1[i+1][1] 
  0]))

  it seems to be enough:
  sage:
  fit=find_fit(data1,model,parameters=[x0,omega,phi],initial_guess=[1,
  omega_i, 1],solution_dict=True); fit
  {x0: 0.051021428637755981, phi: -0.021166741696878096, omega:
  9.521221611651983}

  (nb: you could also find youself better initial guesses for the other
  parameters:
  x0_i = max([y for x,y in data1])
  phi_i = sorted(data1, key=lambda t:abs(t[1]))[0][1]
  )

  Second possibility, clean the data, it would be a lot easier if we
  have only one period:
  sage: min(i for i,(x,y) in enumerate(data1) if y*data1[0][1]0) #
  first sign change
  17
  sage: min(i for i,(x,y) in enumerate(data1) if y*data1[0][1]0) #
  second sign change
  34

  sage: data2 = data1[17:34]
  sage: fit2=find_fit(data2,model,solution_dict=True); fit2
  {x0: 0.05240254787043807, phi: 6.2763562528486139, omega:
  9.5651019068351939}

  You can even go back to data1:
  sage:
  fit=find_fit(data1,model,parameters=[x0,omega,phi],initial_guess=[fit2[x0],
  fit2[omega], fit2[phi]],solution_dict=True); fit
  {x0: 0.051021428642885822, phi: 6.2620185789145335, omega:
  9.5212216134899759}

-- 
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


[sage-support] Re: i need admin rights to sage's ubuntu

2010-08-29 Thread Oscar Lazo
In the command line you can give a command with administrative powers
by writing sudo before it, for examle

sudo mkdir /myfolder

will create a folder in the system root (something which requires
admin powers). You must be carefull when using sudo, since you could
damage your system if you give a bad command. As a principle, don't
use it unless you know what the command will do.

Oscar

On Aug 29, 1:27 am, Seb Taylor pruvit2me...@gmail.com wrote:
 dear sage (and especially the linux and vm) community,

 i'm  a complete noob to sage, linux, virtual machines, and
 virtualbox.  i was able to get sage up and running on my windows vista
 laptop with minor diffuculties and now sage is working great.

 however, i'm looking to add more functionality to the ubuntu OS that
 Sage is running on itself.  VirtualBox comes with a way to enhance
 linux virtual machine guest OSes through their vbox guest additions
 software.  my problem is when i go to install this software, the OS
 tells me i need administrative rights and kicks me out.

 my question is how do i change my rights to the sage's OS itself to
 adminstrative? from a virtual machine?  this seems more like a linux,
 maybe a vbox or vm, issue to me and i am asking in all the forums i
 can find.  but i think that maybe it's just the special version of the
 ubuntu os that sage working over?

 Thanks for all the help in advance!
 -Seb

 ps: i don't mind if you explain things to me like a 3-year-old.  in
 fact, i'd prefer it.

-- 
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


[sage-support] Re: Symbolic determinant solution

2010-08-28 Thread Oscar Lazo
It would be better if you posted the matrix complete, or if it's a
complicated expression, try to simplify it in a way that the error is
still produced. It is difficult to imagine what the problem could be
with so little information.

Oscar

On Aug 28, 6:18 am, samrat samluvs...@gmail.com wrote:
 Hi,

 I am using sage-4.5.1.

 I need to symbolically find the determinant of a 4 X 4 matrix. So i do
 something like:

 sage: mat = [ [-,-,-,-],[-,-,-,-],[-,-,-,-],[-,-,-,-] ]
 sage: A = matrix(mat)
 sage: solve(det(A)==0,c)

 Here c is one of the given algebraic quantities. The solution has been
 provided in a book as:
 c^2 = p - q, where p  q are again some algebraic quantities.

 But sage gives it as c = some algebraic quantity with no square-root
 sign. So you can see that this removes the possibility of getting
 comples solutions for c.

 Even assuming that p  q the answer computed appears different. What
 am i doing wrong?

 Thanks.

-- 
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


[sage-support] Re: How can I make implicit_multiplication default?

2010-08-24 Thread Oscar Lazo


On Aug 23, 8:54 am, Simon King simon.k...@nuigalway.ie wrote:

 1. If you write a little program on the command line and it does
 something, but simply it doesn't do the right thing or you get strange
 error messages about missing attributes -- it would be very hard to
 find out that you forgot to define some object X, so that Sage worked
 in the wrong assumption that X is a symbolic variable. I strongly
 prefer to get a clear error message, namely NameError: Name 'X' is
 not defined or so.

That's a good point. Could you give an example of how such confussion
might happen? Mathematica uses automatic names, so it would be
interesting to see how and if it avoids this sort of thing.

Oscar

-- 
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


[sage-support] How can I make implicit_multiplication default?

2010-08-21 Thread Oscar Lazo
implicit_multiplication is very time-saving, and a much more natural way 
to write things. I'd love it to be default.


BTW: I could not post this to ask.sagemath. I click in ask your 
question and it doesn't get posted.


thanks

Oscar

--
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


[sage-support] Re: How can I make implicit_multiplication default?

2010-08-21 Thread Oscar Lazo
Great! thank you!

On Aug 21, 11:50 am, Mike Hansen mhan...@gmail.com wrote:
 On Sat, Aug 21, 2010 at 9:31 AM, Oscar Lazo estadisticame...@gmail.com 
 wrote:
  implicit_multiplication is very time-saving, and a much more natural way to
  write things. I'd love it to be default.

 In your ~/.sage/init.sage file, add the line
 implicit_multiplication(True).  Whenever you start up Sage, file
 will be run, turning on implicit multiplication for you.

 --Mike

-- 
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


[sage-support] Re: How can I make implicit_multiplication default?

2010-08-21 Thread Oscar Lazo
I have posted a new question now. My impression is that the problem
was related to my GoogleID authentification, since I was working with
two ID's at the time.

On Aug 21, 1:21 pm, Niles nil...@gmail.com wrote:
 Hi Oscar,

 Could you tell us a little more about what fails when you try
 ask.sagemath.org?  Do you get any error message?  At least one tag is
 required for every question, so did you include a tag?

 thanks,
 Niles

 On Aug 21, 12:31 pm, Oscar Lazo estadisticame...@gmail.com wrote:

  implicit_multiplication is very time-saving, and a much more natural way
  to write things. I'd love it to be default.

  BTW: I could not post this to ask.sagemath. I click in ask your
  question and it doesn't get posted.

  thanks

  Oscar

-- 
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


[sage-support] Re: How can I make implicit_multiplication default?

2010-08-21 Thread Oscar Lazo
I have now found out about the automatic_names option, that makes
variables be automatically declared.

Unfortunately this is not available in the command line, so editing
~/.sage/init.sage will not work. Can this too be set as a default?

thanks

Oscar

On Aug 21, 5:56 pm, Oscar Lazo estadisticame...@gmail.com wrote:
 I have posted a new question now. My impression is that the problem
 was related to my GoogleID authentification, since I was working with
 two ID's at the time.

 On Aug 21, 1:21 pm, Niles nil...@gmail.com wrote:

  Hi Oscar,

  Could you tell us a little more about what fails when you try
  ask.sagemath.org?  Do you get any error message?  At least one tag is
  required for every question, so did you include a tag?

  thanks,
  Niles

  On Aug 21, 12:31 pm, Oscar Lazo estadisticame...@gmail.com wrote:

   implicit_multiplication is very time-saving, and a much more natural way
   to write things. I'd love it to be default.

   BTW: I could not post this to ask.sagemath. I click in ask your
   question and it doesn't get posted.

   thanks

   Oscar

-- 
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


[sage-support] Re: Strange bug in latex rendering

2010-08-08 Thread Oscar Lazo
BTW, I am using sage 4.4.4.

-- 
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


[sage-support] Re: Strange bug in latex rendering

2010-08-08 Thread Oscar Lazo
Errr, now that I think of it I should have sent his to sage-devel.
Sorry for the noise, I'll send it there.

-- 
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


[sage-support] Re: Problem with typesetting of help in notebook?

2010-07-16 Thread Oscar Lazo
On 16 jul, 09:56, KvS keesvansch...@gmail.com wrote:
 Dear all,

 somehow the documentation you get by typing command? in a notebook
 cell seems messed up (in my case), Sage 4.4.4 on Ubuntu 10.04 with
 Firefox 3.6.6. Since a screenshot is probably worth a 1000 words, here
 goes:http://tweakers.net/ext/f/Cv8vuWWbGcYuy6u9IyfmKdWu/full.png. Any
 hints on what might be going on?

 Many thanks, Kees

I get the same exact bug, I think we've had this bug for some versions
already.

As a workaround, try using Ctrl ++ to increase you browser resolution.
That fixes it. Then you can go back with Ctrl +- and it gets displayed
fine in your original resolution.

-- 
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


[sage-support] Re: Jmol does not show graphics

2010-07-10 Thread Oscar Lazo
I just noticed the following error appears in the log when i load a
jmol plot:

java version 1.6.0_18
OpenJDK Runtime Environment (IcedTea6 1.8) (fedora-41.b18.fc13-i386)
OpenJDK Server VM (build 14.0-b16, mixed mode)
2010-07-10 13:17:35-0500 [HTTPChannel,6,127.0.0.1] Request error:
Connection to the other side was lost in a non-clean fashion.
script compiler ERROR: command expected
line 1 command 1 of /home/admin/0/cells/19/sage0-size500.jmol?
1278785852:
   !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN 
script ERROR: script compiler ERROR: command expected
line 1 command 1 of /home/admin/0/cells/19/sage0-size500.jmol?
1278785852:
   !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN 
eval ERROR:
line 1 command 1:
 script  /home/admin/0/cells/19/sage0-size500.jmol?
1278785852 

Ideas?

-- 
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


[sage-support] Re: Notebook appearance: change font and syntax highlighting?

2010-07-08 Thread Oscar Lazo
On 7 jul, 16:34, David Sanders dpsand...@gmail.com wrote:
 Hi,

 [Using 'Sage Version 4.4.4, Release Date: 2010-06-23' on Kubuntu
 10.04]

 I have just started using Sage, mainly using the notebook interface,
 which on the whole is excellent and impressive!

 I started out by trying the new interface Cantor, which is very
 nice, but I found it to be too unstable, for example it randomly
 crashed several times when I pressed Tab in the wrong place.

 But I liked its font, and especially its syntax highlighting. So the
 question is: is it possible to change the font and to use syntax
 highlighting in the standard (web browser) notebook interface?  I
 found a few discussions on sage-devel, but they are apparently old
 (?).  It seems to me that this is an important missing feature at the
 moment (assuming I am not just not finding the correct check box!)

 Thanks and best wishes,
 David.

There is currently no syntax highlighting in the notebook interface.
Although it has been discussed. If you are interested in that feature,
you are encouraged to develop it. You will find the Sage community
very welcomming, lot's of people will be there to help you.

Oscar

-- 
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


[sage-support] Re: error with integral

2010-03-06 Thread Oscar Lazo
Then i don't guess it's my fault it doesn't work. Any thoughts about
how to make this work?

On 6 mar, 11:42, Oscar Gerardo Lazo Arjona algebraicame...@gmail.com
wrote:
 Hey guys, what's wront with this integral?

 sage: integral(x^3/(e^x-1),x,0,oo)

 Traceback (most recent call last):
   File stdin, line 1, in module
   File _sage_input_5.py, line 5, in module
     integral(f,x,_sage_const_0 ,oo)
   File , line 1, in module

   File
 /home/oscar/sage-4.3/local/lib/python2.6/site-packages/sage/misc/functional.py,
 line 687, in integral
     return x.integral(*args, **kwds)
   File expression.pyx, line 6495, in
 sage.symbolic.expression.Expression.integral
 (sage/symbolic/expression.cpp:25927)
   File
 /home/oscar/sage-4.3/local/lib/python2.6/site-packages/sage/calculus/calculus.py,
 line 873, in integral
     return SR(result)
   File parent.pyx, line 538, in sage.structure.parent.Parent.__call__
 (sage/structure/parent.c:4956)
   File coerce_maps.pyx, line 156, in
 sage.structure.coerce_maps.NamedConvertMap._call_
 (sage/structure/coerce_maps.c:4098)
   File
 /home/oscar/sage-4.3/local/lib/python2.6/site-packages/sage/interfaces/maxima.py,
 line 1758, in _symbolic_
     return R(self._sage_())
   File
 /home/oscar/sage-4.3/local/lib/python2.6/site-packages/sage/interfaces/maxima.py,
 line 1739, in _sage_
     return symbolic_expression_from_maxima_string(repr(self))
   File
 /home/oscar/sage-4.3/local/lib/python2.6/site-packages/sage/calculus/calculus.py,
 line 1937, in symbolic_expression_from_maxima_string
     raise TypeError, unable to make sense of Maxima expression '%s' in
 Sage%s
 TypeError: unable to make sense of Maxima expression
 'limit(6*li[4](e^x)-6*x*polylog3(e^x)+3*x^2*polylog2(e^x)+x^3*log(1-e^x)-x^4/4,x,inf)-pi^4/15'
 in Sage

 it's an important integral in quantum mechanics, and very difficult for
 me to solve.

-- 
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


[sage-support] Re: Problem compiling with cython

2010-02-21 Thread Oscar Lazo


On 21 feb, 21:50, Oscar Gerardo Lazo Arjona
algebraicame...@gmail.com wrote:
 He is on an amd phenom 965 x4 a 3.4 Ghz processor, and Ubuntu 9.10 64 bits.

It turns out it is actually an Intel core 2 dou
 with ubuntu 9.10 32 bits

thanks

Oscar

-- 
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


[sage-support] Re: Integer solutions to an equations system

2010-02-19 Thread Oscar Lazo
That was was a lot of good feedback! I'll try that

thank you all!

Oscar

-- 
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


[sage-support] Re: Complex valued functions and parametric_plots

2010-01-31 Thread Oscar Lazo
On 30 ene, 14:57, Brian Lins lins.br...@gmail.com wrote:
 I am running into a problem trying to plot a complex valued function
 using parametric plots.

Oh, I didn't realize this thread, before posting a very similar thing.
I do hope this recieves some attention.

thanks

Oscar

-- 
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


[sage-support] Re: Saving pictures of 3d plots

2010-01-22 Thread Oscar Lazo


On 22 ene, 00:51, William Stein wst...@gmail.com wrote:
 This bug was fixed at the last Sage Days.  A fix will appear in some
 version of Sage in the near future..
 Seehttp://trac.sagemath.org/sage_trac/ticket/2872
 and maybe send William Cauchois wcauch...@gmail.com,  kudos for
 spending hours fixing this bug.

Great! but then, is there a way to choose the viewpoint with tachyon?
It would also be good if one could choose the initial viewpoint with
jmol...

-- 
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


[sage-support] Re: sage keywords

2010-01-12 Thread Oscar Lazo


On 12 ene, 21:34, William Stein wst...@gmail.com wrote:
 On Tue, Jan 12, 2010 at 7:14 PM, Oscar Gerardo Lazo Arjona

 algebraicame...@gmail.com wrote:
  wouldn't it be a good idea to hard-code certain mathematical expressions
  into sage
  like pi, I , and e as sage additional keywords so that they could not be
  variable names?

 Yes.

Wow! I was almost sure I would recieve an explanation why that was
impossible/a bad idea. :)

 Sage will soon have a similar mode so that undefined vars magically
 spring into existence *and* you can call methods using functional
 notation, which is what that thread linked to above is about.

That is great!

 I do not think any of this should be on by *default*.       However,
 it should be a simple option to turn any/all of this on with an easy
 short command.

Why not? The point is save trouble to the newbies. It is no big
difference if
instead of telling them be careful not to use e as a variable you
tell them
if you're going to use e as a variable, then use X option
-- 
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


[sage-support] Re: list_plot3d (?)

2009-12-26 Thread Oscar Lazo
On 25 dic, 20:13, William Stein wst...@gmail.com wrote:
 Hi guys...   Contribute stuff to sage!   This is your big chance to
 become Sage developers :-)

I'll publish it if you think that's a good idea. I might start
tomorrow.

BTW, I'd also like to use splines or some other smoothing technique.

-- 
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


[sage-support] Re: list_plot3d (?)

2009-12-25 Thread Oscar Lazo
I've found the same problem. What i did is write a program that
returns lines between nearest-neighbors. But you have to point out the
begining of the curve for it not to make a closed curve. Also, it has
problems with connex? cuves (an 8-shaped curve for instance).

-- 
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


[sage-support] can't run *.sage scripts from command line

2009-08-17 Thread Oscar Lazo

Hello,

I've compiled sage 4.1.1, and it seems to work nicely. However, I can't run 
*.sage scripts from the command line.

I've made a file named test.sage with the following content:

print Hello World
print 8^3

and run sage test.sage

and get the following error:
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File demo.py, line 2, in module
from sage.all_cmdline import *   # import sage library
ImportError: No module named sage.all_cmdline



_
Comparte tus recuerdos en línea con quien tú desees.
http://www.microsoft.com/mexico/windows/windowslive/products/photos-share.aspx?tab=1
--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] jmol bug

2009-08-17 Thread Oscar Lazo

I found this bug in jmol. I tried to run this:

u=var('u')
r1=parametric_plot3d((0.707106781187*(u-0)+0.5,0.707106781187*(u-0)+0.866025403784,0.0*(u-0)+6.12303176911e-17),(u,0,1.57009245868e-16))
(r1).show(aspect_ratio=(1,1,1))

which is plotting points accross a straight line, through a very small interval 
(u,0,1.57009245868e-16). This throws an error:

corners = self.corners(max_len=255) # hardcoded limit in jmol
ZeroDivisionError: float division

The command will work for:

parametric_plot3d((0.707106781187*(u/e+16-0)+0.5,0.707106781187*(u/e+16-0)+0.866025403784,0.0*(u/e+16-0)+6.12303176911e-17),(u,0,1.57009245868))

which is exactly the same thing
the original version also works with tachyon
_
Feliz aniversario Messenger!
www.aniversariomessenger.com.mx
--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---