ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 20 Nov 2022 16:48:18 +0100Solve a system of equation but shown variable is not defined.https://ask.sagemath.org/question/64949/solve-a-system-of-equation-but-shown-variable-is-not-defined/ I am trying to solve a system of equations as follows.
for i in range(1,4):
for j in range(1,4):
var('y'+'_'+str(j)+'_'+str(i))
var('x'+'_'+str(j)+'_'+str(i))
t3=[x_1_1*x_1_2*x_2_3/((x_1_1 + 1)*(x_2_3 + 1)),
x_2_1*(x_3_1 + 1)/(x_1_1*x_2_1*x_3_1 + x_1_1*x_2_1 + x_1_1 + 1),
(x_1_1 + 1)/(x_1_1*x_2_1*(x_3_1 + 1)),
1/x_2_3,
(x_3_1*x_3_2 + x_3_1 + 1)*(x_1_1 + 1)*x_2_2*(x_2_3 + 1)/(x_3_1 + 1),
(x_1_1*x_2_1*x_3_1 + x_1_1*x_2_1 + x_1_1 + 1)*x_3_2/((x_3_1*x_3_2 + x_3_1 + 1)*(x_1_1 + 1)),
x_1_3*(x_2_3 + 1),
x_2_3*x_3_1*x_3_2*x_3_3/((x_3_1*x_3_2 + x_3_1 + 1)*(x_2_3 + 1)),
(x_3_1 + 1)/(x_3_1*x_3_2)]
Now define
a1=[]
va=[]
for i in range(1,4):
for j in range(1,4):
a1.append(y[j,i])
va.append(x[j,i])
print(va)
print(a1)
#print(len(a1))
a2=[]
a3=[t3[i]-a1[i] for i in range(len(a1))]
print(a3)
solve(a3, va)
But it is shown that ``NameError: name 'y' is not defined''. How to avoid this problem? Thank you very much!lijr07Sun, 20 Nov 2022 16:48:18 +0100https://ask.sagemath.org/question/64949/solve_mod() takes long time and no result return when computing big numbershttps://ask.sagemath.org/question/64600/solve_mod-takes-long-time-and-no-result-return-when-computing-big-numbers/when I use solve_mod to solve equations like slove_mod([3*x + 2*y == 5,6 * x + 5 * y ==11],13),it will return a result quickly . However,when i use it like solve_mod([9677035*x + 7162589 *y == 4477085 ,5302728*x + 8472081*y == 11061226],14282531),it takes long time but no result return, i was wondering whether solve_mod()'s alogrithm is horrible when big numbers are computed.Is there a faster way to solve big numbers equation?
charleyhootTue, 25 Oct 2022 15:02:04 +0200https://ask.sagemath.org/question/64600/Strange problem with Solve functionhttps://ask.sagemath.org/question/62372/strange-problem-with-solve-function/I am running into a strange issue when trying to solve an equation, which seems pretty simple to solve. When I ask SAGE preform
x=var('x')
solve(1630*x^3 + 2991*x^2 + 1628*x + 1==0, x)
Everything goes fine, and it gives me the roots of the equation. However, when I ask it to do the same for a larger equation, I get this:
x=var('x')
solve(1953125*x^5 + 6793750*x^4 + 5942255*x^3 + 8749866*x^2 + 5857878*x + 1==0, x)
and the result is:
[0 == 1953125*x^5 + 6793750*x^4 + 5942255*x^3 + 8749866*x^2 + 5857878*x + 1]
And I do not understand why. I even checked using WolframAlpha, and the issue is not that this equation has no roots. Indeed, WolframAlpha was able to solve this equation with no issues.
What is the issue here? What am I missing?RuneMon, 09 May 2022 19:02:02 +0200https://ask.sagemath.org/question/62372/Solve an equation with variable under square-roothttps://ask.sagemath.org/question/61803/solve-an-equation-with-variable-under-square-root/ I want to solve $p=h+\sqrt{\dfrac{p\cdot\left(1-p\right)}{n}}$ for $p$. <br>
This works with <br>
**In:**
eqn = (p-h)^2==p*(1-p)/n
solve(eqn, p)
**Out:**
[p == 1/2*(2*h*n - sqrt(-4*(h^2 - h)*n + 1) + 1)/(n + 1), p == 1/2*(2*h*n + sqrt(-4*(h^2 - h)*n + 1) + 1)/(n + 1)]
But this works *not* with
**In:**
eqn1 = p-h==sqrt(p*(1-p)/n)
solve(eqn1, p)
**Out:**
[p == h + sqrt(-(p^2 - p)/n)]
**How can I solve the *root-equation* directly?**
vertangSun, 03 Apr 2022 17:58:43 +0200https://ask.sagemath.org/question/61803/Solve with the assumption z!=0https://ask.sagemath.org/question/61172/solve-with-the-assumption-z0/ When I try to solve the following with the assumption z is nonzero solve still outputs the solution with z=0:
assume(z!=0)
solve([x,y*z],x,y,z,solution_dict=True)
Output:
[{x: 0, y: r79, z: 0}, {x: 0, y: 0, z: r80}]dddFri, 18 Feb 2022 04:09:14 +0100https://ask.sagemath.org/question/61172/How can I easily create and handle polynomials with symbolic coefficients?https://ask.sagemath.org/question/60439/how-can-i-easily-create-and-handle-polynomials-with-symbolic-coefficients/ I would like to create polynomial functions with symbolic (yet unknown) coefficients, like:
p(x)=a*x^5 + b*x^4 + c*x^3 + d*x^2+e*x+f
Then I would like to experiment with the degree and thus the number of coefficients, for example:
p(x)=a*x^7 + b*x^6 + c*x^5 + d*x^4+e*x^3+f*x^2+g*x+h
The problem is I always have to explicitely declare the coefficients, as variables, like:
var("a b c d e f g h")
So I should always have to enumerate them by hand.
Isn't exist some automatism to do this? For example:
Polynomial(x,degree=7)
and it would return
c0*x^7 + c1*x^6 + c2*x^5 + c3*x^4+c4*x^3+c5*x^2+c6*x+c7
Sometimes I also would like to query the coefficients, to solve an equation system, which contains those coefficients:
p(x)=a*x^7 + b*x^6 + c*x^5 + d*x^4+e*x^3+f*x^2+g*x+h
eq=[
derivative(p(x),x).subs(x=0)==0,
derivative(p(x),x,2).subs(x=0)==0,
p(x=0)==0,
p(x=x0)==1,
p(x=1)==1+z,
derivative(p(x),x).subs(x=1)==0,
derivative(p(x),x,2).subs(x=1)==0,
derivative(p(x),x).subs(x=x0)==1
]
s=solve(eq,a,b,c,d,e,f,g,h)
Again, when calling solve(), I have to explicitly enumerate the coefficients again, instead of some shortcut, like:
s=solve(eq,p(x).coefficients())
When I try to experiment with the degree of my polynomial p(x), to try out a higher or lower degree, and with more or less equations in the system, I always have to declare my coefficients as vars again and again, which is very annoying.
Furthermore when I tried to query coefficients by, eg.:
p.coefficient(x)
or
p.coefficient(x^3)
The first returns "g" as the coefficient, which is good. But how can I access or query the "free" coefficient, "h" which isn't multiplied by x?
p.coefficient(0)
Doesn't return anything. If it would return the free coeff, then I could get the coefficients by calling a map() with lambda function.
KonstantinSat, 25 Dec 2021 23:19:49 +0100https://ask.sagemath.org/question/60439/complex numbers and paramétric numbershttps://ask.sagemath.org/question/59914/complex-numbers-and-parametric-numbers/ hi
this program works well for me, i want the critical points but only if real
but my condition if(x.imag()!=0) doesnt work properly if x is a "r_something"
and, of cours, a solution like (x,y)=(r12,r37) interests me, i want it to be displayed
but as maybe Sagemath consider r12 and r37 aspossibly being complex, is does not display it
how can i test if a number is a parametric number ?
f(x,y)=(x+y)^2
# calculs généraux
from sage.manifolds.operators import *
E.<x,y> = EuclideanSpace()
F = E.scalar_field(f)
H=f(x,y).hessian()
show(html("<h5>paramètres généraux</h5>"))
T=table([["f",f],["grad f=",grad(F)[:]],["H=",H]],frame=True,align='center')
show(T)
# calcul des points critiques
Cr= solve([grad(f)[0]==0,grad(f)[1]==0],[x,y],solution_dict=True)
#liste=[["x","y","H"]]
liste=[]
for critique in Cr:
show("tttt",critique)
if(x(critique).imag()==0 and y(critique).imag()==0):
liste.append(["(","x=",x(critique),";","y=",y(critique),")",H(critique)])
show(html("<h5>points critiques</h5>"))
if (len(liste)!=0):
show(table(liste))
else :
show("pas de points critiques")ErWinzTue, 23 Nov 2021 15:27:58 +0100https://ask.sagemath.org/question/59914/Solving equationhttps://ask.sagemath.org/question/59316/solving-equation/ To encourage buyers to place 100-unit orders, your firm’s sales department applies a continuous discount that makes the unit price as a function P(x) of the number of unites ordered. The discount decreases the prices at the rate EUR 0.01 per unit ordered. The price per unit for a 100-unit order is P(100) = 20.09 EUR.
(a) Find P(x) by solving the equation
P′(x) = − 1/100 P(x), P(100) = 20.09.
(b) Find the unit price P(10) for a 10-unit order and P(90) for a 90-unit order.
(c) The sales department has asked you to find out if it is discounting so much that the firm’s revenue, r(x) = xP(x), will actually be less for a 100-unit order than, say, for a 90-unit order. Reassure them by showing that r(x) has its maximum value at x = 100.
(d) Graph the revenue function r(x) = xP(x) for 0 ≤ x ≤ 200.JCMSun, 10 Oct 2021 16:42:46 +0200https://ask.sagemath.org/question/59316/Solving equationshttps://ask.sagemath.org/question/59315/solving-equations/ To encourage buyers to place 100-unit orders, your firm’s sales department applies a continuous discount that makes the unit price as a function P(x) of the number of unites ordered. The discount decreases the prices at the rate EUR 0.01 per unit ordered. The price per unit for a 100-unit order is P(100) = 20.09 EUR.
(a) Find P(x) by solving the equation
P′(x) = − 1/100 P(x), P(100) = 20.09.
(b) Find the unit price P(10) for a 10-unit order and P(90) for a 90-unit order.
(c) The sales department has asked you to find out if it is discounting so much that the firm’s revenue, r(x) = xP(x), will actually be less for a 100-unit order than, say, for a 90-unit order. Reassure them by showing that r(x) has its maximum value at x = 100.
(d) Graph the revenue function r(x) = xP(x) for 0 ≤ x ≤ 200.JCMSun, 10 Oct 2021 16:41:28 +0200https://ask.sagemath.org/question/59315/Partial derivatives and polar coordinateshttps://ask.sagemath.org/question/59125/partial-derivatives-and-polar-coordinates/Hi
Easy by hand but difficult (for me !) with SageMath
how to get this equation `dth==X*dty/r^2-Y*dtx/r^2` from the code below with SageMath ?
var('theta,X,Y,r')
var('dth',latex_name=r"\partial {\theta}")
var('dtx',latex_name=r"\partial {x}")
var('dty',latex_name=r"\partial {y}")
eqL=[]
eq0=r^2==X^2+Y^2
theta=atan(Y/X)
dthX=derivative(theta,X)*dtx
dthY=derivative(theta,Y)*dty
eq1=dth==dthX+dthY
show("dthY : \t ", dthY," \t dthX : \t ",dthX," \t dth : \t ",eq1)ortolljThu, 23 Sep 2021 09:18:40 +0200https://ask.sagemath.org/question/59125/How to change variables in differential equation?https://ask.sagemath.org/question/58133/how-to-change-variables-in-differential-equation/Hey guys,
I'd like to find a way to make a change of variables in diff equation(why is there no intrinsic method?)
My attempt:
Assume that I have some random equation :
G=function('G')
F=G(r)*e^(-I*w*t)
equa = diff(F,r,2)+diff(F,t)F
and let's say I'd like to change the variable r to z = r^2 - a^2.
The way I do it now is using the following trick:
var('z')
p=solve(z==(r^2-a^2) ,r)
T = function('T')(z)
final = equat.substitute_function(G,T).subs(r=p[0].rhs()).full_simplify()
It gives the following depreciation message:
DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...)
It's very clumsy, but at least it is working.
But that is not it. The following code just gives rubbish output using more or less the same logic
var('m')
exm = function('exam')(x,y)
diffequ= diff(exm,x)
diffexp= function('probe')(m+y^2,y/x)
diffequ.substitute_function(exam,diffexp)
output:
D_0(probe)(y^2+x,1)
Which is just plain wrong!
Is there a way to work around those problems?litvathWed, 28 Jul 2021 02:17:33 +0200https://ask.sagemath.org/question/58133/assume causes a solving failurehttps://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/This code
var("a b")
assume(a, "real")
equation=[a+b==0]
s=solve(equation, a, b)
print(s)
causes an AttributeError :
AttributeError: 'list' object has no attribute 'lhs'
The problem comes from the assumption in line 2. Can somebody explain?
poThu, 10 Jun 2021 11:33:47 +0200https://ask.sagemath.org/question/57526/Beginner problem solving equations.https://ask.sagemath.org/question/57473/beginner-problem-solving-equations/ Dear all,
This is my second day on Sagemath!
I don't understand what I'm doing wrong, and right now, I can't even open the documentation online (I get error even there). I simply want to solve the last equation for ``` p_n```, I suppose that Sage sees that I am comparing two equations, so it doesn't understand that I want to compare the right-hand side of both, but then what is the purpose of the ```.rhs``` method? (Even here, it would be nice to understand what this is... I'm copying the code of a friend of mine and trying to apply it to my own problem).
P.S. Also with respect to the documentation, what should I read, about this stuff? I went through the first sections, but I saw nothing on methods.
var('x, p_r, p_n, t, beta, delta')
U_ow_np = x - p_n
U_ow_p = x*(1-beta) - p_n + (delta/(1-delta))*p_r*(1-t)
U_r_p = 1-x*(1-beta) - delta*p_r
U_O_O = 1-x
x_ow_np_ow_p = solve(U_ow_np == U_ow_p, x)[0].rhs
x_ow_p_r_p = solve(U_ow_p == U_r_p, x)[0].rhs
x_r_p_O_O = solve(U_r_p == U_O_O, x)[0].rhs
# Here I get the error.
solve(x_ow_np_ow_p == x_ow_p_r_p, p_n)[0].rhs
P.S. What does the [0] mean?
Sorry for the naivite, I tried to have a look on the forum, but this problem seems too basic for this forum...
Boyko_BuTue, 08 Jun 2021 12:44:34 +0200https://ask.sagemath.org/question/57473/Cannot evaluate symbolic expression to a numerical valuehttps://ask.sagemath.org/question/56672/cannot-evaluate-symbolic-expression-to-a-numerical-value/ I'm trying to do this:
```
(sqrt(10*y*(10-y))+sqrt(1000)*acos(sqrt(y/10))-15*sqrt(2*6.673*10^(-11)*50000000000)).roots( ring=RealField(100))
```
Unfortunately I get the error in the title.
Also any other way of solving the above equation numerically would be appreciated. I was able to do it in maxima using `find_root` but was hoping for a better function (one that doesn't require specifying an interval). I couldn't use find_root in sage because it returns the error 'unable to simplify to float approximation' and ofcourse `solve` doesn't return explicit solutions.Dr. BananaFri, 16 Apr 2021 17:06:47 +0200https://ask.sagemath.org/question/56672/How to convert linear system to matrix formhttps://ask.sagemath.org/question/56499/how-to-convert-linear-system-to-matrix-form/Hi, I am new to SageMath, need help on convert a linear system into matrix form using SageMath, e.g.
> 3 x + 2 y = 16
>
> 7 x + y = 19fahadktkMon, 05 Apr 2021 06:09:26 +0200https://ask.sagemath.org/question/56499/A Simple Exponential Equationhttps://ask.sagemath.org/question/54862/a-simple-exponential-equation/Sage can solve the equation $8^t =37$ for $t$:
solve( (8)^t ==37, t )
But strangely, cannot solve $\left(\frac 89\right)^t =37$
solve( (8/9)^t ==37, t )
Any ideas?KapcakWed, 23 Dec 2020 01:22:04 +0100https://ask.sagemath.org/question/54862/Square, cube, octahedron, equationshttps://ask.sagemath.org/question/54682/square-cube-octahedron-equations/We know that $|x| + |y| - 1 = 0$ is the equation of a square having its vertices on the axes.
I asked to represent the equation $|x| + |y| + |z| - 1 - 0$, believing to obtain a cube in space.
But I obtain an octahedron. Why? And how do you get a cube?
# with SageMath 7.3
var('x, y, z')
f = abs(x) + abs(y) + abs(z) - 1
implicit_plot3d(f, (x, -1, 1), (y, -1, 1), (z, -1, 1), color='aquamarine ')wisherTue, 15 Dec 2020 11:00:00 +0100https://ask.sagemath.org/question/54682/How to solve higher order (3rd or 4th) differential equation?https://ask.sagemath.org/question/54580/how-to-solve-higher-order-3rd-or-4th-differential-equation/I am new to Sagemath. I was trying to solve ODE of order 4 in sagemath but it gives following error
"NotImplementedError: Maxima was unable to solve this ODE."
x=var('x')
w = function('w')(x)
desolve(diff(w,x,4)==1,w,contrib_ode=True)
Thanks in advance.sonimohitSat, 05 Dec 2020 23:06:08 +0100https://ask.sagemath.org/question/54580/Finding solution of expression with fractional powerhttps://ask.sagemath.org/question/53299/finding-solution-of-expression-with-fractional-power/I'm trying to solve this equation
$ 3(2.2+(\frac{64}{r})^{(1/3)})= 4(2.2+(\frac{128}{r-1})^{(1/4)})$ using solve function
I want to obtain the numerical solution
**but when i use `sol[0].n(30)`**
**TypeError:** cannot evaluate symbolic expression numerically
**when i try to `find_root(0,1,r)`**
**ValueError:** negative number to a fractional power not real
How to find the solution of this expression ?
deeppaul589Fri, 04 Sep 2020 11:18:45 +0200https://ask.sagemath.org/question/53299/Solving equation with algebraic numbershttps://ask.sagemath.org/question/52927/solving-equation-with-algebraic-numbers/ Hello, SAGE gives me error when I load this:
solve(x^2-AA(sqrt(3))==0,x)
but it gives no problem when I load
solve(x^2-sqrt(3)==0,x)
This is a small example of a bigger problem I have in which I must solve a system of equations involving algebraic numbers through AA(.) and QQbar(.). How can I make SAGE solve equations with this type of numbers? or there is no way? Thanks!creyesm1992Mon, 10 Aug 2020 15:23:58 +0200https://ask.sagemath.org/question/52927/Symbolic Equation 0=0https://ask.sagemath.org/question/52797/symbolic-equation-00/What's the "correct" way to create the symbolic equation $0=0$ in Sage?
(In particular, `0==0` returns `True`, so that's a non-starter.)StevenClontzSat, 01 Aug 2020 18:48:43 +0200https://ask.sagemath.org/question/52797/why sagemath returns 2 solution instead of onehttps://ask.sagemath.org/question/52326/why-sagemath-returns-2-solution-instead-of-one/when I run the expression
> solve([x>=3, x >=5, x < 8],x)
It returns
> [[5 < x, x < 8], [x == 5]]
But I'm hoping that it would return
> [[5 <= x, x < 8]]
How do I get my expected value?
loloraSat, 04 Jul 2020 19:49:23 +0200https://ask.sagemath.org/question/52326/Solving a polynomial system in a quotient ringhttps://ask.sagemath.org/question/52254/solving-a-polynomial-system-in-a-quotient-ring/I want to compute all solutions in $\mathbb{Z}_9[\sqrt2,x]$, where $x$ is such that $(x+\sqrt2)^2=2(x+\sqrt2)$, of the equation
$$X^2=1.$$
I'm first defining the polynomial ring over $\mathbb{Z}_9$ in variables $x,y$, then factoring by the ideal generated by
$$y^2-2, (x+y)^2-2(x+y),$$
to get the ring $S$, but then I don't know which command to use in order to get the solutions of $X^2-1$. I have tried "solve" and "variety" (defining $S[X]$ first and then the ideal of $X^2-1$), but they do not seem to work. The code up to this point is just
R.<x,y> = PolynomialRing(IntegerModRing(9),order='lex')
J= R.ideal(x^2-2,(x+y)^2-2*(x+y))
S=R.quotient(J)
Which function should I use?Jose BroxMon, 29 Jun 2020 16:55:09 +0200https://ask.sagemath.org/question/52254/Solve command doesnt give proper resultshttps://ask.sagemath.org/question/52220/solve-command-doesnt-give-proper-results/Then I type this:
z1 = 15
df1 = 37.18
dh1 = 45.8
e1 = 7.11
z2 = -19
df2 = -57.34
dh2 = -49.04
e2 = 5.81
m,x1,x2,a = var('m,x1,x2,a')
assume (a>0)
assume (a<0.5*pi)
assume (m<5)
assume (m>1)
b = arccos ( ( z1*m*cos(a)) / dh1 )
c = arccos ( ( z2*m*cos(a)) / dh2 )
eq1 = x1 == 0.5*( (df1 / m) - z1 +2.5)
eq2 = x2 == 0.5*( (df2 / m) - z2 +2.5)
eq3 = e1 == dh1* ( ( (0.5*pi-2*x1*tan(a) ) / z1) - tan(a)+tan(a)+tan(b)-tan(b) )
eq4 = e2 == dh2* ( ( (0.5*pi-2*x2*tan(a) ) / z2) - tan(a)+tan(a)+tan(c)-tan(c) )
solve ([eq1,eq2,eq3,eq4],m,x1,x2,a)
Sage gives me this as a answer, which isn't helpul to me:
[5.81 == 1.290526315789474*pi - 5.162105263157894*x2*tan(a), 7.11 == 1.526666666666667*pi - 6.106666666666666*x1*tan(a), x1 == 18.59/m - 6.25, x2 == -28.67/m + 10.75]
Anyone know how I can solve this?
DerChineseThu, 25 Jun 2020 17:59:42 +0200https://ask.sagemath.org/question/52220/solving system of equations over number fieldhttps://ask.sagemath.org/question/50044/solving-system-of-equations-over-number-field/I am trying to solve two, 2-variable polynomial equations over $F:=\mathbb{Q}(i)$ modulo $K:=F(\sqrt{2})$.
Specifically, if p1 = $a^2+6b^2$, p2 = $3a^2+2b^2$, and $K^{\ast4}:=\langle k^4\vert k\in K\setminus 0 \rangle$
i.e. the group of 4th powers of nonzero elements of $K$. I want to find (all?) $a$ and $b$ in $F$ such that p1$\equiv$1 modulo $K^{\ast4}$ and p2$\equiv$-1 modulo $K^{\ast4}$.
Any amount of walk through or pointing in the right direction, or telling me this might not be doable would be great! I am relatively new to sage, or at least it has been years since I've used it.AcantiSun, 23 Feb 2020 23:05:24 +0100https://ask.sagemath.org/question/50044/Equation in complex numbershttps://ask.sagemath.org/question/48956/equation-in-complex-numbers/ I need to solve the following equation.
solve(z^2 == (1-sqrt(3)*I)*z.conjugate(), z)
Sage says
[z == -sqrt((-I*sqrt(3) + 1)*conjugate(z)), z == sqrt((-I*sqrt(3) + 1)*conjugate(z))]
I'd like to get solutions in polar form, something like
[z == 0, z == 2*e^(pi*I/9), z == 2*e^(7*pi*I/9), z == 2*e^(13*pi*I/9)]
Or I'd like to get the absolute values and arguments of the solutions. Is it possible in Sage?EvgenyMThu, 05 Dec 2019 23:50:40 +0100https://ask.sagemath.org/question/48956/vector equation solvehttps://ask.sagemath.org/question/48532/vector-equation-solve/How to solve this?:
F = vector([cos(alpha),sin(alpha),z])
G = vector([z,cos(alpha),sin(alpha)])
A = vector([0,0,0])
solve(F-G == A)
Answer must be:
[cos(asin(cos(alpha))),
sin(asin(cos(alpha))),
sin(alpha)]dimonbavlyMon, 28 Oct 2019 10:39:17 +0100https://ask.sagemath.org/question/48532/Problems and errors in solve an equationhttps://ask.sagemath.org/question/46842/problems-and-errors-in-solve-an-equation/ Hi everybody, I want to solve this non linear equation: omega_nf_eq = 0.
m,J_d,J_p,y,Y,omega,Omega,phi,Phi,z,Z,theta,Theta,k_yy,k_zz,k_phiphi,k_yphi,k_ztheta,k_thetatheta,plane_xy1,plane_xy2,plane_xz1,plane_xz2 = var('m J_d J_p y Y omega Omega phi Phi z Z theta Theta k_yy k_zz k_phiphi k_yphi k_ztheta k_thetatheta plane_xy1 plane_xy2 plane_xz1 plane_xz2')
t = var('t')
omega_nf_eq = -J_d^2*k_yy*k_zz*omega^4 + 0.382*J_d^2*k_yy*omega^6 + 0.382*J_d^2*k_zz*omega^6 - 0.145924*J_d^2*omega^8 + J_d*k_phiphi*k_yy*k_zz*omega^2 - 0.382*J_d*k_phiphi*k_yy*omega^4 - 0.382*J_d*k_phiphi*k_zz*omega^4 + 0.145924*J_d*k_phiphi*omega^6 + J_d*k_thetatheta*k_yy*k_zz*omega^2 - 0.382*J_d*k_thetatheta*k_yy*omega^4 - 0.382*J_d*k_thetatheta*k_zz*omega^4 + 0.145924*J_d*k_thetatheta*omega^6 - J_d*k_yphi^2*k_zz*omega^2 + 0.382*J_d*k_yphi^2*omega^4 - J_d*k_yy*k_ztheta^2*omega^2 + 0.382*J_d*k_ztheta^2*omega^4 + J_p^2*Omega^2*k_yy*k_zz*omega^2 - 0.382*J_p^2*Omega^2*k_yy*omega^4 - 0.382*J_p^2*Omega^2*k_zz*omega^4 + 0.145924*J_p^2*Omega^2*omega^6 - k_phiphi*k_thetatheta*k_yy*k_zz + 0.382*k_phiphi*k_thetatheta*k_yy*omega^2 + 0.382*k_phiphi*k_thetatheta*k_zz*omega^2 - 0.145924*k_phiphi*k_thetatheta*omega^4 + k_phiphi*k_yy*k_ztheta^2 - 0.382*k_phiphi*k_ztheta^2*omega^2 + k_thetatheta*k_yphi^2*k_zz - 0.382*k_thetatheta*k_yphi^2*omega^2 - k_yphi^2*k_ztheta^2 == 0
solve(omega_nf_eq, omega)
But the Sage is unable to find the solution, damn it.
I get this error message:
TypeError: ECL says: Memory limit reached. Please jump to an outer pointer, quit program and enlarge the memory limits before executing the program again.
I know the equation is big but i didn't expected such many problems.
I've already tried sympy but nothing.
Is there another way?
pull_over93Fri, 07 Jun 2019 00:38:46 +0200https://ask.sagemath.org/question/46842/problem: sage is not able to find solution to an equation.https://ask.sagemath.org/question/46841/problem-sage-is-not-able-to-find-solution-to-an-equation/ Hi everybody, I want to solve this non linear equation: omega_nf_eq = 0.
m,J_d,J_p,y,Y,omega,Omega,phi,Phi,z,Z,theta,Theta,k_yy,k_zz,k_phiphi,k_yphi,k_ztheta,k_thetatheta,plane_xy1,plane_xy2,plane_xz1,plane_xz2 = var('m J_d J_p y Y omega Omega phi Phi z Z theta Theta k_yy k_zz k_phiphi k_yphi k_ztheta k_thetatheta plane_xy1 plane_xy2 plane_xz1 plane_xz2')
t = var('t')
omega_nf_eq = -J_d^2*k_yy*k_zz*omega^4 + 0.382*J_d^2*k_yy*omega^6 + 0.382*J_d^2*k_zz*omega^6 - 0.145924*J_d^2*omega^8 + J_d*k_phiphi*k_yy*k_zz*omega^2 - 0.382*J_d*k_phiphi*k_yy*omega^4 - 0.382*J_d*k_phiphi*k_zz*omega^4 + 0.145924*J_d*k_phiphi*omega^6 + J_d*k_thetatheta*k_yy*k_zz*omega^2 - 0.382*J_d*k_thetatheta*k_yy*omega^4 - 0.382*J_d*k_thetatheta*k_zz*omega^4 + 0.145924*J_d*k_thetatheta*omega^6 - J_d*k_yphi^2*k_zz*omega^2 + 0.382*J_d*k_yphi^2*omega^4 - J_d*k_yy*k_ztheta^2*omega^2 + 0.382*J_d*k_ztheta^2*omega^4 + J_p^2*Omega^2*k_yy*k_zz*omega^2 - 0.382*J_p^2*Omega^2*k_yy*omega^4 - 0.382*J_p^2*Omega^2*k_zz*omega^4 + 0.145924*J_p^2*Omega^2*omega^6 - k_phiphi*k_thetatheta*k_yy*k_zz + 0.382*k_phiphi*k_thetatheta*k_yy*omega^2 + 0.382*k_phiphi*k_thetatheta*k_zz*omega^2 - 0.145924*k_phiphi*k_thetatheta*omega^4 + k_phiphi*k_yy*k_ztheta^2 - 0.382*k_phiphi*k_ztheta^2*omega^2 + k_thetatheta*k_yphi^2*k_zz - 0.382*k_thetatheta*k_yphi^2*omega^2 - k_yphi^2*k_ztheta^2 == 0
solve(omega_nf_eq, omega)
But the Sage is unable to find the solution, damn it.
I get this error message:
TypeError: ECL says: Memory limit reached. Please jump to an outer pointer, quit program and enlarge the memory limits before executing the program again.
I know the equation is big but i didn't expected such many problems.
I've already tried sympy but nothing.
Is there another way?
pull_over93Fri, 07 Jun 2019 00:35:14 +0200https://ask.sagemath.org/question/46841/AttributeError: 'dict' object has no attribute 'solve'https://ask.sagemath.org/question/46729/attributeerror-dict-object-has-no-attribute-solve/How I can fix this error '''AttributeError: 'dict' object has no attribute 'solve'
It appears after I tried to `solve(P)`:
G = I.groebner_basis()
P = {}
ind = 0
for i in range (n):
if (G[i].degree() < num):
ind = ind+1
P[ind] = G[i]
solve(P)MaoriThu, 30 May 2019 23:56:09 +0200https://ask.sagemath.org/question/46729/