Ask Your Question

mrutkuokur's profile - activity

2023-08-07 03:01:46 +0200 received badge  Popular Question (source)
2023-08-07 03:01:01 +0200 asked a question .is_isomorphic() does not work

.is_isomorphic() does not work e = [(3, 4, 5), (5, 6, 7), (7, 8, 1), (1, 3, 6), (1, 4, 7), (3, 5, 8), (1, 3, 6), (4, 6,

2023-06-09 04:35:37 +0200 marked best answer Using lagrange_polynomial() on points with variable coefficients

Is it possible to modify lagrange_polynomial so that it accepts points with variable entries? I was able to make it work on a small example, by disabling the coercion functions in the source file "polynomial_ring.py", but then the program failed on a finite field.

y = var("y")
T = PolynomialRing(QQ, 'x')
f = T.lagrange_polynomial([(0,y),(2,2)])
print(f)

returns:

TypeError: unable to convert y to a rational

Documentation for lagrange_polynomial()

2023-06-07 13:07:58 +0200 edited question Using lagrange_polynomial() on points with variable coefficients

Using lagrange_polynomial() on points with variable coefficients Is it possible to modify lagrange_polynomial so that it

2023-06-07 12:57:21 +0200 received badge  Editor (source)
2023-06-07 12:57:21 +0200 edited question Using lagrange_polynomial() on points with variable coefficients

Using lagrange_polynomial() on points with variable coefficients Is it possible to modify lagrange_polynomial so that it

2023-06-07 02:38:36 +0200 asked a question Using lagrange_polynomial() on points with variable coefficients

Using lagrange_polynomial() on points with variable coefficients Is it possible to modify lagrange_polynomial so that it

2023-05-17 00:34:39 +0200 received badge  Popular Question (source)
2023-01-13 02:15:12 +0200 asked a question Why are the binary trees immutable?

Why are the binary trees immutable? The class BinaryTree is immutable. Is there an advantage to this?

2022-04-16 05:53:50 +0200 marked best answer Two polynomials multiply incorrectly only on my computer

I am using Docker Desktop on Windows 11 to run Sagemath with Macaulay package. The polynomials "F[0]" and "xd" below multiply into "dat" incorrectly (when compared to the correct result on another computer.)

I tried to obtain a minimal example illustrating my problem:

Source Code

import numpy as np
import sympy as sp
import itertools

alpha_2, alpha_01, x_0, x_1, x_2 = var('alpha_2 alpha_01 x_0 x_1 x_2')
y=np.array([x_0, x_1, x_2])

f=np.zeros(shape=(3),dtype=object)
f[0]=alpha_01*(x_0 + x_1 + x_2 )*(x_1 + x_2 ) + alpha_2*x_1*x_2 + (x_0*x_1 + x_0*x_2 + x_1*x_2 )*alpha_01 + 3*(x_0 + x_1 + x_2)^2
f[1]=alpha_01*(x_0 + x_1 + x_2 )*(x_0 + x_2 ) + alpha_2*x_0*x_2 + (x_0*x_1 + x_0*x_2 + x_1*x_2 )*alpha_01 + 3*(x_0 + x_1 + x_2)^2
f[2]=alpha_01*(x_0 + x_1 + x_2 )*(x_0 + x_1 ) + alpha_2*x_0*x_1 + (x_0*x_1 + x_0*x_2 + x_1*x_2 )*alpha_01 + 3*(x_0 + x_1 + x_2)^2

K=[4,1,1]
list2=[0,1,2]

F=np.zeros(shape=(3),dtype=object)     
for p in range(3):
    b=list2[p]
    g=(f[b])^K[b]/y[b]^(2*K[b])*(1/K[b])
    F[p]=(-g.subs({x_0:1})).simplify()    #F[i]=\hat{f}_i

A=sp.zeros(int(2),int(2))    

for i, j in itertools.product(range(2),range(2)):
    A[i,j]=diff( F[i+1], y[list2[j+1]] )

xd=det(A)

xd=1*xd #turns type <class 'sympy.core.add.Add'> into <class 'sage.symbolic.expression.Expression'>
#https://doc.sagemath.org/html/en/reference/calculus/sage/calculus/test_sympy.html

print("F[0]=",F[0].expand())
print( " ---------------------------------- " )

print("xd=",xd.expand())

dat=F[0]*xd
dat=expand(dat)
print( " ---------------------------------- " )

print("DAT=F[0]*xd=",dat)

This program works fine on another computer. The result I get on my computer has a summand "-alpha_01^6x_1^11x_2^3". In a correct expansion of "dat", the summand "...+ -alpha_01^6x_1^11x_2^3+..." must not appear.

Note: I tried using polynomial rings instead of symbolic variables, but differentiation operation is not defined for polynomial rings.

2022-04-16 05:08:02 +0200 commented question Two polynomials multiply incorrectly only on my computer

As you recommended, I started with rational functions, and using derivatives and determinants that are already defined,

2022-04-16 04:59:32 +0200 commented question Two polynomials multiply incorrectly only on my computer

As you recommended, I started with rational functions, and using derivatives and determinants that are already defined,

2022-04-12 22:15:27 +0200 received badge  Organizer (source)
2022-04-12 22:13:02 +0200 asked a question Two polynomials multiply incorrectly only on my computer

Two polynomials multiply incorrectly only on my computer I am using Docker Desktop on Windows 11 to run Sagemath with Ma

2022-04-08 03:56:55 +0200 asked a question Two polynomials multiply incorrectly

Two polynomials multiply incorrectly I am using Docker Desktop on Windows 11 to run Sagemath with Macaulay package. The

2022-03-21 00:35:50 +0200 received badge  Supporter (source)
2022-02-04 00:33:35 +0200 received badge  Nice Question (source)
2022-02-02 22:56:22 +0200 marked best answer Infinitely many variables

Is there a way to define infinitely many variables? At the moment, I am able to define arbitrarily big number of symbolic variables, x[i], using a code as follows:

N=3
x=np.zeros(shape=(N),dtype=object)
for i in range(N):
    x[i]=var('x_', n=N )[i]

I would like to be able to define x_i for i=1,2,... Is this possible using the symbolic ring?

2022-02-02 22:56:22 +0200 received badge  Scholar (source)
2022-02-02 22:39:56 +0200 received badge  Student (source)
2022-02-02 22:34:46 +0200 asked a question Infinitely many variables

Infinitely many variables Is there a way to define infinitely many variables? At the moment, I am able to define arbitr