Interestingly, the problem doesn't appear when the expression to be
substituted comes from Sympy :
```
charpent@zen-book-flip:~$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2.beta14, Release Date: 2020-09-30 │
│ Using Python 3.8.6. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable. ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: k=var("k")
sage: assume(k<0)
sage: f=function("f")
sage: Eq=f(x).diff(x,2)/f(x)==k
sage: from sympy import sympify, dsolve
sage: S=dsolve(*map(sympify, (Eq, f(x)))); S
Eq(f(x), C1*exp(-sqrt(k)*x) + C2*exp(sqrt(k)*x))
sage: S._sage_()
f(x) == C2*e^(sqrt(k)*x) + C1*e^(-sqrt(k)*x)
sage: S.subs({sympify(sqrt(k)):sympify(I*sqrt(-k))})
Eq(f(x), C1*exp(-I*x*sqrt(-k)) + C2*exp(I*x*sqrt(-k)))
sage: S.subs({sympify(sqrt(k)):sympify(I*sqrt(-k))})._sage_()
f(x) == C2*e^(I*sqrt(-k)*x) + C1*e^(-I*sqrt(-k)*x)
sage: S._sage_().subs(sqrt(k)==I*sqrt(-k))
f(x) == C2*e^(I*sqrt(-k)*x) + C1*e^(-I*sqrt(-k)*x)
```
Le jeudi 1 octobre 2020 à 18:07:18 UTC+2, Emmanuel Charpentier a écrit :
> The problem may reside in the backtranslation of a Maxima result to Sage:
>
> charpent@zen-book-flip:~$ sage
> ┌────────────────────────────────────────────────────────────────────┐
> │ SageMath version 9.2.beta14, Release Date: 2020-09-30 │
> │ Using Python 3.8.6. Type "help()" for help. │
> └────────────────────────────────────────────────────────────────────┘
> ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
> ┃ Warning: this is a prerelease version, and it may be unstable. ┃
> ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
> sage: var("k")
>
> k
> sage: assume(k<0)
>
> sage: f=function("f")
>
> sage: Eq=f(x).diff(x,2)/f(x)==k
>
> sage: S=desolve(Eq, f(x), ivar=x); S
>
> _K2*cosh(sqrt(k)*x) + I*_K1*sinh(sqrt(k)*x)
> sage: SS=maxima.subst([sqrt(k)==I*sqrt(-k)], S); SS
>
> _SAGE_VAR__K2*cos(sqrt(-_SAGE_VAR_k)*_SAGE_VAR_x)-_SAGE_VAR__K1*sin(sqrt(-_SAGE_VAR_k)*_SAGE_VAR_x)
> sage: SS.sage()
>
> # CRASH :
> ------------------------------------------------------------------------
> /usr/local/sage-9/local/lib/python3.8/site-packages/cysignals/signals.cpython-38-x86_64-linux-gnu.so(+0x842b)[0x7fac8352242b]
> # Etc. ad nauseam...
>
> HTH,
>
> Le jeudi 1 octobre 2020 à 17:36:50 UTC+2, Emmanuel Charpentier a écrit :
>
>> 1) The problem also appears in sagecell <https://sagecell.sagemath.org/>,
>> which contradicts my constatation of having done this yesterday…
>>
>> 2) The problem is *not* in Maxima:
>>
>> ;;; Loading #P"/usr/local/sage-9/local/lib/ecl/sb-bsd-sockets.fas"
>> ;;; Loading #P"/usr/local/sage-9/local/lib/ecl/sockets.fas"
>> Maxima 5.44.0 http://maxima.sourceforge.net
>> using Lisp ECL 20.4.24
>> Distributed under the GNU Public License. See the file COPYING.
>> Dedicated to the memory of William Schelter.
>> The function bug_report() provides bug reporting information.
>> (%i1) display2d:false;
>>
>> (%o1) false
>> (%i2) assume(k<0);
>>
>> (%o2) [k < 0]
>> (%i3) Eq:diff(f(x),x,2)/f(x)=k;
>>
>> (%o3) 'diff(f(x),x,2)/f(x) = k
>> (%i4) S:ode2(Eq,f(x),x);
>>
>> (%o4) f(x) = %i*%k1*sinh(sqrt(k)*x)+%k2*cosh(sqrt(k)*x)
>> (%i5) subst([sqrt(k)=%i*sqrt(-k)],S);
>>
>> (%o5) f(x) = %k2*cos(sqrt(-k)*x)-%k1*sin(sqrt(-k)*x)
>>
>> HTH,
>> Le jeudi 1 octobre 2020 à 16:59:58 UTC+2, Emmanuel Charpentier a écrit :
>>
>>> A new, interesting, and (IMHO) very serious bug :
>>>
>>> f=function("f")
>>> var("k")
>>> Eq=f(x).diff(x,2)/f(x)==k
>>> with assuming(k>0):Sp=desolve(Eq,f(x),ivar=x)
>>> with assuming(k==0):Sz=desolve(Eq,f(x),ivar=x)
>>> with assuming(k<0):Sn=desolve(Eq,f(x),ivar=x)
>>> var("_K1,_K2")
>>> # with assuming(k<0): Sn1=Sn.subs(sqrt(k)==I*sqrt(abs(k))) # Crashes Sage
>>> # with assuming(k<0): Sn2=Sn.subs(sqrt(k)==I*sqrt(-k)) # Crashes Sage also
>>> # Maybe "with assuming..." fails ?
>>> assume(k<0)
>>> # Sn3=Sn.subs(sqrt(k)==I*sqrt(abs(k))) # Crash again
>>> # Sn4=Sn.subs(sqrt(k)==I*sqrt(-k)) # Still crashes...
>>>
>>> Similar tricks *ejusdem farinae* worked up to 9.2.beta13… Did pynac
>>> handling got modified ?
>>>
>>> What I get in a sage-shell-mode emacs session is in the attached
>>> PynacCrash.txt (too long for the post body…). Advice on how to create
>>> an informative ticket welcome...
>>> .HTH,
>>>
>>>
>>> Le jeudi 1 octobre 2020 15:57:03 UTC+2, Emmanuel Charpentier a écrit :
>>>>
>>>> ptestlong on a rebuilt 9.2.beta14+Trac#30675
>>>> <https://trac.sagemath.org/ticket/30675>results in one transient and
>>>> five permanent failures, partially different from those obtained on the
>>>> same machine with 9.2.beta13 :
>>>> File Result P/T
>>>> src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py Killed due
>>>> to abort P
>>>> src/sage/tests/parigp.py Timed out T
>>>> src/sage/modules/fg_pid/fgp_module.py 3 doctests failed P
>>>> src/doc/en/constructions/algebraic_geometry.rst 1 doctest failed P
>>>> src/doc/en/developer/coding_in_other.rst 1 doctest failed P
>>>> src/sage/modules/free_module_morphism.py 3 doctests failed P
>>>> HTH,
>>>> Le jeudi 1 octobre 2020 à 01:22:01 UTC+2, Volker Braun a écrit :
>>>>
>>>>> As always, you can get the latest beta version from the "develop" git
>>>>> branch. Alternatively, the self-contained source tarball is at
>>>>> http://www.sagemath.org/download-latest.html
>>>>>
>>>>> Again, if there is anything that should be merged in this beta cycle
>>>>> then a positively-reviewed patch has to materialize real soon ;-)
>>>>>
>>>>> 1da6df404d (tag: 9.2.beta14) Updated SageMath version to 9.2.beta14
>>>>> be1a62b3bc Trac #30671: Random failure in src/sage/interfaces/psage.py
>>>>> ed7c4a3ee0 Trac #30605: improve cone containment tests
>>>>> ad0f8e0a1f Trac #30601: Move bitset.pxi to bitset_base.pxd
>>>>> 89bf834ab3 Trac #30597: Define a sparse bitset structure
>>>>> c539c2870a Trac #30663: tox.ini: Docker on Mac now needs $HOME too
>>>>> 112d9daff1 Trac #30658: conda-forge-ubuntu-standard: Pillow fails to
>>>>> install (follow up)
>>>>> 0ef7e3ece8 Trac #30631: fix R on macOS xcode 12
>>>>> 6576814c37 Trac #30603: Upgrade readline to 8.0
>>>>> aa0a6d7b5f Trac #30546: python3 spkg-configure: Only search for
>>>>> "python3", implement "configure --with-python=/PATH/TO/PYTHON"
>>>>> 6969c604ad Trac #30664: Fixup for "Add quiet mode for bootstrap"
>>>>> ebf4d9cf63 Trac #30662: Update conda package information, and fix
>>>>> building Sage on conda
>>>>> cbd8e5db72 Trac #29061: Upgrade to symmetrica-3.0.1
>>>>> 99ab61da02 Trac #30596: Outsource functions in bitset.pxi that can be
>>>>> optimized by intrinsics
>>>>> 97802f668d Trac #30595: Remove deprecated sage.libs.ppl
>>>>> 9ed2f32d19 Trac #30585: Typo ticket: homogenous -> homogeneous
>>>>> 9c205e9694 Trac #30577: remove test file for python3 syntax
>>>>> 0b841a75e6 Trac #30575: add maple conversion for hypergeometric
>>>>> functions
>>>>> de8e68e534 Trac #30572: Remove indirect typecasts when calling
>>>>> bitset.pxi
>>>>> dbd108c10b Trac #30567: remove deprecated things in words
>>>>> b4715d1b68 Trac #30563: Use configuration variable MAXIMA instead of
>>>>> hardcoding "maxima"
>>>>> 865f3ca815 Trac #30562: Gap downloads from wrong upstream directory
>>>>> cd88566df0 Trac #30548: mention that sometimes it is wolfram, not math
>>>>> for Mathematica script
>>>>> 7169ec9867 Trac #30547: full flake8 for skew_tableau.py, as an
>>>>> experiment
>>>>> 95712fc6ad Trac #30544: spkg-configure, system package info for tox
>>>>> 2413f7b665 Trac #30523: polynomial_element.pyx: roots: SR: Fix if
>>>>> determinant is not real
>>>>> 28b594bb6e Trac #30486: Prepare doctests for Arb 2.18
>>>>> 43089d428d Trac #30337: Graphs: obtain distance-regular graphs from
>>>>> generalised quadrangles
>>>>> 82a9e2d091 Trac #29500: Install all Python packages via pip wheel (or
>>>>> setup.py bdist_wheel), store wheels in $SAGE_LOCAL/var/lib/sage/wheels
>>>>> 85906ba097 Trac #25119: Fail to integrate sqrt(x^2)/x
>>>>> 5bf821488c Trac #15223: Let the `TestSuite` test that the construction
>>>>> of a parent returns the parent
>>>>> 501019f5b5 Trac #30610: Fix openblas to build with Xcode 12
>>>>> 19be84362c Trac #30576: Python 3.6: Fix locale/encoding issues in
>>>>> docbuild, then re-enable Python 3.6
>>>>> af71febd64 Trac #30008: After #30053, sphinx 3.1.2 does not build on
>>>>> ubuntu-{trusty,xenial,bionic}, debian-jessie, centos-7 (again)
>>>>> 82534f5b92 Trac #30538: some flake8 cleanup in manifolds
>>>>> 3d4a8d2e75 Trac #30533: Add quiet mode for bootstrap
>>>>> 8700f751cf Trac #30532: sage.rings.ideal: Do not import
>>>>> sage.interfaces.singular at load time
>>>>> 0957fb642a Trac #30526: Irrelevant Example for _polynomial_list at
>>>>> FP_template.pxi
>>>>> 3d4760ce77 Trac #30522: polynomial_element.pyx: roots: SR: Return
>>>>> value for vanishing determinant broken
>>>>> 2fd8ef799e Trac #30516: Infinite WeightedIntegerVectors does not
>>>>> coerce properly
>>>>> e3de8ecdfb Trac #30515: implement string formatting for elements in RR
>>>>> and CC
>>>>> 6844bbe72a Trac #30514: fix pycodestyle E701/E702 in combinat
>>>>> 6b4b28b893 Trac #30513: fix pycodestyle E401
>>>>> 7314b0db62 Trac #30510: Speed up method subgraph
>>>>> 16b1089743 Trac #30509: Graphs: Faster implementation for HalfCube
>>>>> 15cebad2f0 Trac #30503: src/tox.ini: Add environment codespell
>>>>> 12c246ff72 Trac #30502: typo ticket 09/2020
>>>>> 8543b383c8 Trac #30497: more lgtm-suggested fixed
>>>>> 55568686a8 Trac #30493: bug in border case in highest weight vectors
>>>>> of tensor product of crystals
>>>>> 12aa127d55 Trac #30492: Provide conversion methods to remove
>>>>> cythonizing from doctests
>>>>> 49f3450dab Trac #29975: Make numerical and probability doctests ready
>>>>> for random seeds
>>>>> 055c07e8c6 Trac #28394: comparison of sage rationals with gmpy2 mpq
>>>>> broken
>>>>> e1a7af2252 Trac #26060: Wrong limit(x / (x + 2^x + cos(x)), x=-oo)
>>>>> cd50ac9ea4 Trac #5178: Make LLL_gram also work with Gram matrices with
>>>>> non-integer entries
>>>>> 69c51603dd Trac #30583: Upgrade: gmpy2 2.1.0.b5
>>>>> 6aa190cdee Trac #30531: Polyhedron_normaliz._triangulate_normaliz
>>>>> should not use NmzResult directly
>>>>> ff880f9919 Trac #29164: Computing log(0, 2) takes a long time
>>>>> d55e6c9835 Trac #30604: fix scipy for XCode 12
>>>>> 468f23815a (tag: 9.2.beta13) Updated SageMath version to 9.2.beta13
>>>>>
>>>>>
--
You received this message because you are subscribed to the Google Groups
"sage-release" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-release/e142e377-7dc5-4207-9ca7-aad4a1c20c1fn%40googlegroups.com.