2019-01-31 05:05:30 -0600 | asked a question | how to get hints on fixing silly syntax errors Hi, I just spent half an hour on these two commands. I retyped them, I moved them in different cells, nothing, I get syntax error. It works as long as I do not try to make a function |

2018-12-17 02:18:25 -0600 | answered a question | Can I alias a sage command? Sorry, I'm missing some syntax. I tried gets the error |

2018-05-18 09:25:23 -0600 | asked a question | Differences between series and taylor Hi. This morning I had two similar codes that worked: and I couldn't see any difference in the parents, but with series I could continue getting Pade approx: and with taylor I couldn't, hence my first question. Now, not even the first part, getting the series, does not work anymore, which adds a second question. It is true that the code that works was more complicated (including extra manipulations :the Pollaczek-Khinchine formula) Clearly, when simplifying for the purpose of asking on this forum, I added some silly mistake, but I can't see which |

2018-05-15 03:55:02 -0600 | answered a question | Is it possible to change Polynomial Ring in the middle of a computation? The working code for n=3 is with output I need now to "remove" somehow the ? before taking It would be nice if something like or |

2018-05-14 12:03:38 -0600 | asked a question | Is it possible to change Polynomial Ring in the middle of a computation? Hi, I'm trying to invert the "Pollaczek-Khinchine" Laplace transform when it is rational This works for me at degree 2: but not at degree 3, since I do not know how to use partial_fraction_decomposition, and then to switch to RR numbers and then invert .
If I start in R. |

2018-05-14 11:07:14 -0600 | commented answer | inverse_laplace of a fraction whose denominator has real roots (or complex) OK I got it, I just need to replace QQbar by RR. Silly me !!!! |

2018-05-14 10:59:50 -0600 | commented answer | inverse_laplace of a fraction whose denominator has real roots (or complex) the conversion is doable by RR(). Is there an easy way to apply RR to all parts of an expression? |

2018-05-14 10:35:58 -0600 | commented answer | inverse_laplace of a fraction whose denominator has real roots (or complex) The Pade of the uniform program is with answer it only remains to parfrac this. Thanks, Florin |

2018-05-14 04:10:44 -0600 | answered a question | inverse_laplace of a fraction whose denominator has real roots (or complex)
I am just trying now to program in Sage a pedagogic exercise: compute the ruin probability for the Cramer-Lundberg model with a) hyperexponential claims; this should be easy, except that I am novice enough to Sage to have forgotten how these 1.33456? numbers are called, and how to convert an expression involving many of these numbers to a type which will be accepted by the command inverse_laplace b) uniform claims (so the LT is not rational); after rationalizing the LT by Pade, this reduces to previous; it's a one liner in Mathematica, but takes hours in sage due to the crude help system. |

2018-05-14 04:04:41 -0600 | asked a question | inverse_laplace of a fraction whose denominator has real roots (or complex) Hi, this is the simplest and very important method of Laplace inversion . It can be applied to any Laplace transform (LT), by starting with a Pade approximation of the LT, then partial fractions and inversion. For some reason, a program I had written last year stopped working It's pretty easy to repair the program when roots are rational -- see question "partial_fraction_decomposition" with possibly "complex roots", again. For nonrational roots, I proposed there the following test case Thanks in advance :) |

2018-05-13 14:04:35 -0600 | answered a question | "partial_fraction_decomposition" with possibly "complex roots", again Samuel and Emanuel, thanks for teaching me the magic of QQbar and SR! one more question, please. How to do this inverse_laplace of a fraction whose denominator roots may be real (and maybe even complex)? For example, Here I'm stuck with the "decimals?" numbers and ends again in on the other hand fails to find the real roots, and inverse_laplace fails also. Thanks, F The problem is really how to do partial_fractions and then extract the answer, but I added more of the story to make it clear this is a numeric question. For a first answer, I do not need 100 digits precision :) I have added a new question "inverse_laplace of a fraction whose denominator roots are real (or complex) to relance this with more details |

2018-05-06 04:46:25 -0600 | answered a question | "partial_fraction_decomposition" with possibly "complex roots", again Thanks, Samuel :) Starting with the declaration works better :) It's still a bit unfortunate though that the first coefficient 4/7 is not obtained as fraction. I need then an inverse_laplace and this seems to work only for second component It would be nice if there was a simple way to convert all the ?numbers in my list of fractions to closest fractions (apply nearby_rational? to all parts of an expression) |

2018-04-30 12:10:04 -0600 | received badge | ● Nice Question (source) |

2018-04-30 03:58:31 -0600 | asked a question | "partial_fraction_decomposition" with possibly "complex roots", again Hi I come back to this question, even though it's been answered before, since I am still not able to make it work. I should mention maybe that I am just trying to teach undergraduate students to invert rational Laplace transforms (for myself I am able to afford a Mathematica licence, but it would be nice to be able to show students that such simple things may be done nowadays for free). Following a previous answer, I tried Of course, with quadratic rational roots, I could do this by hand, but the purpose here is to do it when you do not know the roots. The first two commands work, but the third has error message I should add that a different attempt which used to work last year gets now same error message. So, this is probably due to an "improvement" of sage |

2018-04-18 13:27:33 -0600 | commented answer | "partial_fraction_decomposition" with "complex roots" Dan, thanks for the thorough answer !!! I only need to invert Laplace transforms with complex poles, so I tried Unfortunately, the third command gets an error ? |

2018-04-18 13:13:20 -0600 | commented answer | "partial_fraction_decomposition" with "complex roots" Thanks for the thorough answer, Dan !!! In that spirit (I just need to invert Laplace transforms with complex roots), I tried The first two commands work, but the third has error message |

