[sage-support] Product probability space
Im trying to create the tensor product of two probability spaces using the structure DiscreteProbabilitySpace. Say we have S=['head','tail'] P={'head':1/2,'tail':1/2} Omega=DiscreteProbabilitySpace(S,P) I want to construct OmegaxOmega equipped with the product probability measure. It boils down to construct the dictionary {['head','head']:1/4, ['head','tail']:1/4,} I can construct the cartesian product of S by itself but I can(t construct a dictionary with SxS as indices since it is no longer immutable (as far as I understood what was going on). How could I do that ? -- 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] Gap packages
I downloaded and installed sage 4.3.5 on my MacBook Pro. Everything went like a charm. I'm interested in using the simplicial homology GAP packages available at http://www.cis.udel.edu/~dumas/Homology/ It doesn't seem to be in the optional GAP packages available for SAGE. Can I install it directly in SAGE or should I have a stand-alone installation of GAP ? Best regards, -- 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 To unsubscribe, reply using "remove me" as the subject.
[sage-support] Re: Substitution
Thanks. Unfortunately, for my particular example, it didn't work as is -- | Sage Version 4.2, Release Date: 2009-10-24 | | Type notebook() for the GUI, and license() for information.| -- sage: alpha=700 sage: mu1=0.1 sage: mu2=0.2 sage: pI=0.8 sage: l=5 sage: r=1.0 sage: b=r+l sage: c=r*mu1+l*(1-pI)*mu2 sage: a=lambda x: alpha*x-mu1+mu2 sage: f=lambda x: (a(x)*b-c+sqrt((a(x)*b-c)^2+4.0*a(x)*b*r*mu1))/(2*a (x)*mu1) sage: g=lambda x: (r+l-mu1*f(x))/mu2 sage: prev=lambda x: f(x)/(f(x)+g(x)) sage: k=lambda x: diff(prev(x),x) sage: k(x=0.03) --- TypeError Traceback (most recent call last) /Applications/sage/ in () /Applications/sage/ in (x) /Applications/sage/local/lib/python2.6/site-packages/sage/calculus/ functional.pyc in derivative(f, *args, **kwds) 133 if not isinstance(f, Expression): 134 f = SR(f) --> 135 return f.derivative(*args, **kwds) 136 137 diff = derivative /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/ expression.so in sage.symbolic.expression.Expression.derivative (sage/ symbolic/expression.cpp:11427)() /Applications/sage/local/lib/python2.6/site-packages/sage/misc/ derivative.so in sage.misc.derivative.multi_derivative (sage/misc/ derivative.c:2175)() /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/ expression.so in sage.symbolic.expression.Expression._derivative (sage/ symbolic/expression.cpp:11721)() TypeError: argument symb must be a symbol I had to type sage: k(x).subs(x=0.03) 0.0262047639227205 By the way, there is something still puzzling me. The equivalent Maple code gives a value of .883. Who should I believe ? -- 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] Substitution
I have the following problem : I have two nested functions a=lambda x: 2*x b=lambda x: a(x)^2 Everything goes well as long as I want to compute the derivative of b but how can I evaluate this derivative at x=2. I tried g=lambda x: diff(b(x),x) g(x) returns 8*x as expected but g(2)=0. In other words, how can we substitute x=2 to the expression 8*x ? I guess this is somewhere in the docs but I didn't find where. -- 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: convertor Sage -> TeX -> PDF
I have a similar but slightly different request. When I have a plot in sage, say of a function x-> sin(x), I would like to be able to do something like what is explained in http://www.texample.net/tikz/examples/gnuplot-basics/ for gnuplot and pgf. This means, extracting the relevant numerical values and leaving pgf deal with axis, ticks, grid, captions and additional stuff in order to keep the same fonts as in LaTeX for both the text and the pictures. Any idea ? --~--~-~--~~~---~--~~ 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] Composite sorting
I have a list of 2-vectors (a1,a2), (b1,b2) , ... I want to sort the vectors according to the following rule (a1,a2) < (b1,b2) iff a1+b2 < a2+b1 Is there a way to do that using the "sort" function ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---