[sage-support] Re: Solving recursion formula?

2018-12-08 Thread Simon King
Hi Marc,

On 2018-12-08, Marc Mezzarobba  wrote:
> In Sage itself, CFiniteSequence.closed_form() should be able to solve 
> linear recurrence with constant coefficients.

Thank you!
Indeed, after changing my search keyword from resursive to reccurrence,
CFiniteSequence seemed to be the most helpful answer in Sage. What about
a more complicated recurrence, such as the one given by
   x_(n+1) = 1 + x_n*2/n
Any chances to solve those and similar recurrences automatically?

My original hope was that some capability to solve a symbolic recurrence
is standard in Sage; after all, symbolic sums *can* to some extent be
computed in Sage:
  sage: var('k', domain='integer')
  k
  sage: sum(x^k*(k+1)/(k+2), k,0,Infinity)
  (x*(log(-x + 1) - 1) - log(-x + 1))/(x^3 - x^2)

Best regards,
Simon

-- 
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 https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Solving recursion formula?

2018-12-08 Thread Marc Mezzarobba
Simon King wrote:
> That's not what I am looking for. No data are given. Given is some
> recursion formula; what we want to know is a corresponding closed
> formula. Example: The recursion x_0=1 and x_(n+1) := f(x_n) = 2*x_n
> should result in the closed formula x_n = 2^n.

ore_algebra also has some limited support for solving linear recurrences 
with polynomial coefficients. Specifically, it can find polynomial and 
rational closed forms or prove that none exists.

A related and perhaps more interesting feature is the ability to compute 
a basis of asymptotic expansions of solutions as n → ∞. On your example:

sage: from ore_algebra import OreAlgebra
sage: Pols. = QQ[]
sage: RecOps. = OreAlgebra(Pols)
sage: (Sn - 2).generalized_series_solutions()
[2^n*(1 + O(n^(-5)))]

A slightly more complicated one:

sage: (Sn^2 + Sn - 2*(n^2+1)).generalized_series_solutions(2)
[(n/e)^n*(1.414213562373095?)^n*n^(-1.353553390593274?)
 *(1 + 0.010110028629970214?*n^(-1) + O(n^(-2))),
 (n/e)^n*(-1.414213562373095?)^n*n^(-0.6464466094067262?)
 *(1 - 0.3434433619633035?*n^(-1) + O(n^(-2)))]

In Sage itself, CFiniteSequence.closed_form() should be able to solve 
linear recurrence with constant coefficients.

-- 
Marc

-- 
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 https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] make: did it fail? (Sage 8.3)

2018-12-08 Thread Dima Pasechnik
first of all, inspect what you have in your PATH, using "echo" from
shell. E.g. I have

$ echo $PATH
/usr/lib/llvm/6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin


Now one can set it to what you need by using "export", e.g.

$ export PATH=/usr/sbin:/usr/bin:/sbin:/bin

Now in this shell session you have what you've set it to.

