Ask Your Question

vidyarthi's profile - activity

2024-04-27 16:17:25 +0200 received badge  Popular Question (source)
2024-02-29 20:31:00 +0200 received badge  Notable Question (source)
2024-02-19 03:47:24 +0200 received badge  Popular Question (source)
2023-11-29 12:50:46 +0200 commented answer How can I count the number of cycles of special length in a graph in sage?

The subgraph_cound should be subgraph_count. Similarly for cycle_subgraph_cound.

2023-08-22 17:46:22 +0200 marked best answer Factorizing matrix entries that are polynomials

Suppose i have a polynomial matrix like:

var('x')
g=graph.CompleteGraph(4)
h=g.am()
t=h-x*identity_matrix(4)
t1=t.adjugate()
t1

Then, how do i get t1 in the factorized/simplified form. Specifically, I see that there are exactly two distinct entries in t1, and each of them can be factorized into two distinct monomial powers. But, how do I get this directly, without having to factorize each element separately. Any hints? Thanks beforehand.

2023-08-22 17:46:03 +0200 answered a question Factorizing matrix entries that are polynomials

Thanks to @MaxAlexseyev, to get what I wanted, which is the adjugate matrix having all its individual entries factored,

2023-08-22 17:44:20 +0200 commented answer Factorizing matrix entries that are polynomials

Got it! I used t1.apply_map(lambda z:factor(z))to get what I wanted.

2023-08-22 17:37:08 +0200 commented answer Factorizing matrix entries that are polynomials

Thanks! I actually wanted to factorize each of the individual matrix entries. On writing factor(t1.list()), I get error

2023-08-22 14:25:39 +0200 asked a question Factorizing matrix entries that are polynomials

Factorizing matrix entries that are polynomials Suppose i have a polynomial matrix like: var('x') g=graph.CompleteGraph

2023-08-19 15:51:35 +0200 marked best answer Extracting specific rows of a matrix

Suppose I have a matrix A which is m x n in order. How do I extract a submatrix of specified rows and colums from A. Like I want a p x q submatrix of A. Will the expanded_submatrix method help in this regard? Thanks beforehand.

2023-08-16 00:59:45 +0200 answered a question Extracting specific rows of a matrix

The syntax was unexpectedly easy. It is similar to the one used in Matlab/Octave. We just use the syntax A[i-1:p,j-1:q],

2023-08-16 00:46:36 +0200 asked a question Extracting specific rows of a matrix

Extracting specific rows of a matrix Suppose I have a matrix A which is m x n in order. How do I extract a submatrix of

2023-08-16 00:41:58 +0200 commented question Representing Code over integer rings

@dan_fulea Modified the question. Added a reference. At least, if there was a workaround when q or n in this question is

2023-08-16 00:40:45 +0200 edited question Representing Code over integer rings

Representing Code over integer rings Is there a method to deal with all codewords over the integer rings Z_n where n=p^

2023-08-10 11:51:25 +0200 received badge  Popular Question (source)
2023-08-05 18:37:55 +0200 received badge  Famous Question (source)
2023-08-01 14:00:22 +0200 commented question Representing Code over integer rings

@dan_fulea By codewords I mean a submodule over the ring [math]\mathbb{Z}_n[/math]. And yes, it is best to get them as a

2023-08-01 14:00:04 +0200 commented question Representing Code over integer rings

@dan_fulea By codewords I mean a submodule over the group [math]\mathbb{Z}_n[/math]. And yes, it is best to get them as

2023-08-01 11:30:30 +0200 marked best answer How to remove radicals from an equation

If an equation has several radicals, is it possible to remove the radicals to get a radical free equation in SageMath? The simplify_radical() method seems not to exist in SageMath. The canonicalize_radical() seems to do nothing. For example,

E=a^2 + b^2 + c^2 + sqrt(a^2 + b^2 + c^2)==0
E.canonicalize_radical()

gives the output same as E

Any alternative? Thanks beforehand.

2023-08-01 11:28:42 +0200 commented question Representing Code over integer rings

@dan_fulea By codewords I mean the module over the group [math]\mathbb{Z}_n[/math]. And yes, it is best to get them as a

2023-07-31 19:42:18 +0200 edited question How to remove radicals from an equation

How to remove radicals from an equation If an equation has several radicals, is it possible to remove the radicals to ge

2023-07-31 19:33:02 +0200 edited question How to remove radicals from an equation

How to remove radicals from an equation If an equation has several radicals, is it possible to remove the radicals to ge

