Ask Your Question

soking's profile - activity

2021-02-18 03:50:48 -0600 received badge  Popular Question (source)
2020-03-11 03:09:59 -0600 received badge  Popular Question (source)
2019-03-30 14:58:33 -0600 received badge  Popular Question (source)
2018-08-05 01:17:50 -0600 received badge  Popular Question (source)
2017-06-15 02:20:44 -0600 asked a question 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])

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?


2017-06-13 03:39:13 -0600 commented question solve ode on given interval

No, I didn't think about the problem that way, I was rather think of a way to make Sage solve the ode on a specified interval. But, thanks, it's still something that works (at least for this problem).

2017-06-10 07:24:58 -0600 asked a question solve ode on given interval


I would like to tell Sage to solve ode on a given interval that I will specify. My final goal is to use this method to solve ode that contains 'piecewise' function like 2*diff(u,x) + u == f(x), where

f = piecewise([((-1,0),0), ((0,1),x), ((1,2),2-x), (RealSet.unbounded_above_closed(2),0)])


2017-06-09 03:22:51 -0600 commented answer ode and piecewise function

Thank you, for your answer, but could I have a more general solution because I can't apply your answer when for instance

f = piecewise([((-1,0),0), ((0,1),x), ((1,2),2-x), (RealSet.unbounded_above_closed(2),0)])

I thought of telling sage to solve the ode on each interval, but I don't see how to do it with Sage.

2017-06-08 09:48:43 -0600 commented question ode and piecewise function

Does it mean that I have to switch to Maxima in order to solve such ode?

2017-06-08 09:38:47 -0600 asked a question ode and piecewise function

Hi all,

I am trying to solve, using Sage, an ode which includes a piecewise. For that I wrote the following piece of code which raises an error :

f = piecewise([(RealSet.unbounded_below_open(0),0), (RealSet.unbounded_above_closed(0),10)])
u = function('u')(x)
eqn = 2*diff(u,x) + u == f(x)
u = desolve(eqn, u, ivar=x)

Since the error vanishses when I replace the function f by either of the functions exp or log, I guess the problem is coming from the piecewise function. Could anyone help me solve this issue and explain what is wrong here?


2017-06-08 09:23:41 -0600 commented answer Periodic function

OK, thanks for the explanation. I didn't get everything, but I'll take sometime to read and understand each step.

2017-05-28 11:33:03 -0600 commented answer Periodic function

I agree with you, that's why I initially started with this piece of code

v(x) = piecewise([([0, pi], -x + pi), ((pi, 2*pi), x - pi)])

where v is the function I want to duplicate all over the real line. But when I write

f(x) = v(T*RR(abs(x)/T).frac())

it raises an error, and it seems that the issue is coming from T*RR(abs(x)/T).frac().

Even though your answer is correct and defines the function I wanted, I still want to find a way to do the same with the piecewise function I defined earlier, can you help me with it?

2017-05-27 02:21:57 -0600 commented answer Periodic function

Yeah that's the plot I wanted, but I don't understand the procedure. Can you explain it please?

2017-05-27 02:20:35 -0600 commented answer Periodic function

thanks, ndomes for your answer, bu the function should be even, yours is not :(. By the way are we obliged to rescale the function from [0, pi) to [0,1)? Is it not possible to solve this question directly (I mean without working on the interval [0,1))?

2017-05-26 07:51:21 -0600 asked a question Periodic function

HI all,

I want to write in sage a 2pi periodic even function defined by f(t) = -t + pi, for t in [0, pi). I already checked Defining a periodic function and defining periodic functions on this plateform, but none of the provided solutions works for me. My main issue is that I need a way to transform any real number x into its unique representative in the interval [-pi, pi). For that I used frac and % but they both raise errors. Could anyone help me out?


2017-05-25 05:41:21 -0600 received badge  Supporter (source)
2017-05-25 05:40:59 -0600 commented answer exponential inequality

Great, it works. Thanks a lot.

2017-05-25 03:41:40 -0600 received badge  Student (source)
2017-05-25 03:39:00 -0600 commented question exponential inequality

ok, thanks for the comment, but I still don't have an answer to my question^^

2017-05-25 03:37:54 -0600 received badge  Editor (source)
2017-05-25 03:19:02 -0600 asked a question exponential inequality

Hi all, I am trying to solve, using sage, the inequality exp(x) >= 5, but this is what I get

sage: solve(exp(x)>=5,x)
#0: solve_rat_ineq(ineq=%e^_SAGE_VAR_x >= 5)
[[e^x - 5 == 0], [e^x - 5 > 0]]

Can anyone tell me what's wrong and how to solve this kind of inequalities?


sorry for the presentation of the code, I am new on this plateform.

2017-05-25 03:19:02 -0600 asked a question exponential inequality

Hi all, I am trying to solve (using sage) the inequality exp(x) >= 5, but this what I get

sage: solve(exp(x)>=5,x) #0: solve_rat_ineq(ineq=%e^_SAGE_VAR_x >= 5) [[e^x - 5 == 0], [e^x - 5 > 0]]

Can anyone tell me what's wrong, and how to solve that kind of inequalities using sage?