ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 15 Jun 2017 09:20:44 +0200Equation with sign functionhttps://ask.sagemath.org/question/37948/equation-with-sign-function/Hi all,
I have the following piece of code
f(x) = 2*unit_step(x)
u = function('u')(x)
eqn = diff(u,x) + u == f(x)
v = desolve(eqn, u,ics=[0,0])
solve(v,x)
which gives me `[x == 0, sgn(x) == -1]` as solutions to the last equation. Could you help me find a way for Sage not to stop at `sgn(x) == -1`?
ThankssokingThu, 15 Jun 2017 09:20:44 +0200https://ask.sagemath.org/question/37948/Problem with sign / sgn and .n()https://ask.sagemath.org/question/8535/problem-with-sign-sgn-and-n/I have an urgent problem with the sign function. I have done a symbolic calculation and want to evaluate the result numerically. The symbolic terms have a sgn() function within, which gives me an error when I try to evaluate the expression numerically. Please find the error below. I do not have the slightest ideas why sage can not evaluate that (simple) expression:
sign(1050*cos(61075634/181449129) + 900).n()
How can i solve that problem?
Thanks a lot in advance,
Best Markus
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_60.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + .....
execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/tmp/tmp4W3s9l/___code___.py", line 4, in <module>
exec compile(u'qwer.n()
File "", line 1, in <module>
File "expression.pyx", line 4053, in sage.symbolic.expression.Expression._numerical_approx (sage/symbolic/expression.cpp:17894)
TypeError: cannot evaluate symbolic expression numerically
edit by kcrisman: Here's a minimal example:
sage: M = sgn(cos(3/2))
sage: M.n()
It doesn't suffice to do `sgn(cos(1))`, because that turns out to be `1`.Louis CypherTue, 06 Dec 2011 15:28:55 +0100https://ask.sagemath.org/question/8535/Radical Sign in answer?https://ask.sagemath.org/question/9182/radical-sign-in-answer/ How do I get an output like the following to look more like we would write it by hand?
Sage: t = var('t')
Sage: S = solve(-16*t^2 + 48*t + 5, t)
Sage: S
[t == -1/4*sqrt(41) + 3/2, t == 1/4*sqrt(41) + 3/2]
hsmit506Tue, 19 Mar 2013 12:02:41 +0100https://ask.sagemath.org/question/9182/