Ask Your Question

koukourikos's profile - activity

2018-09-17 22:30:42 +0200 received badge  Popular Question (source)
2018-06-19 17:09:21 +0200 received badge  Popular Question (source)
2014-01-30 17:28:29 +0200 received badge  Famous Question (source)
2013-09-27 09:50:35 +0200 received badge  Notable Question (source)
2013-08-17 08:05:01 +0200 received badge  Citizen Patrol (source)
2013-08-15 15:07:16 +0200 commented question Animate wireframe in matplotlib using IDLE

take look at Sage Interactions: http://wiki.sagemath.org/interact . The examples there may help you.

2013-08-15 15:03:25 +0200 asked a question Division of polynomial matrices

Is it possible to perform euclidean division between two polynomial matrices in sage? e.g.if $A= \begin{bmatrix} x^2 +1 & x \newline 0&x-1 \end{bmatrix} , B=\begin{bmatrix} x & 2 \newline 1 &x-1 \end{bmatrix}$

are given find the matrices $Q,R$ so $A=QB +R$

in this example the answer is $Q= \begin{bmatrix} x & -1 \newline 0& 1 \end{bmatrix} , R=\begin{bmatrix} 2 & -1 \newline -1 & 0 \end{bmatrix}$

2013-07-01 05:01:08 +0200 received badge  Popular Question (source)
2013-05-24 12:25:35 +0200 commented answer Installing ERROR in Linux Mint 13

You mean this repository https://launchpad.net/~aims/+archive/sagemath right ? I thought it was offline. Thanks for mention it !

2013-05-17 14:50:03 +0200 answered a question Installing ERROR in Linux Mint 13

I can see that your CPU (Intel atom N2600) supports 64bit (You can verify that by using the command:

lscpu | grep Architecture

or visiting this link http://ark.intel.com/products/58916/

So if your Linux Mint installation is 64bit (check it with the following command:)

uname -m

you can just grab the sage-5.9-linux-64bit-ubuntu_12.04.2_lts-x86_64-Linux.tar.lzma file from the 64bit directory from the sage mirror that you use.

Of course if you have installed the 32bit version then you have to upgrade your distribution. In this case its better to go with the 64bit version because as you can see from the 64bit directory their sage packages get support for longer periods.(Ubuntu 8.04 64bit is still in the list !)

2013-03-15 03:25:44 +0200 answered a question How do you solve 3/4+5/8?
2013-02-27 13:17:17 +0200 commented answer 3d Complex function plot

@kcrisman It appears it very easy to get it work in SAGE just adding : plt.savefig('test.png') as last line in my code. Produces the plot in SAGE. source : http://ask.sagemath.org/question/1589/matplotlib-cannot-create-a-graph?answer=2402#2402

2013-02-25 04:10:06 +0200 received badge  Teacher (source)
2013-02-25 04:10:06 +0200 received badge  Self-Learner (source)
2013-02-25 03:37:41 +0200 received badge  Commentator
2013-02-25 03:37:41 +0200 commented answer 3d Complex function plot

Thanks! Matplotlib link was a good place to start my search.

2013-02-25 03:35:13 +0200 answered a question 3d Complex function plot

I found that using matplotlib is quite easy to colour a surface according to whatever function you want. I didn't try to run it inside SAGE but I don’t think that it would be very difficult.

#Complex Sinus function  with coloring based to imaginary part  
# Based on this comment http://stackoverflow.com/a/6543777
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = fig.gca(projection='3d')
X = np.arange(-2*3.14, 2*3.14, 0.1)
Y = np.arange(-2, 2, 0.1)
X, Y = np.meshgrid(X, Y)
R=np.sin(X + 1j*Y)
Z=R.real
T=R.imag
N = np.abs(T/T.max())  # normalize 0..1
plt.title(' $\mathrm{f(z)=sin(z)}$')
plt.xlabel(' $\mathrm{Re(z)}$')
plt.ylabel(' $\mathrm{Im(z)}$')
surf = ax.plot_surface(
    X, Y, Z, rstride=1, cstride=1,
    facecolors=cm.jet(N),
    linewidth=0, antialiased=True, shade=False)
# Colorbar see http://stackoverflow.com/a/6601210
m = cm.ScalarMappable(cmap=cm.jet, norm=surf.norm)
m.set_array(T)
p=plt.colorbar(m)
p.set_label(' $\mathrm{Im(f(z))}$')

fig.set_size_inches(14,7) #http://stackoverflow.com/questions/332289/how-do-you-change-the-size-of-figures-drawn-with-matplotlib
#plt.show() # if you run it as a python script
plt.savefig('test.png')

and the result: http://oi47.tinypic.com/34ijyfs.jpg

2013-02-24 14:18:10 +0200 commented answer 3d Complex function plot

yes it is based on the f(z) which means on the imaginary part of z but I want to be based on the real part of z. In other words I want a plot of f(z)=Im(sin(z)) and its colouring respect to the Re(sin(z)). Sorry for the confusing explanation.

2013-02-24 10:35:43 +0200 commented answer 3d Complex function plot

Thank you. But it's not exactly what I want. Your colouring is based on the y values but I want to be based on the real_part(sin(z)) values

2013-02-24 06:32:06 +0200 commented answer Infimum of a set

I was thinking about the general infimum function... Anyway thank you for your response!

2013-02-24 06:29:57 +0200 asked a question 3d Complex function plot

I want to plot a complex function in 3d. And colour it according to the real or imaginary part as in these pictures. http://functions.wolfram.com/ElementaryFunctions/Sin/visualizations/5/

I know that I can use the complex_plot command to get the 2d plots. But I want the 3d version of the plot like in the above link.

Is there a way to do it with sage ?

2012-10-25 07:11:47 +0200 answered a question Implementing the basic Fourier-Transformation

The integral that you want to calculate it is not so simple because as you can see it evolves the imaginary unit.

I would suggest to define f_0 first and then calculate the integral numerically .

2012-10-25 06:17:20 +0200 asked a question Infimum of a set

Is it possible to find the infimum of a set using sage ?

Definition of infimum

2012-07-06 09:36:01 +0200 commented answer srange bug?

thank you very much I will take a look of it. Its nice to have always something new and interesting to read :)