To make it persistent, modify ~/.bashrc or/and similar file, such as
~/.profile, this is in every sensible tutorial on basic Unix shell
usage...
On Sat, Dec 8, 2018 at 9:51 AM Rohit Midha  wrote:
>
> Hi,
> I got the same error and I'm really new to all this, and this is probably a 
> stupid question but what exactly do you mean by ' sanitize your PATH' ?
>
> On Sunday, October 14, 2018 at 11:22:45 PM UTC+5:30, Dima Pasechnik wrote:
>>
>> oops, sorry. You got a conflict with Anaconda install:
>> To fix this you probably need to sanitize your PATH
>>
>> indeed, your log says:
>>
>>
>> checking for curl-config... /Users/cbgroves2001/anaconda3/bin/curl-config
>> checking libcurl version ... 7.61.0
>> checking curl/curl.h usability... yes
>> checking curl/curl.h presence... yes
>> checking for curl/curl.h... yes
>> checking if libcurl is version 7 and >= 7.22.0... no
>> configure: error: libcurl >= 7.22.0 library and headers are required
>> On Sun, Oct 14, 2018 at 5:43 PM Charles Groves  wrote:
>> >
>> > i updated command line tools just prior to running make
>> >
>> > On Sun, Oct 14, 2018 at 7:36 AM Dima Pasechnik  wrote:
>> >>
>> >> It looks as if your build got stuck waiting for something, and then got 
>> >> unstuck. Even on such an old machine it should not take more than 8-10 
>> >> hours...
>> >>
>> >> I guess things related to R won't work in your install. It looks as if 
>> >> your libcurl is broken. Do you by any chance need to update Command Line 
>> >> Tools?
>> >>
>> >>
>> >>
>> >> On Sun, 14 Oct 2018, 11:59 ,  wrote:
>> >>>
>> >>> Make was still running fine after 24 hours. Then I forgot what I was 
>> >>> about and closed laptop's lid. Immediately re-opened laptop and found 
>> >>> the lines below.
>> >>>
>> >>> Sage runs and no longer crashes on "plot( x^2 )" like the .dmg version 
>> >>> did.
>> >>>
>> >>> So, did it fail? If so, what do I do? (Besides not closing my laptop :( )
>> >>>
>> >>> Thankyouthankyou.
>> >>>
>> >>>
>> >>> Last lines of output from make:
>> >>>
>> >>> ***
>> >>> Error building Sage.
>> >>>
>> >>> The following package(s) may have failed to build (not necessarily
>> >>> during this run of 'make all-start'):
>> >>>
>> >>> * package: r-3.4.4.p0
>> >>>   log file: /Users/cbgroves2001/sage-8.3/logs/pkgs/r-3.4.4.p0.log
>> >>>   build directory: 
>> >>> /Users/cbgroves2001/sage-8.3/local/var/tmp/sage/build/r-3.4.4.p0
>> >>>
>> >>> The build directory may contain configuration files and other potentially
>> >>> helpful information. WARNING: if you now run 'make' again, the build
>> >>> directory will, by default, be deleted. Set the environment variable
>> >>> SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.
>> >>>
>> >>> make[1]: *** [all-start] Error 1
>> >>> make: *** [all] Error 2
>> >>>
>> >>>
>> >>> macOS High Sierra
>> >>> Version 10.13.6
>> >>>
>> >>> Hardware Overview:
>> >>>
>> >>>   Model Name:MacBook Pro
>> >>>   Model Identifier:MacBookPro8,1
>> >>>   Processor Name:Intel Core i5
>> >>>   Processor Speed:2.3 GHz
>> >>>   Number of Processors:1
>> >>>   Total Number of Cores:2
>> >>>   L2 Cache (per Core):256 KB
>> >>>   L3 Cache:3 MB
>> >>>   Memory:4 GB
>> >>>   Boot ROM Version:MBP81.0050.B00
>> >>>   SMC Version (system):1.68f99
>> >>>   Serial Number (system):C02FJ0KKDH2L
>> >>>   Hardware UUID:5D364BA2-FD44-538D-90A1-79C43365442E
>> >>>   Sudden Motion Sensor:
>> >>>   State:Enabled
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> 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...@googlegroups.com.
>> >>> To post to this group, send email to sage-s...@googlegroups.com.
>> >>> Visit this group at https://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...@googlegroups.com.
>> >> To post to this group, send email to sage-s...@googlegroups.com.
>> >> Visit this group at https://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

Re: [sage-support] make: did it fail? (Sage 8.3)

2018-12-08 Thread Rohit Midha
Hi, 
I got the same error and I'm really new to all this, and this is probably a 
stupid question but what exactly do you mean by ' sanitize your PATH' ?

On Sunday, October 14, 2018 at 11:22:45 PM UTC+5:30, Dima Pasechnik wrote:
>
> oops, sorry. You got a conflict with Anaconda install: 
> To fix this you probably need to sanitize your PATH 
>
> indeed, your log says: 
>
>
> checking for curl-config... /Users/cbgroves2001/anaconda3/bin/curl-config 
> checking libcurl version ... 7.61.0 
> checking curl/curl.h usability... yes 
> checking curl/curl.h presence... yes 
> checking for curl/curl.h... yes 
> checking if libcurl is version 7 and >= 7.22.0... no 
> configure: error: libcurl >= 7.22.0 library and headers are required 
> On Sun, Oct 14, 2018 at 5:43 PM Charles Groves  > wrote: 
> > 
> > i updated command line tools just prior to running make 
> > 
> > On Sun, Oct 14, 2018 at 7:36 AM Dima Pasechnik  > wrote: 
> >> 
> >> It looks as if your build got stuck waiting for something, and then got 
> unstuck. Even on such an old machine it should not take more than 8-10 
> hours... 
> >> 
> >> I guess things related to R won't work in your install. It looks as if 
> your libcurl is broken. Do you by any chance need to update Command Line 
> Tools? 
> >> 
> >> 
> >> 
> >> On Sun, 14 Oct 2018, 11:59 , > 
> wrote: 
> >>> 
> >>> Make was still running fine after 24 hours. Then I forgot what I was 
> about and closed laptop's lid. Immediately re-opened laptop and found the 
> lines below. 
> >>> 
> >>> Sage runs and no longer crashes on "plot( x^2 )" like the .dmg version 
> did. 
> >>> 
> >>> So, did it fail? If so, what do I do? (Besides not closing my laptop 
> :( ) 
> >>> 
> >>> Thankyouthankyou. 
> >>> 
> >>> 
> >>> Last lines of output from make: 
> >>> 
> >>> *** 
> >>> Error building Sage. 
> >>> 
> >>> The following package(s) may have failed to build (not necessarily 
> >>> during this run of 'make all-start'): 
> >>> 
> >>> * package: r-3.4.4.p0 
> >>>   log file: /Users/cbgroves2001/sage-8.3/logs/pkgs/r-3.4.4.p0.log 
> >>>   build directory: 
> /Users/cbgroves2001/sage-8.3/local/var/tmp/sage/build/r-3.4.4.p0 
> >>> 
> >>> The build directory may contain configuration files and other 
> potentially 
> >>> helpful information. WARNING: if you now run 'make' again, the build 
> >>> directory will, by default, be deleted. Set the environment variable 
> >>> SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this. 
> >>> 
> >>> make[1]: *** [all-start] Error 1 
> >>> make: *** [all] Error 2 
> >>> 
> >>> 
> >>> macOS High Sierra 
> >>> Version 10.13.6 
> >>> 
> >>> Hardware Overview: 
> >>> 
> >>>   Model Name:MacBook Pro 
> >>>   Model Identifier:MacBookPro8,1 
> >>>   Processor Name:Intel Core i5 
> >>>   Processor Speed:2.3 GHz 
> >>>   Number of Processors:1 
> >>>   Total Number of Cores:2 
> >>>   L2 Cache (per Core):256 KB 
> >>>   L3 Cache:3 MB 
> >>>   Memory:4 GB 
> >>>   Boot ROM Version:MBP81.0050.B00 
> >>>   SMC Version (system):1.68f99 
> >>>   Serial Number (system):C02FJ0KKDH2L 
> >>>   Hardware UUID:5D364BA2-FD44-538D-90A1-79C43365442E 
> >>>   Sudden Motion Sensor: 
> >>>   State:Enabled 
> >>> 
> >>> 
> >>> 
> >>> -- 
> >>> 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...@googlegroups.com . 
> >>> To post to this group, send email to sage-s...@googlegroups.com 
> . 
> >>> Visit this group at https://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...@googlegroups.com . 
> >> To post to this group, send email to sage-s...@googlegroups.com 
> . 
> >> Visit this group at https://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...@googlegroups.com . 
> > To post to this group, send email to sage-s...@googlegroups.com 
> . 
> > Visit this group at https://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 https://grou