2018-04-06 14:42:27 -0600 | asked a question | "partial_fraction_decomposition" with "complex roots" Hi six months ago I used a hint from Zimmerman's book var('s') L=2 C=ComplexField(53) dec=Frac(C['s'])(L).partial_fraction_decomposition() but this does not work anymore (see below). How to do this? Thanks ----> 2 dec=Frac(C['s'])(Lrs).partial_fraction_decomposition(); TypeError: ('cannot convert {!r}/{!r} to an element of {}', 2 /opt/sagemath-8.1/src/sage/structure/parent.pyx in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9641)() 937 if mor is not None: 938 if no_extra_args: --> 939 return mor._call_(x) 940 else: 941 return mor._call_with_args(x, args, kwds) /opt/sagemath-8.1/src/sage/structure/coerce_maps.pyx in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4928)() 152 print(type(C), C) 153 print(type(C._element_constructor), C._element_constructor) --> 154 raise 155 156 cpdef Element _call_with_args(self, x, args=(), kwds={}): /opt/sagemath-8.1/src/sage/structure/coerce_maps.pyx in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4796)() 147 cdef Parent C = self._codomain 148 try: --> 149 return C._element_constructor(x) 150 except Exception: 151 if print_warnings: /opt/sagemath-8.1/local/lib/python2.7/site-packages/sage/rings/fraction_field.py in _element_constructor_(self, x, y, coerce) 616 except AttributeError: 617 raise TypeError("cannot convert {!r}/{!r} to an element of {}", --> 618 x0, y0, self) 619 try: 620 return self._element_class(self, x, y, coerce=coerce) |

2018-03-10 00:33:45 -0600 | received badge | ● Enthusiast |

2018-03-08 06:07:23 -0600 | answered a question | how to find the syntax error The indentation was fine, I just didn't know how to preserve it in the question by copy paste
I indented the code with syntax error by hand to show you (but this still doesn't show in preview), i=3
while i>0 :
print i, 'looping' |

2018-03-08 05:58:58 -0600 | asked a question | how to find the syntax error Hi Here's a short code (copy-paste) that gets me syntax error i=3 while i>0 : print i, 'looping' i=i-1 "<ipython-input-7-8e7eba3f21a0>", line 4 i=i-Integer(1) I retyped it a second time; now it works, but I don't see any difference. i=3 while i>0 : print i, 'looping' i=i-1 Retyping only the line 4 with the error won't help, retyping the previous lines or restarting the kernel won't help either. It's like a phantom error |

2017-12-02 04:16:35 -0600 | asked a question | can series make mistakes? series seems to make errors . luckily, taylor works correctly.
start with L_F=(exp(-s)-1+s)/(s^2/2) (laplace transform of the "equilibrium" uniform density)
and switch to Pollaczek laplace transform L_F /(1- epsilon * L_F); var('s');n=2
L_F=(exp(-s)-1+s)/(s^2/2) #satisfies L_F(s=0)=1
L_L=L_F/(1-L_F/3)
t = L_L.series(s,2 |

2017-12-02 03:58:56 -0600 | received badge | ● Editor |

2017-12-02 03:08:41 -0600 | answered a question | using pade approx it works now! Thanks both of you and excuses for my silly novice questions. Both series and taylor which I had tried before work fine (I guess both must have advantages sometimes if they are kept ?) adding the QQ magic changed the donna
Here's the example
var('s')
L_F=(exp(-s)-1+s)/(s^2) |

2017-12-01 04:13:14 -0600 | asked a question | using pade approx Hi 1) From the only example I found s = PowerSeriesRing(QQ,'s').gen() a=exp(s);a.pade(4, 0) type(a) it seems this works for type 'sage.rings.power_series_poly.PowerSeries_poly' But I have a type 'sage.symbolic.expression.Expression' b, and was unable to convert b to the type required to apply pade 2) There's an alternative rational.reconstruct , but that seems to be geared to computations modulo (n) 3) In conclusion, it seems at current stage the simplest is to write one's own Pade? Thanks, Florin |

2017-11-27 01:39:32 -0600 | received badge | ● Scholar (source) |

2017-11-26 06:44:53 -0600 | answered a question | using Jupiter notebooks .ipynb created on Windows (Oracle VM virtual box) on sage, linux Merci, Samuel :) |

2017-11-24 14:08:25 -0600 | asked a question | using Jupiter notebooks .ipynb created on Windows (Oracle VM virtual box) on sage, linux Hi 1) I use Jupiter notebooks .ipynb created on Windows (Oracle VM virtual box) at home, and would like to upload and use them on our linux sage installation, in our University It seems this is impossible (upload of .ipynb is refused by linux sage) 2) As a substitute, I noticed on a notebook .sage created by someone else that it is at least pure text, and hence can be copied-pasted on a new file in the linux machine. Is it possible to convert my .ipynb notebooks to .sage notebooks? This would allow using them both as notebooks and as a source of copypaste when upload is refused. In fact, can .sage files be created on Windows (Oracle VM virtual box)? Thanks, Florin |

2017-10-21 05:45:03 -0600 | received badge | ● Student (source) |

2017-10-21 05:44:11 -0600 | answered a question | Converting ipynb to latex in Jupyter: is it ?nbconvert /home/sage/Documents/PKfactor.ipynb --to latex error message was SyntaxError: invalid syntax |

2017-10-21 05:44:11 -0600 | asked a question | Converting ipynb to latex in Jupyter: is it ?nbconvert /home/sage/Documents/PKfactor.ipynb --to latex I tried nbconvert /home/sage/Documents/PKfactor.ipynb --to latex (on Windows, virtual machine Sage 8.0), but it didn't work |

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.