1 | initial version |

How about trying dsolve function from SymPy?

```
# expected behaviour as in 'plain' SymPy (optional)
preparser(False)
# import some libraries
from sympy import Function, dsolve, Eq, Derivative, symbols, sqrt, sympify, pprint
# import some variable names
from sympy.abc import t, a, v, c
# instantiate abstract function
x = Function('x')
# define the ode
g = 1/sqrt(1-v**2/c**2)
ode = g.subs(v, Derivative(x(t), t))*Derivative(x(t), t) - a*t
```

In another cell,

```
%%time
dsolve(ode, x(t))
CPU times: user 1min 6s, sys: 226 ms, total: 1min 6s
Wall time: 1min 6s
Eq(x(t), Piecewise((C1 - a*c*t**2*sqrt(c**(-2))/2, Eq(a, 0)), (C1 - c*(a**2*t**2 + c**2)*sqrt(1/(a**2*t**2 + c**2))/a, True)))
```

Conclusion: it takes its time, but it works! (nicely separating the cases $a=0$, $a\neq 0$).

*Comment:*

`type(g)`

should be a SymPy object (in this case,`<class 'sympy.core.power.Pow'>`

). Unfortunately (in Sage v7.4), if we do something like`sympify(ode)`

, it raises a`NotImplementedError: relation`

. This is why I suggest to define the differential equation via`sympy.abc`

variable names.

2 | No.2 Revision |

How about trying dsolve function from SymPy?

```
# expected behaviour as in 'plain' SymPy (optional)
preparser(False)
# import
```~~some libraries
~~sympy dsolve and other stuff
from sympy import Function, dsolve, Eq, Derivative, symbols, sqrt, sympify, pprint
# import some variable names
from sympy.abc import t, a, v, c
# instantiate abstract function
x = Function('x')
# define the ode
g = 1/sqrt(1-v**2/c**2)
ode = g.subs(v, Derivative(x(t), t))*Derivative(x(t), t) - a*t

In another cell,

```
%%time
dsolve(ode, x(t))
CPU times: user 1min 6s, sys: 226 ms, total: 1min 6s
Wall time: 1min 6s
Eq(x(t), Piecewise((C1 - a*c*t**2*sqrt(c**(-2))/2, Eq(a, 0)), (C1 - c*(a**2*t**2 + c**2)*sqrt(1/(a**2*t**2 + c**2))/a, True)))
```

Conclusion: it takes its time, but it works! (nicely separating the cases $a=0$, $a\neq 0$).

*Comment:*

`type(g)`

should be a SymPy object (in this case,`<class 'sympy.core.power.Pow'>`

). Unfortunately (in Sage v7.4), if we do something like`sympify(ode)`

, it raises a`NotImplementedError: relation`

. This is why I suggest to define the differential equation via`sympy.abc`

variable~~names.~~names.

3 | No.3 Revision |

How about trying dsolve function from SymPy?

```
# expected behaviour as in 'plain' SymPy (optional)
preparser(False)
#
```~~import sympy ~~we need sympy's dsolve and other stuff
from sympy import Function, dsolve, Eq, Derivative, symbols, sqrt, sympify, pprint
# import some variable names
from sympy.abc import t, a, v, c
# instantiate abstract function
x = Function('x')
# define the ode
g = 1/sqrt(1-v**2/c**2)
ode = g.subs(v, Derivative(x(t), t))*Derivative(x(t), t) - a*t

In another cell,

```
%%time
dsolve(ode, x(t))
CPU times: user 1min 6s, sys: 226 ms, total: 1min 6s
Wall time: 1min 6s
Eq(x(t), Piecewise((C1 - a*c*t**2*sqrt(c**(-2))/2, Eq(a, 0)), (C1 - c*(a**2*t**2 + c**2)*sqrt(1/(a**2*t**2 + c**2))/a, True)))
```

Conclusion: it takes its time, but it works! (nicely separating the cases $a=0$, $a\neq 0$).

*Comment:*

`type(g)`

should be a SymPy object (in this case,`<class 'sympy.core.power.Pow'>`

). Unfortunately (in Sage v7.4), if we do something like`sympify(ode)`

, it raises a`NotImplementedError: relation`

. This is why I suggest to define the differential equation via`sympy.abc`

variable names.

4 | No.4 Revision |

How about trying dsolve function from SymPy?