2012-06-28 06:34:47 +0200 commented answer srange bug?

thank you for your detailed explanation! The exact ring is a good solution. I should have studied more the documentation of srange before asking!

2012-06-28 06:27:00 +0200 commented answer srange bug?

thank you , I always thought that floating point problems occur only when we use number with a lot of non-zero digits in their decimal part but it seams that this is not true. thank you for your suggestion it is even more simpler than using numpy.

2012-06-28 06:18:25 +0200 marked best answer srange bug?

Or e.g.

sage: srange(0,1,.0001)[-10:]
[0.998999999999906, 0.999099999999906, 0.999199999999906, 0.999299999999906, 0.999399999999906, 0.999499999999906, 0.999599999999906, 0.999699999999906, 0.999799999999906, 0.999899999999906]

The point is that these are well within tolerance for 53-bit precision. The numpy stuff is just tricking you with its rounding or something.

sage: R = RealField(100)
sage: srange(R(0),R(1),R(.0001))[-10:]
[0.99900000000000000000000000170, 0.99910000000000000000000000170, 0.99920000000000000000000000170, 0.99930000000000000000000000170, 0.99940000000000000000000000170, 0.99950000000000000000000000170, 0.99960000000000000000000000170, 0.99970000000000000000000000170, 0.99980000000000000000000000170, 0.99990000000000000000000000170]

I'm sure that someone who understands machine numbers better can say why it's these particular numbers, but that's pretty much the story, I believe. Is there any particular reason why 1.14199999999999 would be worse than 1.14200000000000? If so, then you should use an exact ring (see the documentation for srange and do something like

sage: srange(0,1,1/1000)[-10:]
[99/100, 991/1000, 124/125, 993/1000, 497/500, 199/200, 249/250, 997/1000, 499/500, 999/1000]

Good luck!

2012-06-27 21:57:09 +0200 asked a question srange bug?

Lets say that we want a list of the numbers 0,0.001,0.002 ... 2 if we use srange after some values we have rounding errors:

srange(0,2,0.001)
... 1.13799999999999, 1.13899999999999, 1.13999999999999, 1.14099999999999, 1.14199999999999...

why? Is this a bug? A quick solution is to use numpy:

import numpy as np
p=np.arange(0,2,0.001);p

array([  0.00000000e+00,   1.00000000e-03,   2.00000000e-03, ...,
         1.99700000e+00,   1.99800000e+00,   1.99900000e+00])

but the question remains... why srange doesn't work correctly?

(tested on Sage 5.0.1 & 5.0 & 4.7.2)

2012-05-20 07:49:30 +0200 received badge  Scholar (source)
2012-05-20 07:49:30 +0200 marked best answer p.show() at MixedIntegerLinearProgram results

Helloooo everybody !!

Indeed, they are numbered this way just because of the order in which they are created. And there is no specific reason why they are called x. For the code you give as an example, I would not know from the inside of objects p or w that the value is stored in a variable which is named 'w'. Hence I do not know how to make this appear in p.show(). Actually, there is in Sage a way to "name" variables :

sage: p=MixedIntegerLinearProgram()
sage: w=p.new_variable(name="w")
sage: p.add_constraint(-w[0]+2*w[2]+3*w[3]==4)
sage: p.add_constraint(w[0]+w[1]+w[3]==3)
sage: p.set_objective(w[0]- w[1])
sage: p.show()                                                                                                                                                                                                                                                                  
Maximization:
  w[0] -w[1]
Constraints:
  R0: 4.0 <= -w[0] +2.0 w[2] +3.0 w[3] <= 4.0
  R1: 3.0 <= w[0] +w[3] +w[1] <= 3.0
Variables:
  w[0] is a continuous variable (min=0.0, max=+oo)
  w[2] is a continuous variable (min=0.0, max=+oo)
  w[3] is a continuous variable (min=0.0, max=+oo)
  w[1] is a continuous variable (min=0.0, max=+oo)

But there you had to explicitely say that the variables had to be named by "w". Well. Now, this changes nothing to their numbering, and I have no idea how to fix that. In the part of the code that displays the formulas, the keys you used to access the variables have been forgotten a loooong time ago. I agree that the result of p.show() would be muc easier to read though...

2012-05-20 07:49:23 +0200 commented answer p.show() at MixedIntegerLinearProgram results

I think Nathann's solution solves both issues. Maybe the "name" option should be used by default.

2012-05-20 07:47:27 +0200 commented answer p.show() at MixedIntegerLinearProgram results

yes you are right, it has to do with the order. I don't think that this is a bug but I agree that an explanation in the documentation about how the indexing works would be useful.

2012-05-20 07:43:34 +0200 commented answer p.show() at MixedIntegerLinearProgram results

Thank you very much! your trick with the naming made the results to have more sense and the indexing is also correct!

2012-05-20 07:41:01 +0200 received badge  Supporter (source)
2012-05-19 20:55:13 +0200 received badge  Editor (source)
2012-05-19 17:00:54 +0200 asked a question p.show() at MixedIntegerLinearProgram results

I would appreciate it if someone could explain me how the p.show() method works (p=MixedIntegerLinearProgram)... More precisely : lets say we have the following Linear Program:

p=MixedIntegerLinearProgram()
w=p.new_variable()
p.add_constraint(-w[0]+w[2]+2*w[3]==4)
p.add_constraint(w[0]+w[1]+w[3]==3)
p.set_objective(w[0]- w[1]) #<---- Look here

the result from p.show() is

Maximization:
  x_0 -x_3   #<----and here
Constraints:
  4.0 <= -x_0 +x_1 +2.0 x_2 <= 4.0
  3.0 <= x_0 +x_2 +x_3 <= 3.0
Variables:
  x_0 is a continuous variable (min=0.0, max=+oo)
  x_1 is a continuous variable (min=0.0, max=+oo)
  x_2 is a continuous variable (min=0.0, max=+oo)
  x_3 is a continuous variable (min=0.0, max=+oo)

why SAGE shows a different objective function?