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.Mon, 22 Mar 2021 13:29:51 +0100A matrix containing differential operators acting on a matrix containing functionshttps://ask.sagemath.org/question/56311/a-matrix-containing-differential-operators-acting-on-a-matrix-containing-functions/Suppose I have a 2x2 operator matrix, D. Some of its elements are of the form (d/dx), and (d2/dx2).
Now when this matrix is multiplied with another matrix, f, whose elements are functions of x, I will get the final matrix whose corresponding elements are differentiated.
for example: **D = matrix([[d/dx, d3/dx3], [d2/dx2, d2/dx2]])** is an operator matrix which operates on a function matrix, **f(x) = matrix([[x, x^2], [x^3, x]])** as D(f(x)) = D*f(x), (simple matrix multiplication).
Writing D = matrix([[diff( , x), diff( , x, 3)], [diff( , x, 2), diff( , x, 2)]]) does not work as diff() function needs an input function.
So how can I write the D() operator matrix?
PS: I could use f.apply_map(lambda e: diff(e, x)), but then it applies d/dx to all elements in f(x). Whereas, I have 'diff()' operators of different orders in the D matrix.ApoorvMon, 22 Mar 2021 13:29:51 +0100https://ask.sagemath.org/question/56311/How do I understand the result of symbolic integralshttps://ask.sagemath.org/question/7574/how-do-i-understand-the-result-of-symbolic-integrals/So now I know how to integrate, but when I type in
sage: deriv=diff((exp(x)-1)/x,x); deriv
e^x/x - (e^x - 1)/x^2
sage: deriv.integrate(x)
-1/x + Ei(x) - gamma(-1, -x)
why don't I get back `(exp(x)-1)/x +C `?
Philipp SchneiderWed, 18 Aug 2010 20:04:12 +0200https://ask.sagemath.org/question/7574/Pretty print derivative in Newton notation with dot?https://ask.sagemath.org/question/54975/pretty-print-derivative-in-newton-notation-with-dot/Is there any way to get the pretty printer to produce Newton's notation? - ie. a single dot centred over the variable for first derivative with respect to time, 2 dots for second derivative etc.
Example:
t, y = var('t, y')
x = function('x')(t)
pretty_print(y == 2*diff(diff(x,t),t) - 3 * diff(x,t) + 5)
gives:
![sage math output](https://www.sandyscott.net/wp-content/uploads/2020/12/partialleibniz.png)
but I'd like to see:
![Newton's Notation](https://www.sandyscott.net/wp-content/uploads/2020/12/newton.png)sandy_scottMon, 28 Dec 2020 23:37:51 +0100https://ask.sagemath.org/question/54975/Having trouble in solving two differential equations using desolve_systemhttps://ask.sagemath.org/question/53353/having-trouble-in-solving-two-differential-equations-using-desolve_system/ I am trying to solve the following two differential equations simultaneously:
$$Ma^2\frac{dM}{dr}+(M^2a+6a)\frac{da}{dr}+\frac{1}{r^2}=0$$
$$ar\frac{dM}{dr}+7Mr\frac{da}{dr}+2Ma=0$$
where $M=M(r)$ and $a=a(r)$ are the variables.
I had written the following code in Sage:
sage: r = var('r')
sage: M = function('M')(r)
sage: a = function('a')(r)
sage: de1 = (M*a*a*diff(M,r) + (M*M*a+6*a)*diff(a,r) + 1/(r*r) == 0)
sage: de2 = (a*r*diff(M,r) + 7*M*r*diff(a,r) + 2*M*a == 0)
sage: desolve_system([de1,de2], [M,a])
After writing the above code in Sage, I am getting the following error:
TypeError Traceback (most recent call last)
<ipython-input-26-6bce8159491d> in <module>()
----> 1 desolve_system([de1, de2], [M,a])
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/calculus/desolvers.py in desolve_system(des, vars, ics, ivar)
822 for dvar, ic in zip(dvars, ics[1:]):
823 dvar.atvalue(ivar==ivar_ic, ic)
--> 824 soln = dvars[0].parent().desolve(des, dvars)
825 if str(soln).strip() == 'false':
826 raise NotImplementedError("Maxima was unable to solve this system.")
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/interfaces/interface.py in __call__(self, *args, **kwds)
606
607 def __call__(self, *args, **kwds):
--> 608 return self._parent.function_call(self._name, list(args), kwds)
609
610 def _sage_doc_(self):
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/interfaces/interface.py in function_call(self, function, args, kwds)
532 [s.name() for s in args],
533 ['%s=%s'%(key,value.name()) for key, value in kwds.items()])
--> 534 return self.new(s)
535
536 def _function_call_string(self, function, args, kwds):
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/interfaces/interface.py in new(self, code)
307
308 def new(self, code):
--> 309 return self(code)
310
311 ###################################################################
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/interfaces/interface.py in __call__(self, x, name)
242
243 if isinstance(x, six.string_types):
--> 244 return cls(self, x, name=name)
245 try:
246 return self._coerce_from_special_method(x)
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/interfaces/interface.py in __init__(self, parent, value, is_name, name)
670 self._name = parent._create(value, name=name)
671 except (TypeError, RuntimeError, ValueError) as x:
--> 672 raise TypeError(x)
673
674 def _latex_(self):
TypeError: ECL says: Error executing code in Maxima: desolve: can't handle this case.
Can someone help me with the problem. I am new to Sage and so I could not interpret the error.
Thanks in advance!Abby11Mon, 07 Sep 2020 13:20:52 +0200https://ask.sagemath.org/question/53353/I'm searching to perform this multivariate limit (correctly)https://ask.sagemath.org/question/53309/im-searching-to-perform-this-multivariate-limit-correctly/ I'm searching to perform this kind of limit (without restricting and executing the limit to a variable):
$$
\lim_{(x, y)\to(0, 0)}\frac{x^3y}{x^6+y^2}
$$
In the documentation I didn't find a multivariate limit function..Teo7Sat, 05 Sep 2020 11:14:41 +0200https://ask.sagemath.org/question/53309/Error in integralhttps://ask.sagemath.org/question/53172/error-in-integral/I've got this error on the second integral. I put the code on wxMaxima and returned sucessfull. On wxMaxima, raise a question "z is positive, negative or zero?", also on sage, but on sage I can't answer that. How can I correct this?
```x,y,z = var("x y z")```
```function = x*e^(-y)```
``` integral(function,y,0,ln(x)).integral(x,0,2*z) ```gabrielromao5Tue, 25 Aug 2020 15:50:58 +0200https://ask.sagemath.org/question/53172/Unexpected result in calculating limitshttps://ask.sagemath.org/question/50767/unexpected-result-in-calculating-limits/Limit of `sqrt(x-3)` when `x` approaches `3` doesn't exist but the sage returns `0`. Why is that?
sage:
sage: limit(sqrt(x-3), x=3)
0
sage:
ggWed, 15 Apr 2020 13:43:24 +0200https://ask.sagemath.org/question/50767/Sage returning wrong derivativehttps://ask.sagemath.org/question/50704/sage-returning-wrong-derivative/I am trying to calculate the derivative of `y = e^(x*y)`
Hand calculation give me the result of `dy/dx = ( y*e^(x*y) ) / ( 1 - x*e^(x*y) )`
But the sage is giving me the wrong output of `-y/x`. Here is my code:
sage:
sage: y=function('y')(x)
sage: y
y(x)
sage:
sage: expr = exp(1)**(x*y)
sage:
sage: diff(y)
diff(y(x), x)
sage:
sage: diff(expr)
(x*diff(y(x), x) + y(x))*e^(x*y(x))
sage:
sage: solve(diff(expr), diff(y))
[diff(y(x), x) == -y(x)/x]
sage:
sage:
ggSun, 12 Apr 2020 19:25:28 +0200https://ask.sagemath.org/question/50704/How are symbolic derivatives composed in quaternions?https://ask.sagemath.org/question/49785/how-are-symbolic-derivatives-composed-in-quaternions/The scripts below were run in: Sage Cell Server, version: 'SageMath version 9.0, Release Date: 2020-01-01'
I am a new user of SageMath. I have previously used math packages, but SageMath is above and beyond all I have encountered before. It also has remarkably comprehensive documentation. In particular I have found Vector calculus with SageMath and Sage Reference Manual: Quaternion Algebras (insufficient karma to post links). I note that the latter is dated Jan 01, 2020. The examples below are drawn from those two sources. I am searching for calculus tools in the quaternion algebra package. I want to do something like this, which works in EuclideanSpace:
Sage: %display latex
Sage: from sage.manifolds.operators import *
Sage: E.<x,y,z> = EuclideanSpace()
Sage: F = E.scalar_field(function('f')(x,y,z), name='F')
Sage: grad(F).display()
grad(F) = d(f)/dx e_x + d(f)/dy e_y + d(f)/dz e_z The EucliedanSpace also knows how to pretty-print it with LaTeX.
This is as close as I have gotten with quaternions:
Sage: N.<a,b,c,d,y> = QQ[]
Sage: Q.<i,j,k> = QuaternionAlgebra(SR,-1,-1)
Sage: def qd(u):
Sage: w = j*(diff(u[0],y) + diff(u[1],y)*i + diff(u[2],y)*j + diff(u[3],y)*k)
Sage: return w
Sage: b = sin(y)
Sage: f = a+b*i+c*j+d*k
Sage: t = qd(f)
Sage: show(t)
(-cos(y))*k
This is the correct quaternion result, but I want to change the declaration of "b" so that I get something like
**(-d(f)/dy) * k**. Here are the problems that concern me.
1. "diff" does not correctly handle "f" as an argument. It returns 0.
2. The definition in the function "qd" (quaternion derivative) of w should contain 3 more rows, but this one is enough to illustrate my main issue: If "b" is not defined as a specific function (e.g. sin(y)), "diff" returns 0. I would like it to return the derivative display formula, as the Euclidean example does.
3. Replacing show(t) with t.display() returns error messages such as "object has no attribute 'blah_blah'" and "raise AttributeError(dummy_error_message)." There may still be some work in progress here.
I hope there is presently a solution within SageMath. Please adapt the second script or give me an example script.
If not, I am reasonably competent with Python 3. If someone can give me links to the relevant source for the EuclideanSpace methods of "grad" and "function" and to the QuaternionAlgebra source for "diff," I may be able to add a method or two to the QuaternionAlgebra implementation and advance the development of that part of the system, or at least register myself as a beta-tester.
Thanks very much for any help you can give me!
quirkyTue, 04 Feb 2020 20:31:21 +0100https://ask.sagemath.org/question/49785/symbolic differentiation of unknown functionhttps://ask.sagemath.org/question/49362/symbolic-differentiation-of-unknown-function/I want to do some formal calculus with unknown functions
for the purpose of solving differential equations.
Say `F(t) = v(t)*t^2`, where `v` is an unknown differentiable function.
Then I would like to declare `v` as such and be able to get
`F.diff(t) = 2*t*v+t^2*v.diff(t)`
It is similar to [Ask Sage question 8822](https://ask.sagemath.org/question/8822)
but the solution does not seem to work anymore, as `function()` takes
only one argument and not 2 as in the description.
Anyone know what the syntax is in 8.9? Or in 9.0, when that becomes available?asgerSat, 04 Jan 2020 21:10:03 +0100https://ask.sagemath.org/question/49362/Is there any way to define an as-yet-unknown function?https://ask.sagemath.org/question/8822/is-there-any-way-to-define-an-as-yet-unknown-function/I'd like to know if there's a way of declaring functions in sage that are as-yet unknown. For example, let's say I have a function
p = R*T/v - a(T)/v/(v+b)
And I would like to be able to take a derivative like this
deriv(p,T)
and be given something back a partial derivative something like
R/v - diff(a(T),T)/v/(v+b)
However at present I can't seem to put an abstract function `a(T)` into my expression or find anything in the documentation that says how this is done.
As I recall there was a way to do this with wxMaxima, so maybe I just haven't found the trick in Sage yet.
jdpipeFri, 23 Mar 2012 14:11:38 +0100https://ask.sagemath.org/question/8822/Solve failshttps://ask.sagemath.org/question/48390/solve-fails/I wonder why the Variable 'x_0' not found
gr=Polyhedron(ieqs=[(10,-1,0),(-12,0,1)])
p1=gr.plot()
x_0, x_1 = var('x_0 x_1')
lin=solve([70==6*x_0+18*x_1],x_1)
p2=plot(lin, (x,8,14))
p1+p2CyrilleFri, 18 Oct 2019 06:50:09 +0200https://ask.sagemath.org/question/48390/how do I enter 2sin|1−3√2|cos|1+ 2√3|https://ask.sagemath.org/question/47722/how-do-i-enter-2sin1-32cos1-23/when I enter it in SageMath as `2 * sin * abs(1-3 * sqrt(2))*cos*abs(1+2 * sqrt(3))` it does not run the code? your help would be very appreciated :)ariaaaaaaaaMon, 02 Sep 2019 17:44:08 +0200https://ask.sagemath.org/question/47722/error for (3*e+2*I)*(-3+pi*I)https://ask.sagemath.org/question/47729/error-for-3e2i-3pii/so, I have to type in the problem (3e+2i)(−3+πi)...I enter in `(3*e+2*I)*(-3+pi*I)` on SageMath but come up with the answer, -30.74772176 + 19.61920267*I....am I dumb or is the correct answer?ariaaaaaaaaMon, 02 Sep 2019 19:07:52 +0200https://ask.sagemath.org/question/47729/how do I enter (3e+2i)(−3+πi)?https://ask.sagemath.org/question/47715/how-do-i-enter-3e2i-3pi/every time I enter I to represent i, it comes as an invalid syntax? pls help :)ariaaaaaaaaMon, 02 Sep 2019 00:10:09 +0200https://ask.sagemath.org/question/47715/how do I enter (3e+2i)(−3+πi)?https://ask.sagemath.org/question/47714/how-do-i-enter-3e2i-3pi/ every time I enter i as I it comes up as an invalid syntax? Pls help ariaaaaaaaaMon, 02 Sep 2019 00:09:14 +0200https://ask.sagemath.org/question/47714/Computing a formula in SAGEhttps://ask.sagemath.org/question/47509/computing-a-formula-in-sage/Fix the positive integer numbers $t_1, t_2, t_3,t_4, t_5.$ We have the following formula:
$$ S= \sum_{i, j, h, m, k_1 + k_2+k_3+k_4 = i-t_1, \ell_1+\ell_2 + \ell_3 = j -t_2 + k_4, u_1 + u_2 = h - t_3+k_3+\ell_3 }M_1.M_2.M_3. M_4,$$
where
$$ M_1 = \binom{t_5-k_1}{k_1}\binom{t_4-k_2}{k_2}\binom{t_3-k_3}{k_3}\binom{t_2-k_4}{k_4}$$
$$ M_2 = \binom{t_5-k_1-\ell_1}{\ell_1}\binom{t_4-k_2-\ell_2}{\ell_2}\binom{t_3-k_3-\ell_3}{\ell_3}$$
$$ M_3 = \binom{t_5-k_1-\ell_1-u_1}{u_1}\binom{t_4-k_2-\ell_2-u_2}{u_2};$$
$$ M_4=\binom{t_1+t_2+t_3+t_4 +t_5-i - j-h-m}{m - t_4 + k_2+ \ell_2 + u_2}.\lambda_i\lambda_j\lambda_h\lambda_m\lambda_{t_1+t_2 + t_3+t_4+t_5 - i - j-h-m}$$
Here, the binomial factors $\binom{n}{k}$ mod 2 and the value of $S$ mod 2. By convention, $\binom{n}{k} \equiv 0$ (mod 2) if either $k < 0$ or $n < 0$ or $k > n.$
I don't how to construct this formula in SAGE. Can someone show me how to compute it using SAGE?VochauMon, 19 Aug 2019 15:27:56 +0200https://ask.sagemath.org/question/47509/Calculating Cauchy Integrals in Sagehttps://ask.sagemath.org/question/47017/calculating-cauchy-integrals-in-sage/Hi!
I am relatively new to complex analysis and I am trying to write down the following integral in Sage Math:
$$
I(k) = \frac{1}{2i\pi}\oint\frac{(1-t^2)}{(1-t)^n}\frac{dt}{t^{k+1}}
$$
from a paper that can be found at:
http://magali.bardet.free.fr/Publis/ltx43BF.pdf
The contour is a unit circle around the origin with a radius less than 1.
whereby $$S(n) = \frac{(1-t^2)}{(1-t)^n} $$ is a formal power series. The Cauchy Integral will produce the k-th coefficient of $S(n)$. I tried doing the following:
<!-- language: python -->
def deg_reg_Cauchy(k, n, m):
R.<t> = PowerSeriesRing(CC, 't')
constant_term = 1/(2*I*pi)
s = (1-t**2)**m / (t**(k+1)*(1-t)**n)
s1 = constant_term * s.integral()
return s1
I realize this is probably ***very*** wrong and I used $0$ till $2\pi$ as simple placeholders until I find appropriate values. Does anyone have any tips on how to go about this, please? Below is the error message that is being outputted by Sage.
<!-- language: python -->
ArithmeticError: The integral of is not a Laurent series, since t^-1 has nonzero coefficient.
Thank you!JoaoDDuarteSat, 29 Jun 2019 19:01:11 +0200https://ask.sagemath.org/question/47017/2D Points, best paractive to store Pointshttps://ask.sagemath.org/question/45444/2d-points-best-paractive-to-store-points/
sage: from sage.plot.point import Point
sage: P = Point([1,2],[2,3],{'alpha':.5})
sage: P
Point set defined by 2 point(s)
sage: P.options()['alpha']
0.500000000000000
sage: P.xdata
[1, 2]
Why is this not working:
sage: P = Point([1,2],[2,3])
Why do I need this alpha Parameter?
thethaWed, 13 Feb 2019 11:33:40 +0100https://ask.sagemath.org/question/45444/Importing Sage functions into Cython?https://ask.sagemath.org/question/42277/importing-sage-functions-into-cython/ I am trying to define variables in Cython part of my code like this
a,b,c = var('a,b,c')
But in this line I cant import var() function from Sage
from sage.calculus.var import var
I got this error:
$ sage -python real_sage.sage
Compiling ./real_sage.spyx...
Traceback (most recent call last):
File "real_sage.sage", line 6, in <module>
from real_sage import foo
File "real_sage.pyx", line 10, in init real_sage
File "sage/calculus/var.pyx", line 6, in init sage.calculus.var
File "/home/tunamustafakemal/sega/SageMath/local/lib/python2.7/site-packages/sage/symbolic/function_factory.py", line 15, in <module>
from sage.symbolic.function import SymbolicFunction, sfunctions_funcs, \
File "sage/rings/integer.pxd", line 7, in init sage.symbolic.function
File "sage/rings/rational.pxd", line 8, in init sage.rings.integer
File "sage/rings/rational.pyx", line 89, in init sage.rings.rational
File "sage/rings/real_mpfr.pyx", line 1, in init sage.rings.real_mpfr
File "sage/rings/complex_number.pxd", line 6, in init sage.libs.mpmath.utils
File "sage/rings/complex_double.pxd", line 10, in init sage.rings.complex_number
File "sage/rings/complex_double.pyx", line 94, in init sage.rings.complex_double
ImportError: cannot import name complex_number
Thanks for any support.tunaMon, 07 May 2018 06:14:53 +0200https://ask.sagemath.org/question/42277/Is matrix calculus possible within sagemath?https://ask.sagemath.org/question/32414/is-matrix-calculus-possible-within-sagemath/For example, is it possible to compute the following partial derivative in Sagemath:
$$
A_{ij} = \frac{\partial e_{ij}(x)}{\partial x_i} = \begin{pmatrix}
-R_{ij}^T R_i^T & R_{ij}^T \frac{\partial R_i^T}{\partial \theta_i} (t_j - t_i) \\\
0^T & -1
\end{pmatrix}
$$
for
$$
e_{ij}(x) = \begin{pmatrix}
R_{ij}^T (R_i^T (t_j - t_i) - t_{ij}) \\\
\theta_j - \theta_i - \theta_{ij}
\end{pmatrix}
$$
and
$$
x_i^T = (t_i^T, \theta_i)
$$
$$
z_{ij}^T = (t_{ij}^T, \theta_{ij})
$$
The background shouldn't be important, but just for completeness: this example is an excerpt from Robotics, especially the problem of Pose Graph Simultaneous Mapping and Localization. $x_i$ defines a pose in $\mathbb{R}^2$ with translation $t_i$ and rotation angle $\theta_i$, $z_{ij}$ defines a transform between two poses and $e_{ij}(x)$ defines the error between two poses, i.e. a transform between them.
morphTue, 02 Feb 2016 10:20:41 +0100https://ask.sagemath.org/question/32414/help on using chain rule in Sagehttps://ask.sagemath.org/question/36673/help-on-using-chain-rule-in-sage/Does anyone have any tips for using Sage to take derivatives of functions of many variables?
For example, if I define
```w(x,y) = x^2 + y^2``` (say)
and then if I suppose that ```x``` and ```y``` depend on an independent variable ```t```, the chain rule applies for finding ```w.diff(t)```. The only way I found to do this in Sage is
```var('t')```
```x(t) = cos(t)``` (say)
```y(t) = sin(t)```
```w(x,y) = x^2 + y^2```
```w.diff(t)```
But this isn't really using the chain rule. If I instead try
```var('x,y')```
```(define w again)```
```(define x and y again)```
```w.diff(t)```
```Out: (x,y) |--> 0```
Apparently it thinks the derivative is zero because it still thinks ```x``` and ```y``` are two independent variables where they appear in ```w```, even though you get
```x```
```Out: t |--> cos(t)```
and similarly for ```y```. Any suggestions? Thanks.
lefthandstanderMon, 20 Feb 2017 08:25:01 +0100https://ask.sagemath.org/question/36673/Code error in sagemathhttps://ask.sagemath.org/question/36579/code-error-in-sagemath/ My code in sagemath
def bruteforce
count = 0
s = [0, 1, 2, 4, 8]
s.each do |a|
s.each do |b|
s.each do |c|
s.each do |d|
s.each do |e|
if a+b+c+d+e == 8
count += 1
puts "#{count}.: #{a}+#{b}+#{c}+#{d}+#{e}"
end
end
end
end
end
end
count
end
but it was an error as below
File "<ipython-input-1-87370adfacc9>", line 1
def brutefor
SyntaxError: invalid syntaxdavisSun, 12 Feb 2017 03:08:47 +0100https://ask.sagemath.org/question/36579/Find all non-negative integer solutions of $a+b+c+d+e = 8$ in Sagemathhttps://ask.sagemath.org/question/36564/find-all-non-negative-integer-solutions-of-abcde-8-in-sagemath/Find all non-negative integer a, b, c,d, e such that
$$a+b+c+d+e = 8$$
Is there any method for this? I have no idea. I can just fix the limit.davisSat, 11 Feb 2017 10:30:54 +0100https://ask.sagemath.org/question/36564/solution to homogeneous system of linear equations with coefficients over field $\mathbb{F}_2$https://ask.sagemath.org/question/36580/solution-to-homogeneous-system-of-linear-equations-with-coefficients-over-field-mathbbf_2/Solve the following homogeneous systems of linear equations with coefficients over field $\mathbb{F}_2$:
x1+x2+x3+x4+x5+x6+x7 = 0
x1=0
x2+x3+x4 =0
x5=0
I want to output on the sage following:
x1=x5=0
x6=x7
x2+x3+x4=0
I want to solve a general homogeneous systems with coefficients over field $\mathbb{F}_2$ and output same as above.
I hope that someone can help. Thanks!davisSun, 12 Feb 2017 03:31:11 +0100https://ask.sagemath.org/question/36580/Construction of formula in Sagemath programhttps://ask.sagemath.org/question/36533/construction-of-formula-in-sagemath-program/Let $P_k:= \mathbb{F}_2[x_1,x_2,\ldots ,x_k]$ be the polynomial algebra in $k$ variables with the degree of each $x_i$ being $1,$ regarded as a module over the mod-$2$ Steenrod algebra $\mathcal{A}.$ Here $\mathcal{A} = \langle Sq^{2^m}\,\,|\,\,m\geq 0\rangle.$
Being the cohomology of a space, $P_k$ is a module over the mod-2 Steenrod algebra $\mathscr{A}.$ The action of $\mathscr{A}$ on $P_k$ is explicitly given by the formula
$$Sq^m(x_j^d) = \binom{d}{m}x_j^{m+d},$$
where $ \binom{d}{m}$ is reduced mod-2 and $\binom{d}{m} = 0$ if $m > d.$
Now, I want to use the Steenrod algebra package and Multi Polynomial ring package and using formular above to construction of formula following in Sagemath program
$$
Sq^m(f) = \sum\limits_{2^{m_1} + 2^{m_2} + \cdots + 2^{m_k}= m}\binom{d_1}{2^{m_1}}x_1^{2^{m_1}+d_1}\binom{d_1}{2^{m_2}}x_2^{2^{m_2}+d_2}\ldots \binom{d_k}{2^{m_k}}x_k^{2^{m_k}+d_k}.$$
forall $f = x_1^{d_1}x_2^{d_2}\ldots x_k^{d_k}\in P_k$
Example: Let $k = 5, m = 2$ and $f = x_1^2x_2^3x_3^2x_4x_5\in P_5.$ We have
$$
Sq^2(x_1^2x_2^3x_3^2x_4x_5) = x_1^4x_2^3x_3^2x_4x_5 + x_1^2x_2^5x_3^2x_4x_5 + x_1^2x_2^3x_3^4x_4x_5
+x_1^2x_2^3x_3^2x_4^2x_5^2 + x_1^2x_2^4x_3^2x_4x_5^2 + x_1^2x_2^4x_3^2x_4^2x_5^1.$$
I hope that someone can help. Thanks!davisFri, 10 Feb 2017 07:29:40 +0100https://ask.sagemath.org/question/36533/Integration and differentiation symbolshttps://ask.sagemath.org/question/36441/integration-and-differentiation-symbols/I have seen this in the examples but it doesn't appear to be very easy unless I am totally missing something. It is important that the proper symbology be used in presentation form to show the integration symbol and or differentiation symbol. But can't seem to find any way of doing it . This should be straight forward like show(integral()) and it puts the integral symbol on the screen especially in showing symbolic calculations.
How do you get the symbols on the screen? NT4MAXIMUSDThu, 02 Feb 2017 14:15:53 +0100https://ask.sagemath.org/question/36441/Coordinate Transformshttps://ask.sagemath.org/question/9966/coordinate-transforms/Is there something in sage that does the same thing that `CoordinateTransform` and `TransformedField` in Mathematica 9 ?
The idea is that `CoordinateTransform` is given some coordinates, e.g. (r,th) and asked to transform them from "polar" to "cartesian", thus gives the expression of the cartesian coordinates in terms of the polar coordinates, e.g.
(x(r,th), y(r,th)) = (r*cos(th), r*sin(th))
Obvioulsly, it also works with other coordinates systems.
`TransformedField` makes the transformation between a scalar, vector, or tensor field in, say, cartesian coordinates, to spherical coordinates.
These actions are not very complicated, nor difficult to implement when needed, but they are also very common.
Thanks.
references :
* http://reference.wolfram.com/mathematica/ref/CoordinateTransform.html
* http://reference.wolfram.com/mathematica/ref/TransformedField.htmlConvenient TruthSun, 31 Mar 2013 20:04:28 +0200https://ask.sagemath.org/question/9966/A simple problem related to symbolic calculationhttps://ask.sagemath.org/question/26982/a-simple-problem-related-to-symbolic-calculation/Could anyone let me know how you can define a variable as some function of another variable without specific definition? For example, how can you define theta as some function of x and then differentiate the 'sin(theta)' by x?
The following is my code that doesn't work. I couldn't find how to fix it in reference manuals. Any help will be appreciated.
var('theta, y, f')
y=sin(theta) ; theta=f(x);
y.derivative(x)Nownuri1Sat, 30 May 2015 14:15:05 +0200https://ask.sagemath.org/question/26982/A symbolic convolution of arbitrary functionshttps://ask.sagemath.org/question/8507/a-symbolic-convolution-of-arbitrary-functions/In [this manual](http://www.sagemath.org/doc/constructions/calculus.html#convolution) it is described how to get a symbolic result of "the convolution of any piecewise defined function with another". However, when I try this with functions like exponent, this does not work:
x = PolynomialRing(QQ, 'x').gen()
f = Piecewise([[(0,1),exp(x)]])
f.convolution(f)
I get an error "RuntimeError: Symbolic Ring still using old coercion framework"
If I use a 'RR' ring instead of 'QQ', Piecewise() returns another error "TypeError: cannot coerce arguments: __call__() takes exactly 1 positional argument (0 given)"
I have 2 questions:
1. Is there a way to get a function, which represent convolution of a gaussian function and a decaying exponent (and, generally, any functions)? I want to fit my data with such a function.
2. How to get a symbolical convolution of functions with parameters (they should be assumed to be constants during convolution computation)?ADuC812Thu, 24 Nov 2011 00:01:36 +0100https://ask.sagemath.org/question/8507/