2023-07-31 19:27:41 +0200 commented answer How to remove radicals from an equation

But that dosent seem to work

2023-07-31 18:09:21 +0200 asked a question Representing Code over integer rings

Representing Code over integer rings Is there a method to deal with all codewords over the integr rings Z_n wheren=p^k

2023-07-31 17:51:11 +0200 asked a question How to remove radicals from an equation

How to remove radicals from an equation If an equation has several radicals, is it possible to remove the radicals to ge

2023-07-31 17:43:30 +0200 commented question eliminating fractions and roots from equations

The method simplify_radical() does not seem to exist

2023-07-15 17:43:54 +0200 received badge  Notable Question (source)
2023-07-08 08:46:30 +0200 commented question Plotting a Probability distribution with varying parameter

@EmmanuelCharpentier The accepted answer is exactly what I wanted to do.

2023-07-08 08:43:44 +0200 marked best answer Plotting a Probability distribution with varying parameter

Suppose I wish to plot the function

import numpy as np
var('a,y') 
A=np.linspace(-1,1,10)
for a in A:
    z=a+x-(e^(-y^2/2))/sqrt((2*pi))
    plot3d(z,(x,-1,1),(y,-1,1))

That is, I wish to plot the function z over a range of a. Actually the original function was z=a+x. But, in order to introduce randomization, I changed the variable x to x-y', where y' is the standard normal variable. I wish to obtain the plot of z as a kind of variable probability distribution over the grid of x and y with the variation of a (so kind of series of probability distributions overlapping each other). How do I do this? Any hints? Thanks beforehand.

2023-07-07 12:35:08 +0200 edited question Plotting a Probability distribution with varying parameter

Plotting a Probability distribution with varying parameter Suppose I wish to plot the function import numpy as np var('

2023-07-07 12:34:47 +0200 edited question Plotting a Probability distribution with varying parameter

Plotting a Probability distribution with varying parameter Suppose I wish to plot the function import numpy as np var('

2023-07-07 12:34:34 +0200 edited question Plotting a Probability distribution with varying parameter

Plotting a Probability distribution with varying parameter Suppose I wish to plot the function import numpy as np var('

2023-07-07 12:32:51 +0200 asked a question Plotting a Probability distribution with varying parameter

Plotting a Probability distribution with varying parameter Suppose I wish to plot the function import numpy as np var('

2023-06-10 22:57:46 +0200 received badge  Popular Question (source)
2023-04-21 12:36:58 +0200 asked a question How is edge coloring satisfied in this code?

How is edge coloring satisfied in this code? I saw the beautiful code written on this site of using Mixed Integer Linear

2023-04-05 00:43:40 +0200 received badge  Popular Question (source)
2023-03-14 16:33:43 +0200 marked best answer Graph polynomial construction

I wish to construct the graph polynomial (as given here) of any given graph. To do so, I wrote the following code. But, the output was null. What needs to be modified in the following code to get the appropriate graph polynomial (the product of binomials corresponding each edge):

 def grappoly(G):
 R=PolynomialRing(ZZ,['x_'+str(k) for k in G.vertices()])
 R.inject_variables()
 for i in G.vertices():
      for j in G.vertices():
           P=1
           if set((i,j)).intersection(set(G.edges()))==(i,j):
                         P=('x_'+str(i)-'x_'+str(j))*P
           return P           
 X=graphs.CompleteBipartiteGraph(5,5)
 grappoly(X)

Thanks beforehand.

2023-03-14 12:54:42 +0200 answered a question Graph polynomial construction

The code required the following modifications after which it worked smoothly: def grappoly(G): R=PolynomialRing(ZZ,[

2023-03-14 12:29:58 +0200 received badge  Popular Question (source)
2023-03-14 12:16:42 +0200 edited question Graph polynomial construction

Graph polynomial construction I wish to construct the graph polynomial (as given here) of any given graph. To do so, I w

2023-03-14 12:09:13 +0200 edited question Graph polynomial construction

Graph polynomial construction I wish to construct the graph polynomial (as given here of any given graph. To do so, I wr

2023-03-14 12:08:10 +0200 edited question Graph polynomial construction

Graph polynomial construction I wish to construct the graph polynomial (as given here of any given graph. To do so, I wr

2023-03-14 12:01:23 +0200 edited question Graph polynomial construction

Graph polynomial construction I wish to construct the graph polynomial (as given here of any given graph. To do so, I wr