Opened 6 years ago

Last modified 19 months ago

#14092 new defect

Error with supposedly normal DE problem

Reported by: kcrisman Owned by: burcin
Priority: major Milestone: sage-6.4
Component: calculus Keywords:
Cc: schymans Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

See this ask.sagemath.org question.

var('a b n k t')
c = function('c',t)
de = diff(c,t) - a + (b*c)*((c**n)/((k**n)+(c**n))) == 0
des = desolve(de,[c,t],[0,0])

yields an error about c(t) not being a proper Python identifier. Various other combinations yield similar ECL errors, and at least sometimes one can get segmentation faults after inserting print statements.

Change History (8)

comment:1 Changed 6 years ago by kcrisman

Simpler example that seems to behave analogously.

de = diff(c,t) - a + c^n == 0

Note that making n a specific integer gives questions about the sign of a and assume(a>0) fixes things.

Are there maybe just too many variables?

comment:2 Changed 6 years ago by schymans

I don't think it is about the number of variables, but about maxima not being able to provide an explicit solution. Here is the example computed directly in maxima:

maxima("de: 'diff(c(t),t) - a + c(t)^n")
maxima("atvalue (c(t), t = 0, 0);")
maxima("ode2(de,c(t),t);")

gives:

-'integrate(1/(c(t)^  n-a),c(t))=t+%c

Note that the integral containing c(t)n could not be solved. Replacing n by an integer and defining c as positive:

maxima("de: 'diff(c(t),t) - a + c(t)^2")
maxima("atvalue (c(t), t = 0, 0);")
maxima("assume(a>0);")
maxima("ode2(de,c(t),t);")

gives:

-log(-(sqrt(a)-c(t))/(c(t)+sqrt(a)))/(2*sqrt(a))=t+%c

Is it possible that the 'integrate in the solution creates a problem?

comment:3 Changed 6 years ago by schymans

  • Cc schymans added

comment:4 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:5 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:6 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:7 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:8 Changed 19 months ago by rws

With #22024 we get:

sage: solve(de,t,algorithm='sympy')
ConditionSet(t, Eq(-a*(k**n + c(t)**n) + b*c(t)*c(t)**n + (k**n + c(t)**n)*Derivative(c(t), t), 0), Complexes(S.Reals x S.Reals, False)) \ ConditionSet(t, Eq(k**n + c(t)**n, 0), Complexes(S.Reals x S.Reals, False))
Note: See TracTickets for help on using tickets.