Ask Your Question

ablmf's profile - activity

2019-12-11 16:46:09 -0500 commented question The annulus problem in linear programming

Can you draw a picture to show the solution is wrong? Also can you try different algorithms? Also you can directly use scipy to solve the problem.

2019-12-11 16:21:21 -0500 commented question Solve set of equations with all unique values in sage

You probably should use a SMT solver like z3.

2019-09-19 01:47:01 -0500 received badge  Notable Question (source)
2019-06-09 12:44:02 -0500 received badge  Famous Question (source)
2019-04-12 02:41:59 -0500 commented answer How to write a standalone cython script?

Actually, I found that you can write a Cython program with .spyx extension and run it with sage. sage will compile it first and then run the compiled program. This is not efficient if we have to run the script many times. But it is fine for me since I am running a very long simulation and the compilation time of the program is negligible.

2019-04-11 11:10:44 -0500 asked a question How to write a standalone cython script?

To use Cython in sage, according to the document, you can either write Cython code in a sage notebook, load a .spyx file from command line, or create a .pyx file and add it to the sage library.

My question is, can we write a standalone cython script and run it with sage? Just like a normal sage standalone script.

2019-01-15 00:25:49 -0500 received badge  Notable Question (source)
2019-01-07 08:37:35 -0500 received badge  Popular Question (source)
2018-12-14 09:31:10 -0500 received badge  Popular Question (source)
2018-12-07 00:28:58 -0500 received badge  Nice Question (source)
2018-12-06 09:15:34 -0500 asked a question How to substitute differential operator?

Let's say I am taking derivatives of an expression involving unknow function.

var('x,a,b');

f=(x^(a+b)).function(x,a,b);

h=function('h',nargs=1)(x);

g=h(f(x,a,b));

dg=diff(g,x);

dg

This gives the output

(a + b)*x^(a + b - 1)*D[0](h)(x^(a + b))

How do I replace D[0](h)(x^(a + b)) with something like direvative_of_h(x^(a + b))? In this simple case, I can just do this manually using .operands, but if I have a rather complicated equation, how I can I do it?

2018-12-06 09:15:21 -0500 asked a question Substitute differential operators in an expression.

Let's say I am taking derivatives of an expression involving unknow function.

var('x,a,b');

f=(x^(a+b)).function(x,a,b);

h=function('h',nargs=1)(x);

g=h(f(x,a,b));

dg=diff(g,x);

dg

This gives the output

(a + b)*x^(a + b - 1)*D[0](h)(x^(a + b))

How do I replace D[0](h)(x^(a + b)) with something like direvative_of_h(x^(a + b))? In this simple case, I can just do this manually using .operands, but if I have a rather complicated equation, how I can I do it?

2018-05-20 00:15:55 -0500 received badge  Popular Question (source)
2017-12-30 19:21:15 -0500 received badge  Notable Question (source)
2017-12-30 19:21:01 -0500 received badge  Famous Question (source)
2017-12-30 19:12:49 -0500 commented question How to solve this equation with double square root?

This has two solutions in $\mathbb C$, $\pm \sqrt{2\sqrt{3}-3}/2$.

2017-12-30 19:00:00 -0500 asked a question How to solve this equation with double square root?

I am trying to solve this equation in sage $$ \sqrt{-4 \, z^{2} + 2 \, \sqrt{-4 \, z^{2} + 1} - 1} = 0. $$ But when I try the code

var('z')
eq = sqrt(-4*z^2 + 2*sqrt(-4*z^2 + 1) - 1) == 0
solve(eq,z)

I get

[z == -1/2*sqrt(2*sqrt(-4*z^2 + 1) - 1), z == 1/2*sqrt(2*sqrt(-4*z^2 + 1) - 1)]

Is there any way to actually solve it in sage?

2017-11-03 12:15:06 -0500 received badge  Notable Question (source)
2017-11-03 12:15:06 -0500 received badge  Popular Question (source)
2017-10-19 04:02:44 -0500 received badge  Popular Question (source)
2017-07-27 08:56:47 -0500 received badge  Popular Question (source)
2017-06-21 02:36:32 -0500 asked a question How to simplify 1-cos(u)^2.

I have tried

sage: assume(0<u<pi/2)

But I still get

sage: simplify(1-cos(u)^2)
-cos(u)^2 + 1
2017-06-19 01:57:54 -0500 asked a question Finding zeros of zeta function.

I am trying to make the following code work.

t = var('t')
f = zeta(1/2+i*t).abs()
ff = fast_callable(f, vars=[t], domain=CDF)
print find_root(ff, 0, 40)

There are actually 6 roots between 0 and 40. But find_root could not find any of them. Is there any walkaround?

2017-06-06 03:38:46 -0500 asked a question How to get series expansion of function with symbolic parameter.

Let $$h(t) = \frac{\sinh(t)}{t}.$$ Let $$ f_i(t) = h\left(\frac{t}{2^i} \right)^{2^i}, $$ where $i\ge 0$ is an integer.

Is there anyway to get a series expansion of $f_i(t)$ without replacing $i$ with a fixed integer?

2017-06-03 04:46:54 -0500 asked a question How to increase precision of numeric integraion?

I am trying to evaluate an integral numeraically like this

sage: s = integrate(t*sin(t)/(1+cos(t)^2), t, 0, pi)
sage: s.n(prec=100)
2.4674011002723395
sage: s.n(prec=1000)
2.4674011002723395

As you can see, increasing prec does not give me more precise result. Is there any way to get more digits ?

2017-04-06 10:30:33 -0500 asked a question How to simplify fractions?

I have the following expression $$ \frac{\left(-1\right)^{n} - 2 n - 1}{4 {\left(2 n + 1\right)}} $$ It clearly equals $$ \frac{\left(-1\right)^{n}}{4 {\left(2 n + 1\right)}} -\frac 1 4. $$

Is there anyway to make sage show this?

2017-03-17 18:47:33 -0500 commented answer How to sort terms in symbolic expression of polynomial?

How to convert a symbolic polynomial to a member of polynomial ring? Does sage has such a function?

2017-03-15 11:24:42 -0500 asked a question How to sort terms in symbolic expression of polynomial?

I have a symbolic expression in the following form

s =2*z^3 + z^2 + z

How can I tell sage to print s as the following form?

z + z^2 +  2*z^3
2017-02-07 11:23:28 -0500 received badge  Notable Question (source)
2016-06-02 17:27:36 -0500 received badge  Popular Question (source)
2016-01-21 08:08:45 -0500 asked a question Error message when starting sage 6.10 on ubuntu

I installed sage 6.10 through

sudo apt-get install sagemath-upstream-binary-full

on my ubuntu machine.

When I start sage shell, I got

patching /usr/lib/sagemath/src/build/cythonized/sage/structure/list_clone.c
Traceback (most recent call last):
  File "/usr/lib/sagemath/relocate-once.py", line 85, in <module>
    p('src/build/cythonized/sage/structure/list_clone.c').substitute().save()
  File "/usr/lib/sagemath/relocate-once.py", line 51, in save
    with open(self.filename, 'wb') as f:
IOError: [Errno 13] Permission denied: '/usr/lib/sagemath/src/build/cythonized/sage/structure/list_clone.c'

Is this going to be a problem?

2016-01-17 14:33:48 -0500 received badge  Supporter (source)
2016-01-12 12:53:19 -0500 received badge  Nice Question (source)