```
# expected behaviour as in 'plain' SymPy (optional)
preparser(False)
# we need sympy's dsolve and other stuff
from sympy import Function, dsolve, Eq, Derivative, symbols, sqrt, sympify, pprint
# import some variable names
from sympy.abc import t, a, v, c
# instantiate abstract function
x = Function('x')
# define the ode
g = 1/sqrt(1-v**2/c**2)
ode = g.subs(v, Derivative(x(t), t))*Derivative(x(t), t) - a*t
```

In another cell,

```
%%time
dsolve(ode, x(t))
CPU times: user 1min 6s, sys: 226 ms, total: 1min 6s
Wall time: 1min 6s
Eq(x(t), Piecewise((C1 - a*c*t**2*sqrt(c**(-2))/2, Eq(a, 0)), (C1 - c*(a**2*t**2 + c**2)*sqrt(1/(a**2*t**2 + c**2))/a, True)))
```

Conclusion: it takes its time, but it works! ~~(nicely separating the cases $a=0$, $a\neq 0$).~~

*Comment:*

`type(g)`

should be a SymPy object (in this case,`<class 'sympy.core.power.Pow'>`

). Unfortunately (in Sage v7.4), if we do something like`sympify(ode)`

, it raises a`NotImplementedError: relation`

. This is why I suggest to define the differential equation via`sympy.abc`

variable names.

5 | No.5 Revision |

How about trying dsolve function from SymPy?

```
# expected behaviour as in 'plain' SymPy (optional)
preparser(False)
# we need sympy's dsolve and other stuff
from sympy import Function, dsolve, Eq, Derivative, symbols, sqrt, sympify, pprint
# import some variable names
from sympy.abc import t, a, v, c
# instantiate abstract function
x = Function('x')
# define the ode
g = 1/sqrt(1-v**2/c**2)
ode = g.subs(v, Derivative(x(t), t))*Derivative(x(t), t) - a*t
```

In another cell,

```
%%time
dsolve(ode, x(t))
CPU times: user 1min 6s, sys: 226 ms, total: 1min 6s
Wall time: 1min 6s
Eq(x(t), Piecewise((C1 - a*c*t**2*sqrt(c**(-2))/2, Eq(a, 0)), (C1 - c*(a**2*t**2 + c**2)*sqrt(1/(a**2*t**2 + c**2))/a, True)))
```

Conclusion: it takes its time, but it works!

*Comment:*

`type(g)`

should be a SymPy object (in this case,`<class 'sympy.core.power.Pow'>`

). Unfortunately (in Sage v7.4), if we do something like`sympify(ode)`

, it raises a`NotImplementedError: relation`

. This is why I suggest to define the differential equation via`sympy.abc`

variable names.- the answer, given as a piecewise-relational equation, separates the cases $a=0$ and $a\neq 0$ but (strangely?) doesn't evaluate the first piece at $a=0$, which gives a constant as expected.

6 | No.6 Revision |

How about trying dsolve function from SymPy?

```
# expected behaviour as in 'plain' SymPy (optional)
preparser(False)
# we need sympy's dsolve and other stuff
from sympy import Function, dsolve, Eq, Derivative, symbols, sqrt, sympify, pprint
# import some variable names
from sympy.abc import t, a, v, c
# instantiate abstract function
x = Function('x')
# define the ode
g = 1/sqrt(1-v**2/c**2)
ode = g.subs(v, Derivative(x(t), t))*Derivative(x(t), t) - a*t
```

In another cell,

```
%%time
dsolve(ode, x(t))
CPU times: user 1min 6s, sys: 226 ms, total: 1min 6s
Wall time: 1min 6s
Eq(x(t), Piecewise((C1 - a*c*t**2*sqrt(c**(-2))/2, Eq(a, 0)), (C1 - c*(a**2*t**2 + c**2)*sqrt(1/(a**2*t**2 + c**2))/a, True)))
```

Conclusion: it takes its time, but it works!

*Comment:*

`type(g)`

should be a SymPy object (in this case,`<class 'sympy.core.power.Pow'>`

). Unfortunately (in Sage v7.4), if we do something like`sympify(ode)`

, it raises a`NotImplementedError: relation`

. This is why I suggest to define the differential equation via`sympy.abc`

variable names.- the answer, given as a piecewise-relational equation, separates the cases $a=0$ and $a\neq 0$ but
~~(strangely?)~~strangely doesn't evaluate to a constant the first piece~~at $a=0$, which gives a constant as expected.~~for $a=0$.

7 | No.7 Revision |

How about trying dsolve function from SymPy?

