Ask Your Question

daviddgl's profile - activity

2023-11-03 17:20:27 +0200 received badge  Famous Question (source)
2023-01-25 17:41:02 +0200 received badge  Famous Question (source)
2023-01-25 17:41:02 +0200 received badge  Notable Question (source)
2023-01-25 17:41:02 +0200 received badge  Popular Question (source)
2022-12-05 09:43:57 +0200 received badge  Popular Question (source)
2021-03-08 21:42:11 +0200 received badge  Notable Question (source)
2020-08-04 09:20:52 +0200 received badge  Famous Question (source)
2020-05-01 13:17:59 +0200 received badge  Popular Question (source)
2018-12-18 15:44:56 +0200 received badge  Famous Question (source)
2018-08-22 17:10:25 +0200 received badge  Notable Question (source)
2018-06-28 17:12:15 +0200 received badge  Popular Question (source)
2018-06-28 17:12:15 +0200 received badge  Notable Question (source)
2017-03-22 05:50:35 +0200 received badge  Popular Question (source)
2016-12-19 20:04:05 +0200 received badge  Nice Question (source)
2016-12-18 17:56:30 +0200 asked a question What is the difference between show() and view() in sage?

What is the difference between show() and view() in sage?

A=matrix([v1,v2,v3]);show(A); view(A)

looks like the same... is there any difference between these two?

For the screen shot click here.

image description

2016-11-30 04:42:54 +0200 commented answer Why show() is not working when we are using with print?

@kcrisman Is there anyway to achieve the requirement.. I wanted to show the output in matrix form not the output given by sage usually.

print "the matrix is"; show(A)

is working in one cell but not in the other..

I was not able to identify the bug(or mistake) in the front end.

2016-11-30 03:34:53 +0200 asked a question Why show() is not working when we are using with print?

Why show() is not working when we are using with print?

I have written a program to find a matrix as a result.

When I have finished and was tring to polish the output, I ended up the situation to use,

print " The matrix is ", show(A)

The output is just

The matrix is

its not giving the matrix.

if I use show() without print function, its giving the matrix.

How to fix this issue??

Thanks for helping..

Workdone:

As William Stein has given in his answer, I have used,

sys.stdout.flush()

after print function. But it didnt help me.

I will give my subroutine, since if there is any bug in the code also give a bug in show() funciton.

A=matrix(Integers(12),[[1,0,3,1],[0,2,0,3],[0,0,6,1],[0,0,0,2]])
S24=[[0,1],[0,2],[0,3],[1,2],[1,3],[2,3]]
C2=zero_matrix(Integers(12),6,6)
for i in range(6):
    for j in range(6):
        C2[i,j]=A.matrix_from_rows_and_columns(S24[i],S24[j]).det()
print "The compound matrix C2(A)=", '\n'
sys.stdout.flush()
show(C2)
2016-10-25 19:31:14 +0200 asked a question How to find a generalized inverse of a vector in sagemath?

Given a vector $u$ of size $n\times 1 $. How to find the g-inverse of $u$?

Is there any specific command like

u.ginv()

to find the ginverse or we have define it?? If so, how to do that?

Any hint will help me lot.

Defn:

for a vector $u_{n\times 1} $ a vector $v_{1\times n}$ is said to be generalized inverse of $u$ if $$uvu=u.$$

2016-08-30 08:53:13 +0200 received badge  Editor (source)
2016-08-30 08:15:37 +0200 asked a question How to get step by step table in Simplex method in sagemath?

I have used the following commands to solve a linear programing problem in sagemath.

>p = MixedIntegerLinearProgram(maximization=True, solver='GLPK')
>x = p.new_variable(nonnegative=True)
> p.set_objective(12*x[0] + 3*x[1]+x[2])
> p.add_constraint(10*x[0] + 2*x[1]+x[2]<= 100) 
>p.add_constraint(7*x[0] +3*x[1]+2*x[2] <= 77)
> p.add_constraint(2*x[0] + 4*x[1]+x[2] <= 80)
> p.show() 
> print 'The optimal value:', QQ(p.solve())

It solved and gave the answer. But I want to generate a step by step table to explain to the students.

Is there any possible way to get the step by step table? or should we have to modify the program to do so?

2016-05-19 04:06:31 +0200 commented answer How to define a polynomial which can take matrix ?

Thank you so much..

2016-05-19 04:06:06 +0200 received badge  Scholar (source)
2016-05-19 04:06:04 +0200 received badge  Supporter (source)
2016-05-18 22:11:34 +0200 received badge  Nice Question (source)
2016-05-18 20:33:49 +0200 asked a question How to define a polynomial which can take matrix ?

I want to define a matrix valued function. for example..

If I have a polynomial of a matrix with me say $f(x)$ and I want to check $f(A)$. What can be done better? The following will work for numbers but not for matrix.

var('x')
f(x)=2x^2+x+3 
print f(A)# this is what I want as an answer..

**

In the above if I want to replace my x by a matrix what I have to do?

**

So, ultimate aim is to find define a polynomial which can take matrix Thanks in advance...

2016-03-13 12:54:42 +0200 received badge  Student (source)
2016-03-13 11:59:22 +0200 asked a question How to enumerate the generalised inverse of given matrix?

Let $A$ be a given singular matrix over a finite field. Then how to enumerate the solutions of the system of equation

$$Ax=b, b \in R(A), \text{range of } A $$

Since, $A$ is singular matrix I can find the generalized inverse $G$ (i.e., AGA=A) of $A$ . Note that, $Gb$ is one of the solution. And so the set of all solution can be written as $${Gb+(I-GA)u: u \text{ is arbitrary }}$$

Now, how to incorporate these ideas in sagemath?

I am a newbie to sagemath. So, the answerers kindly give me with the details.

Thanks in advance.