# Revision history [back]

### Solve DE with secondary function

I want to solve

$-F''(a) + e(a)( F'(a) - F(a)$

My code is

a = var('a')
e(a)= 1 /(1 + e^(-(a)))
F = function('F', a)
de = -diff(F,a, 2) + e(a)*(diff(F,a,1) - F(a))
y = desolve(de, F); y


But I get an error (at the end of the post). If I remove e(a) from the de-term, I get a solution. What do I have to take into account when I add the second function?

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_33.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("YSA9IHZhcignYScpCmUoYSk9IDEgLygxICsgZV4oLShhKSkpICAKRiA9IGZ1bmN0aW9uKCdGJywgYSwgaykKZGUgPSAtZGlmZihGLGEsIDIpICsgZShhKSooZGlmZihGLGEsMSkgLSBGKGEpKQp5ID0gZGVzb2x2ZShkZSwgRik7IHk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>

File "/private/var/folders/r_/9cc9_ldj7g35cqnfql52hqt80000gn/T/tmpgTQRvn/___code___.py", line 7, in <module>
exec compile(u'y = desolve(de, F); y
File "", line 1, in <module>

File "/Applications/Sage-6.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/calculus/desolvers.py", line 443, in desolve
raise ValueError("Unable to determine independent variable, please specify.")
ValueError: Unable to determine independent variable, please specify.


### Solve DE with secondary function

I want to solve

$-F''(a) + e(a)( g(a)( F'(a) - F(a)$

where $g(a)$ is logistic.

My code is

a = var('a')
e(a)= g(a)= 1 /(1 + e^(-(a)))
F = function('F', a)
de = -diff(F,a, 2) + e(a)*(diff(F,a,1) g(a)*(diff(F,a,1) - F(a))
y = desolve(de, F); y


But I get an error (at the end of the post). If I remove e(a) from the de-term, I get a solution. What do I have to take into account when I add the second function?

Traceback (most recent call last):
last):   File "<stdin>", line 1, in <module>   File "_sage_input_38.py", line 10, in <module>
File "_sage_input_33.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# compile(u'open("___code___.py","w").write("#
-*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("YSA9IHZhcignYScpCmUoYSk9IDEgLygxICsgZV4oLShhKSkpICAKRiA9IGZ1bmN0aW9uKCdGJywgYSwgaykKZGUgPSAtZGlmZihGLGEsIDIpICsgZShhKSooZGlmZihGLGEsMSkgLSBGKGEpKQp5ID0gZGVzb2x2ZShkZSwgRik7IHk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
_support_.preparse_worksheet_cell(base64.b64decode("YSA9IHZhcignYScpCmcoYSk9IDEgLygxICsgZV4oLShhKSkpICAKRiA9IGZ1bmN0aW9uKCdGJywgYSkKZGUgPSAtZGlmZihGLGEsIDIpICsgZyhhKSooZGlmZihGLGEsMSkgLSBGKGEpKQp5ID0gZGVzb2x2ZShkZSwgRik7IHk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module>

File "/private/var/folders/r_/9cc9_ldj7g35cqnfql52hqt80000gn/T/tmpgTQRvn/___code___.py", line 7,        File "/private/var/folders/r_/9cc9_ldj7g35cqnfql52hqt80000gn/T/tmp6UcdH_/___code___.py", line 4, in <module>
exec compile(u'y = desolve(de, F); y
File "", line 1, in <module>

File "/Applications/Sage-6.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/calculus/desolvers.py", line 443, in desolve
raise ValueError("Unable __tmp__=var("a"); g = symbolic_expression(_sage_const_1  /(_sage_const_1  + e**(-(a)))  ).function(a)   File "sage/symbolic/expression.pyx", line 3289, in sage.symbolic.expression.Expression.__pow__ (build/cythonized/sage/symbolic/expression.cpp:19361) File "sage/symbolic/expression.pyx", line 2477, in sage.symbolic.expression.Expression.coerce_in (build/cythonized/sage/symbolic/expression.cpp:16920) File "sage/structure/parent_old.pyx", line 252, in sage.structure.parent_old.Parent._coerce_ (build/cythonized/sage/structure/parent_old.c:4415) File "sage/structure/parent.pyx", line 1303, in sage.structure.parent.Parent.coerce (build/cythonized/sage/structure/parent.c:10671) TypeError: no canonical coercion from <class 'sage.symbolic.function_factory.NewSymbolicFunction'> to determine independent variable, please specify.")
ValueError: Unable to determine independent variable, please specify.
Symbolic Ring


### Solve DE with secondary function

I want to solve

$-F''(a) + g(a)( F'(a) - F(a)$

where $g(a)$ is logistic.

My code is

a = var('a')
g(a)= 1 /(1 + e^(-(a)))
F = function('F', a)
de = -diff(F,a, 2) + g(a)*(diff(F,a,1) - F(a))
y = desolve(de, F); y


But I get an error (at the end of the post). If I remove e(a) from the de-term, I get a solution. What do I have to take into account when I add the second function?

Traceback (most recent call last):   File "<stdin>", line 1, in <module>   File "_sage_input_38.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("#
-*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("YSA9IHZhcignYScpCmcoYSk9IDEgLygxICsgZV4oLShhKSkpICAKRiA9IGZ1bmN0aW9uKCdGJywgYSkKZGUgPSAtZGlmZihGLGEsIDIpICsgZyhhKSooZGlmZihGLGEsMSkgLSBGKGEpKQp5ID0gZGVzb2x2ZShkZSwgRik7IHk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module>
File "/private/var/folders/r_/9cc9_ldj7g35cqnfql52hqt80000gn/T/tmp6UcdH_/___code___.py", line 4, in <module>
__tmp__=var("a"); g = symbolic_expression(_sage_const_1  /(_sage_const_1  + e**(-(a)))  ).function(a)   File "sage/symbolic/expression.pyx", line 3289, in sage.symbolic.expression.Expression.__pow__ (build/cythonized/sage/symbolic/expression.cpp:19361) File "sage/symbolic/expression.pyx", line 2477, in sage.symbolic.expression.Expression.coerce_in (build/cythonized/sage/symbolic/expression.cpp:16920) File "sage/structure/parent_old.pyx", line 252, in sage.structure.parent_old.Parent._coerce_ (build/cythonized/sage/structure/parent_old.c:4415) File "sage/structure/parent.pyx", line 1303, in sage.structure.parent.Parent.coerce (build/cythonized/sage/structure/parent.c:10671) TypeError: no canonical coercion from <class 'sage.symbolic.function_factory.NewSymbolicFunction'> to Symbolic Ring