Ask Your Question

maaaaaaartin's profile - activity

2021-11-01 12:17:03 +0200 received badge  Notable Question (source)
2021-11-01 12:17:03 +0200 received badge  Popular Question (source)
2021-01-07 09:55:26 +0200 received badge  Notable Question (source)
2021-01-07 09:55:26 +0200 received badge  Popular Question (source)
2017-10-08 19:30:19 +0200 asked a question piecewise function with variable within domains

Dear all,

I am trying to define a piecewise function where the domains are parametrized by some variable:

import sage.all as sage
sage.var('x')
sage.var('x0')
sage.var('x1')
sage.assume( 0<x0)
sage.assume(x0<x1)
sage.assume(x1< 1)
sage.piecewise([((0,x0),0), ([x0,x1],1), ((x1,1),1)], var=x)

However, I cannot seem to get it to work:

TypeError: unable to simplify to a real interval approximation

Any idea how to make it work? Thanks!

Martin

2017-03-11 08:24:18 +0200 commented question save/load session in standalone python

Right. Sorry for lack of clarity. And thanks for trying to help. I am using sage in standalone python scripts. Is there a way for me to save all variables to a file, and load them in another script? Thanks!

2017-03-10 19:15:06 +0200 asked a question save/load session in standalone python

Trying to save my sage session from a standalone python script, but I am getting the following error:

TypeError: argument of type 'NoneType' is not iterable

Can't find any information on that. Any idea what might be going on? Thanks!

2017-03-09 12:19:38 +0200 commented answer [RESOLVED]Use sage objects in python module files

A pointer to the doc? Thanks!

2017-03-09 12:19:09 +0200 answered a question [RESOLVED]Use sage objects in python module files

My advice: put import sage.all as sage at the beginning of each python file, and then use for instance sage.var('x') in your scripts.

2017-03-09 12:15:01 +0200 asked a question limit of function with dirac delta

Consider the following code:

sage.var(x)
f = (1-x) * sage.unit_step(x)
df = f.diff(x)    ->    -unit_step(x) + (1-x)*dirac_delta(x)

Trying to compute df.limit(x=0, dir="right"), which should return -1, but instead returns limit(-unit_step(x) + (1-x)*dirac_delta(x), x, 0, plus).

Even df.limit(x=0.5) return limit(-unit_step(x) + (1-x)*dirac_delta(x), x, 0.5) instead of -1.

Any idea on what might be going on? Thanks!

2017-02-14 14:29:54 +0200 answered a question solve system of non-linear implicit equations numerically

You can try minimizing d using sage.minimize.

2017-02-14 11:51:06 +0200 answered a question Solve a simple system of non-linear equations

You can try minimizing sqrt((sin(x)+y)**2 + (sin(x)-y)**2) using sage.minimize.

2017-02-14 11:47:54 +0200 answered a question Numerical solution of a system of non linear equations

You can try minimizing sqrt(f1(a,b)**2 + f2(a,b)**2) using sage.minimize.

2017-02-14 10:08:03 +0200 received badge  Scholar (source)
2017-02-11 14:36:40 +0200 received badge  Nice Question (source)
2017-02-11 14:24:14 +0200 asked a question defining multivariate piecewise function

I need to define some function like f(x,y) = x * sin(y)/y if y != 0, x otherwise, such that f can be differentiated. Is there a way to do so? Thanks!

2017-02-10 17:12:05 +0200 commented question assign function to an existing function

Thanks! Yes, I prefer python standalone (makes it easier to use other python libraries) with import sage.all as sage (makes it where each function comes from).

2017-02-10 16:54:26 +0200 received badge  Supporter (source)
2017-02-10 15:09:18 +0200 commented question assign function to an existing function

Thanks! Just updated my question. Any idea?

2017-02-10 14:58:59 +0200 received badge  Editor (source)
2017-02-10 14:58:08 +0200 commented question import module in SageMathCloud

It works…thanks!

2017-02-10 14:52:38 +0200 answered a question Access integration constant

For the record, a workaround is to declare var('_C')right before solve(sol, _C).

2017-02-07 17:19:13 +0200 received badge  Student (source)
2017-02-07 15:14:56 +0200 asked a question assign function to an existing function

Hi,

Consider the following code:

sage.var('R')

rho = sage.function('rho')(R)

r = rho(R=R).function(R)

Is there a way to assign some function to rho such that r is modified? For instance, if I do:

y = sage.function('y')(R)

rho = sage.desolve(sage.diff(y,R) - y(R), dvar=y, ivar=R, ics=[0,1]).function(R) -> R |--> e^R

Then I get:

r(0) -> rho(0)

rho(0) -> 1

So rho is of course modified, but not r.

Thanks!

Martin

2017-02-07 14:52:54 +0200 asked a question import module in SageMathCloud

Hi,

In my SMC project, I have two sagemath worksheet. I need to "import" the first one into the second one. Is there a way to do so? Can't figure it out. Thanks!

Martin

2017-02-06 22:45:57 +0200 asked a question Runtime error with libSingular.so

Hi,

I figured out how to import sage.all from a standalone python script, and everything seems to work, but I'm getting this warning/error:

Bug >>Could not get expanded executable from "/usr/lib/sagemath/local/lib/libSingular.so"<< at feResource.cc:429

Any idea what might be going on? Thanks!

Martin

2017-02-02 14:37:45 +0200 asked a question Access integration constant

Hi,

Consider the following code:

x = var('x')

f = function('f')(x)

sol = desolve(diff(f,x), [f,x])

print "sol =", sol

solve(sol, _C)

For which I'm getting NameError: name '_C' is not defined. What would be the right way to set the integration constant after the resolution of the differential equation?

Thanks!