```
# expected behaviour as in 'plain' SymPy (optional)
preparser(False)
# we need sympy's dsolve and other stuff
from sympy import Function, dsolve, Eq, Derivative, symbols, sqrt, sympify, pprint
# import some variable names
from sympy.abc import t, a, v, c
# instantiate abstract function
x = Function('x')
# define the ode
g = 1/sqrt(1-v**2/c**2)
ode = g.subs(v, Derivative(x(t), t))*Derivative(x(t), t) - a*t
```

In another cell,

```
%%time
dsolve(ode, x(t))
CPU times: user 1min 6s, sys: 226 ms, total: 1min 6s
Wall time: 1min 6s
Eq(x(t), Piecewise((C1 - a*c*t**2*sqrt(c**(-2))/2, Eq(a, 0)), (C1 - c*(a**2*t**2 + c**2)*sqrt(1/(a**2*t**2 + c**2))/a, True)))
```

Conclusion: it takes its time, but it works!

*Comment:*

`type(g)`

should be a SymPy object (in this case,`<class 'sympy.core.power.Pow'>`

). Unfortunately (in Sage v7.4), if we do something like`sympify(ode)`

, it raises a`NotImplementedError: relation`

. This is why I suggest to define the differential equation via`sympy.abc`

variable names.- the answer, given as a
~~piecewise-relational~~piecewise relational equation, separates the cases $a=0$ and $a\neq 0$ but strangely doesn't evaluate to a constant the first piece for $a=0$.

8 | No.8 Revision |

How about trying dsolve function from SymPy?

```
# expected behaviour as in 'plain' SymPy (optional)
preparser(False)
# we need sympy's dsolve and other stuff
from sympy import Function, dsolve, Eq, Derivative, symbols, sqrt, sympify, pprint
# import some variable names
from sympy.abc import t, a, v, c
# instantiate abstract function
x = Function('x')
# define the ode
g = 1/sqrt(1-v**2/c**2)
ode = g.subs(v, Derivative(x(t), t))*Derivative(x(t), t) - a*t
```

In another cell,

```
%%time
dsolve(ode, x(t))
CPU times: user 1min 6s, sys: 226 ms, total: 1min 6s
Wall time: 1min 6s
Eq(x(t), Piecewise((C1 - a*c*t**2*sqrt(c**(-2))/2, Eq(a, 0)), (C1 - c*(a**2*t**2 + c**2)*sqrt(1/(a**2*t**2 + c**2))/a, True)))
```

Conclusion: it takes ~~its ~~time, but it works!

*Comment:*

`type(g)`

should be a SymPy object (in this case,`<class 'sympy.core.power.Pow'>`

). Unfortunately (in Sage v7.4), if we do something like`sympify(ode)`

, it raises a`NotImplementedError: relation`

. This is why I suggest to define the differential equation via`sympy.abc`

variable names.- the answer, given as a piecewise relational equation, separates the cases $a=0$ and $a\neq 0$ but strangely doesn't evaluate to a constant the first piece for $a=0$.

9 | No.9 Revision |

How about trying dsolve function from SymPy?

```
# expected behaviour as in 'plain' SymPy (optional)
preparser(False)
# we need sympy's dsolve and other stuff
from sympy import Function, dsolve, Eq, Derivative, symbols, sqrt, sympify, pprint
# import some variable names
from sympy.abc import t, a, v, c
# instantiate abstract function
x = Function('x')
# define the ode
g = 1/sqrt(1-v**2/c**2)
ode = g.subs(v, Derivative(x(t), t))*Derivative(x(t), t) - a*t
```

In another cell,

```
%%time
dsolve(ode, x(t))
CPU times: user 1min 6s, sys: 226 ms, total: 1min 6s
Wall time: 1min 6s
Eq(x(t), Piecewise((C1 - a*c*t**2*sqrt(c**(-2))/2, Eq(a, 0)), (C1 - c*(a**2*t**2 + c**2)*sqrt(1/(a**2*t**2 + c**2))/a, True)))
```

Conclusion: it takes time, but it works!

~~Comment:~~Notes:

`type(g)`

should be a SymPy object (in this case,`<class 'sympy.core.power.Pow'>`

). Unfortunately (in Sage v7.4), if we do something like`sympify(ode)`

, it raises a`NotImplementedError: relation`

. This is why I suggest to define the differential equation via`sympy.abc`

variable names.- the answer, given as a piecewise relational equation, separates the cases $a=0$ and $a\neq 0$ but strangely doesn't evaluate to a constant the first piece for $a=0$.

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.