ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 12 Nov 2018 11:21:14 -0600Express the derivative in the Hamiltonian operator in sagehttp://ask.sagemath.org/question/44260/express-the-derivative-in-the-hamiltonian-operator-in-sage/I want to compute the expectation value of the energy $ \langle H \rangle $ for a quantum system with the wave function $ \psi(x) $. This is done with
$$
\langle H \rangle = \int_{-\infty}^{\infty} \psi^* \hat{H} \psi d x
$$
where
$$
\hat{H} = - \frac{\hbar^2}{2 m} \frac{d^2}{d x^2} + V(x)
$$
is the Hamiltonian operator for some potential $V(x)$. How do I express $ \frac{d}{d x} $ in sage if I don't know on which function it will be applied?
I know it is possible to use psi.diff(x), but is there a way to declare the operator so that it automatically does the derivative when it is multiplied with some function?johannehMon, 12 Nov 2018 11:21:14 -0600http://ask.sagemath.org/question/44260/Lazy evaluation of derivatives of an unknown functionhttp://ask.sagemath.org/question/10215/lazy-evaluation-of-derivatives-of-an-unknown-function/Hi,
I am using Sage to check some solutions to partial differential equations. I am wondering if a have an unknown function f, can I somehow form the PDE in terms of its derivatives and then substitute in the assumed solution and evaluate the derivatives after the fact?
Here is what I tried so far:
var('x y')
f = function('f', x, y)
g = derivative(f, x, y)
print(g)
D[0, 1](f)(x, y)
h = D[0, 1](f)(x, y)
print(h)
Traceback (click to the left of this block for traceback)
...
TypeError: 'sage.symbolic.expression.Expression' object has no
attribute '__getitem__'
I figured out that D[0, 1] represents the derivatives with respect to the ith indepent variable of the function (is this a Maxima expression?), but I'm not sure then how to use these types of expressions when I finally want to substitute in the known form of f. I.e., since the output of the expression for g is in terms of D[], and when I try to reuse that expression as h, I get an error (since D is actually some other type of object). Any help would be appreciated. Let me know if my question is not clear.
Many thanks!nosnerosMon, 10 Jun 2013 05:27:40 -0500http://ask.sagemath.org/question/10215/latex typesetting for derivatives like g'http://ask.sagemath.org/question/7826/latex-typesetting-for-derivatives-like-g/When i try:
f(x) = function('f',x)
g = diff(f(x),x)
latex(g)
I get: D[0]\left(f\right)\left(x\right)
But i would like to get something like: g'\left(x\right)
How can i do this with sage?
roahFri, 17 Jun 2011 07:29:02 -0500http://ask.sagemath.org/question/7826/How to take partial derivative of abstract/unknown function?http://ask.sagemath.org/question/39029/how-to-take-partial-derivative-of-abstractunknown-function/I have a function `f(x)` that I do not want to be expanded but wish to evaluate the partial derivative of `g(x,f(x),...)` with respect to `x`, I can not figure out how to declare the function and indicate it is a function of x without an explicit definition.
Code example:
var("x")
f = ??? # how do I define this?
g = x * f(x)
g.diff(x)
Expected output:
x * f'(x) + f(x)wrenoudWed, 04 Oct 2017 04:15:39 -0500http://ask.sagemath.org/question/39029/Evaluating the derivative of piecewise functionshttp://ask.sagemath.org/question/36451/evaluating-the-derivative-of-piecewise-functions/ Hi,
In Sage 7.5 you can numerically evaluate the derivative of a regular symbolic expression using:
sage: h(x) = sin(x)
sage: diff(h)(2).n()
-0.416146836547142
Old **Piecewise** functions could be treated in the same way:
sage: g = Piecewise([([0,2], sin(x)), ((2,3), cos(x))])
... DeprecationWarning ...
sage: diff(g)(1).n()
0.540302305868140
However, new **piecewise** functions don't:
sage: f = piecewise([([0,2], sin(x)), ((2,3), cos(x))])
sage: diff(f)(1).n()
... Error ...
Thanks in advance.
franpenaSat, 04 Feb 2017 12:43:29 -0600http://ask.sagemath.org/question/36451/Derivative of O(x^0)http://ask.sagemath.org/question/36301/derivative-of-ox0/Consider a power series
R.<x> = PowerSeries(SR)
f = 1 + O(x^2)
f.derivative()
This gives us `O(x^1)` as we would expect. However, if we do
f = O(x^0)
f.derivative()
we get `O(x^-1)` instead of `O(x^0)` again. Is this a bug or am I missing something?NullInfinitySun, 15 Jan 2017 08:16:30 -0600http://ask.sagemath.org/question/36301/Detecting highest order derivative of a function in an equationhttp://ask.sagemath.org/question/34243/detecting-highest-order-derivative-of-a-function-in-an-equation/ I am working with some code that generates an equation with a number of derivatives. I do not know the order of the derivatives or the order. If I was working with something algebraic, for example:
a, b, c = var('a,b,c')
eqn = a**2 + 3*b + c
I could use something like
coeffs = eqn.coefficients(a)
highest_order = coeffs[-1][1]
to find out the highest order of `a`. It would also be okay if i could figure out the order of every derivative of a given function in an equation. I can do this if I know before-hand what the order of the derivative is
function('f')
eqn += f(a,b,c).diff(a,b)
eqn.find(f(a,b,c).diff(a,b))
and see that in fact that derivative is there somewhere. But what I really want, is for
eqn = f(a,b,c).diff(a,b) + b*f(a,b,c).diff(b,3) + c
to have something that (a) tells me 'eqn has `[D[0,1](f)(a,b,c), D[1,1,1](f)(a,b,c)]`' or, (b) 'the highest order derivative of `eqn` is `D[1,1,1](f)(a,b,c)`'. jupsalTue, 26 Jul 2016 15:41:17 -0500http://ask.sagemath.org/question/34243/Solving zeta function equation numericallyhttp://ask.sagemath.org/question/33605/solving-zeta-function-equation-numerically/ I'm trying to solve the equation
$$ \zeta'(x)/\zeta(x) = - 3/4 $$
numerically. I'm expecting/hoping for an answer between 1 and 10.
I tried
$\texttt{ find_root(diff(zeta(x))/zeta(x) + 0.75, 2, 40)}$,
but this returns 0.0. I don't know what that ratio of zeta functions looks like, so it's possible there isn't a root, but I don't see why I'm getting an answer outside the specified interval.
Can anyone help find the true root? Thanks.
ec92Tue, 31 May 2016 18:07:50 -0500http://ask.sagemath.org/question/33605/finding the derivative of a functional w.r.t a functionhttp://ask.sagemath.org/question/32876/finding-the-derivative-of-a-functional-wrt-a-function/ I've defined a system as:
var('a, t');
function('x, y');
de1 = diff(x(t),t) == y(t);
de2 = diff(y(t),t) == -a*x(t) - (a-4)/a*y(t) - y(t)^3;
I'd like to compute the derivatives of the rhs of de1 and de2 w.r.t to x(t) and y(t) (to eventually form a Jacobian matrix), i.e. the derivative of the rhs of de1 w.r.t to x(t) is Zero and w.r.t y(t) is 1. I've tried the following:
diff(de1.rhs(),y);
diff(de1.rhs(),y(t));
derivative(de1.rhs(),y(t));
I get errors on all three. I'd appreciate any help. thank you.
sophiaThu, 24 Mar 2016 01:50:20 -0500http://ask.sagemath.org/question/32876/Is it possible to define (or assume) the derivative of a functionhttp://ask.sagemath.org/question/32669/is-it-possible-to-define-or-assume-the-derivative-of-a-function/ What i would like to do is define formal symbolic functions
`f1 = function('f1',latex_name = 'f_1')(x)`
and set their derivative or at least be able to substitute their derivative. As an example assume I defined f1,f2,f3,f4 then I would set dx f1 = f2+f3 and what I would expect is
f1.derivative(x)
to output
f2(x)+ f3(x)ywidmeThu, 25 Feb 2016 07:49:39 -0600http://ask.sagemath.org/question/32669/derivative of order var('m') returns 0http://ask.sagemath.org/question/30330/derivative-of-order-varm-returns-0/ Hello,
In mathematica I can differentiate a function m times with respect to x, where m doesn't have an explicit value yet and get an expression that can be evaluated as below:
<pre>
#MATHMATICA CODE
in[0] g = x^2 + 3/2*(x^2 - 1)*x
f = D[g, {x, m}]
out[0]= ∂(x,m)(3/2x(-1+x^2))+Power(m,0)[x,2]
in[1] f /. {m -> 2}
out[1]= 2+9x
</pre>
What I believe to be the equivalent code in sage will only give me 0 instead of an expression which I could then evaluate by setting m=2:
<pre>
#Sage example 1
sage: g = x^2 + 3/2*(x^2 - 1)*x
sage: var('m')
sage: diff(g,x,m)
0
</pre>
I know it is possible to differentiate a variable number of times due to the following:
<pre>
#Sage example 2
sage: diff((x^2-1)^n,x,n)
2*(x^2 - 1)^(n - 1)*n*x*log(x^2 - 1) + 2*(x^2 - 1)^(n - 1)*x
</pre>
I think that example 2 works because I have x raised to the power n.
Is it possible to accomplish the equivalent of what I did in mathematica in sage (i.e. have example 1 not return 0)?
Alternatively if this is not possible what advice do you have for how I could work on making this functionality exist?
Thanks in advance.
ianhiWed, 28 Oct 2015 22:34:28 -0500http://ask.sagemath.org/question/30330/How do i display a derivative using view()http://ask.sagemath.org/question/29671/how-do-i-display-a-derivative-using-view/ I can currently display the form of an integral in latex using:
f(x) = x + x^2
view( integral(f(x),x, hold=True) ) #displays the form of the derivative
But i can't figure out how to do it for a derivative:
f(x) = x + x^2
view( derivative(f(x),x, hold=True) ) #fails
view( derivative(f(x),x) ) # takes derivative then displays answer instead of the problem
Is their any easy way to do this? If not, whats the recommended way to fake it (inline latex etc)?gsonnenfFri, 02 Oct 2015 03:17:12 -0500http://ask.sagemath.org/question/29671/How to define the derivative of a functionhttp://ask.sagemath.org/question/28796/how-to-define-the-derivative-of-a-function/ Hello,
I want to tell Sage what expression to use for the derivative of a funtion *a*. This vould be something like this: *diff(a,t) = b^2*. But this doesn't do the trick...
**Example**
I want to define this set of differential quations:
- aDot = da/dt = b^2,
- bdot = db/da = u.
I want Sage to find the relation between *a* and *u*. For that Sage needs to differentiate *a* twice:
- diff(a,t,2)
But to be able to calculate d^2/d *t* ^2 *a* = d/d*t *b*^2 = 2 *bu*, Sage needs to to both differential equations.
How can I implemant that?
Thanks alot in advance for your replies!
JohannesjohannesK84Mon, 10 Aug 2015 00:03:28 -0500http://ask.sagemath.org/question/28796/Has ticket #6480 been fixed?http://ask.sagemath.org/question/27217/has-ticket-6480-been-fixed/The ticket is:
>.subs_expr() method doesn't work for argument of D derivative operator
Here is an example (from Sage 6.2, which I'm currently using):
var('x,y,f,F,Fx,Fy')
y = function('y',x)
f = function('f',x,y)
d1 = diff(f,x,1)
d1.subs_expr(diff(y,x,1)==F)
F*D[1](f)(x, y(x)) + D[0](f)(x, y(x))
So far, all good. But when I try:
d1.subs_expr(diff(y,x,1)==F,diff(f,x,1)==Fx,diff(f,y,1)==Fy)
I receive the error:
TypeError: argument symb must be a symbol
Maybe my syntax is wrong, so either my question is moot, in which case what am I doing wrong? Or maybe my syntax is correct and the fault is still a ticket for `subs_expr`. Advice as always would be very welcome!AlasdairSat, 27 Jun 2015 19:47:35 -0500http://ask.sagemath.org/question/27217/A simple problem related to symbolic calculationhttp://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 07:15:05 -0500http://ask.sagemath.org/question/26982/Matrix/Tensor derivative for Stress Tensorhttp://ask.sagemath.org/question/8119/matrixtensor-derivative-for-stress-tensor/I need to do define/calculate the following stress tensor in an elegant way:
$T_{i,j} := -p \delta_{i,j} + \eta (\partial_i v_j + \partial_j v_i)$
where i,j can be x,y,z and
$\partial_i v_j := \frac{\partial v_j}{\partial i}$
I've found the sage-function kronecker_delta for the first term, but I am having problems with the two partial derivatives.
Thanks in advance!packomanWed, 18 May 2011 10:20:46 -0500http://ask.sagemath.org/question/8119/declare name of derivativehttp://ask.sagemath.org/question/26377/declare-name-of-derivative/After defining a function depending on one variable as
v(t) = function('v', t);
Then v.diff() displays as
t ↦ D[0](v)(t)
Rather I would like to teach Sage that the derivative of v is a such that v.diff() is displayed as t↦a(t).
Can this be done?HaraldSun, 29 Mar 2015 10:16:10 -0500http://ask.sagemath.org/question/26377/Complex analysis. Compute bar derivativehttp://ask.sagemath.org/question/26279/complex-analysis-compute-bar-derivative/ Can sage do complex analysis? I was unable to find documentation upon a quick web search.
For instance, I would like to define $f(z) = z \bar{z}$ and ask sage to compute $\displaystyle \frac{\partial f}{\partial \bar{z}}$, is that possible?
Of course I could treat $z$ and $\bar{z}$ as independent variables, but that is not what I'm asking.SeubSun, 22 Mar 2015 08:10:44 -0500http://ask.sagemath.org/question/26279/Derivative of a functionhttp://ask.sagemath.org/question/25495/derivative-of-a-function/ Hi, I've got this two functions:
psi=function('psi',t)
psi_d=function('psi_d',t)
psi=(sin(delta(t))*v(t))/(l*cos(delta(t)))
psi_d=diff(psi)
but it says *No differentiation variable specified* how can I derivate psi? Please someone help me it's driving me crazy since yesterday!
Thank you very muchSilviaMon, 12 Jan 2015 05:52:24 -0600http://ask.sagemath.org/question/25495/how to compute inverse of function on sage?http://ask.sagemath.org/question/24352/how-to-compute-inverse-of-function-on-sage/can anyone help how do i get the inverse of function on sage
f(x) x^3+2x+1
and then the derivative of that.
ThanksfionaTue, 30 Sep 2014 16:42:10 -0500http://ask.sagemath.org/question/24352/Why is diff(conjugate(x),x) unevaluated?http://ask.sagemath.org/question/24027/why-is-diffconjugatexx-unevaluated/Or, can we differentiate holomorphic functions only?
Wirtinger defined two derivations in complex analysis for which we have:
diff(x,conjugate(x)) = 0
and
diff(conjugate(x),x) = 0.
http://en.wikipedia.org/wiki/Wirtinger_derivatives
Wirtinger calculus has important applications in optimization and has been extended to quaternion functions.
Is there any situation in which leaving diff(conjugate(x),x) unevaluated is an advantage?Bill Page _ againTue, 02 Sep 2014 20:25:09 -0500http://ask.sagemath.org/question/24027/derivative of x^nhttp://ask.sagemath.org/question/23779/derivative-of-xn/ I am working with polynomials. I'd like to compute the symbolic derivative of a monomial with symbolic coefficients, that is something like
derivative(x^n,x)
So that the output is
nx^(n-1)
Is this possible?
**Edit:** My first try was of course to use:
diff(x^n,x)
or
derivative(x^n,x)
but I get the error
TypeError: non-integral exponents not supported
hildejkThu, 14 Aug 2014 07:29:44 -0500http://ask.sagemath.org/question/23779/derivative of MPolynomial_polydicthttp://ask.sagemath.org/question/11364/derivative-of-mpolynomial_polydict/In a for loop I generate a list of functions, then I take their derivatives with respect to different variables. For example, in the follwoing, `Y[0,0]` is a 'MPolynomial_polydict', and is equal to
x_0_1*x_0_1 + x_0_0*x_1_1 + x_0_2*x_0_2 + x_1_2*x_1_2 + x_0_0*x_2_2 + x_1_1*x_2_2 - 1.00000000000000
and `list_of_variables[0] = x_0_1`. When I take the derivative of the mentioned polynomial with respect to the mentioned variable I should get `2*x_0_1`, but instead I get:
sage: derivative(Y[0,0],list_of_variables[0])
x_0_1
When I try this manually, it gives me the correct answer though:
sage: derivative(x_0_1*x_0_1 + x_0_0*x_1_1 + x_0_2*x_0_2 + x_1_2*x_1_2 + x_0_0*x_2_2 + x_1_1*x_2_2 - 1.00000000000000,x_0_1)
2*x_0_1
So, for some reason it considers the two x_0_1's in the first term of my polynomial as independent variables when I construct them automatically. Any ideas on why this problem arises, and how to fix this?
**Edit:**
This is how I build my vaiables:
names = [ [[] for i in range(n)] for j in range(n) ]
for i in range(n):
for j in range(i+1):
names[i][j] = (SR('x_' + str(j) + '_' + str(i)))
names[j][i] = (SR('x_' + str(j) + '_' + str(i)))
R = PolynomialRing(CC,names[i][j] for i in range(n) for j in range(n)])
R.gens()
R.inject_variables()
**More edit:**
Here is a the complete code:
#########################################################################
# Build variables, and the matrix corresponding to it
#########################################################################
def build_variables(n):
names = [ [[] for i in range(n)] for j in range(n) ]
for i in range(n):
for j in range(i+1):
names[i][j] = (SR('x_' + str(j) + '_' + str(i)))
names[j][i] = (SR('x_' + str(j) + '_' + str(i)))
return(names)
#########################################################################
# Define the function f that maps a matrix to the coefficients of its characteristic polynomial
#########################################################################
def CharPoly(Mat):
X = matrix(Mat)
n = X.ncols()
C_X = X.characteristic_polynomial()
Y = []
for i in range(n):
Y.append(C_X[i])
return(Y)
############################################################################
# This solves that lambda problem
############################################################################
def lambda_siep(G,L,iter=100,epsilon = .1):
# G is any graph on n vertices
# L is the list of n desired distinct eigenvalues
# m is the number of itterations of the Newton's method
# epsilon: the off-diagonal entries will be equal to epsilon
n = G.order()
my_variables = build_variables(n)
R = PolynomialRing(CC,[my_variables[i][j] for i in range(n) for j in range(n)])
R.gens()
R.inject_variables()
X = [ [ R.gens()[n*i+j] for i in range(n) ] for j in range(n) ]
Y = matrix(CharPoly(X)) - matrix(CharPoly(diagonal_matrix(L)))
J = matrix(R,n)
for i in range(n):
for j in range(n):
J[i,j] = derivative(Y[0][i],my_variables[j][j])
B = diagonal_matrix(L) + epsilon * G.adjacency_matrix()
count = 0
while count < iter:
T = [ B[i,j] for i in range(n) for j in range(n)]
C = (J(T)).solve_right(Y(T).transpose())
LC = list(C)
B = B - diagonal_matrix([LC[i][0] for i in range(n)])
count = count + 1
return(B)k1Mon, 28 Apr 2014 19:27:25 -0500http://ask.sagemath.org/question/11364/derivative of multivariate equation with nested sumhttp://ask.sagemath.org/question/10869/derivative-of-multivariate-equation-with-nested-sum/Hello,
I often have to deal with functions like the one below, take derivatives and
so on. I would really like to know if I could use a CAS like SAGE to do this tedious and error prone calculations but I couldn't find a similar kind of function in the docs and tutorials.
My questions are:
* how can I write this function in SAGE ?
for $x\in \mathbf{R}^p; v \in \mathbf{R}^{p \times k}$
$$y(x, v) := \sum^p_{i=1} \sum^p_{j>i} \sum_{f=1}^k v_{i,f} v_{j,f} x_i x_j =
\sum^p_{i=1} \sum^p_{j>i} \langle v_{:,i}, v_{;,j} \rangle x_i x_j$$
* calculate the partial derivatives $\frac{\partial y(x,v)}{\partial v_{i,j}}$ ?
* or the the derivative with respect to the column-vector $\frac{\partial y(x,v)}{\partial v_{:, i} }$ ?
Or is there a better way to work with this kind of function in SAGE? (the function above is only an example)
ThanksibayerMon, 30 Dec 2013 06:36:27 -0600http://ask.sagemath.org/question/10869/Matrix equations and derivativeshttp://ask.sagemath.org/question/10759/matrix-equations-and-derivatives/Hello!
I am completely new to Sage and Python.
In order to get knowledge about Sage I'd like to find a way to express an equations like these
http://stats.stackexchange.com/questions/14827/how-to-calculate-derivative-of-the-contractive-auto-encoder-regularization-term
User with nickname fabee had posted derivatives of contractive autoencoder regularizer, and I want to reproduce these results in Sage. It's a big challenge for Sage newbies like me.
A few first attempts do not succeed so can you show me the way to do this task?
newbieThu, 21 Nov 2013 01:25:00 -0600http://ask.sagemath.org/question/10759/vector derivative returns a scalarhttp://ask.sagemath.org/question/10456/vector-derivative-returns-a-scalar/Trying to obtain the derivative of $\vec{u} = [-1,1]$ using the following code:
> u = matrix(1,2,[-1, 1])
>
> r = derivative(u,x);
> r
I get a scalar value 0.
Although according the following relation it should be a 2-dimensional zero vector.
$$\frac{\mathrm{d} \vec{u}}{\mathrm{d} x} =\frac{\mathrm{d}}{\mathrm{d} x} [-1, 1] = [ \frac{\mathrm{d}}{\mathrm{d} x}(-1), \frac{\mathrm{d}}{\mathrm{d} x}(1) ] = [0, 0]$$
Why does it happen? In the case it's a bug where could I report it?
Thanks
TomasMon, 19 Aug 2013 05:38:26 -0500http://ask.sagemath.org/question/10456/Computing derivativeshttp://ask.sagemath.org/question/10438/computing-derivatives/Hey guys,
I dont know where the problem is, but sage (5.10 here) doesnt compute easy derivatives as e.g.
x = var('x')
f = sqrt(x)
diff(f,x)
This leads to the following error:
TypeError: unable to simplify to float approximation
Whats the problem here?pinwheelThu, 15 Aug 2013 06:46:42 -0500http://ask.sagemath.org/question/10438/How to substitute a function within derivatives?http://ask.sagemath.org/question/9932/how-to-substitute-a-function-within-derivatives/I want to simplify an ODE by making a substitution, say g(x) -> h(x)*x, but can't get it to work. I tried:
g=function('g', x)
h=function('h', x)
dg = g.diff(x)
dg
sage output: D[0](g)(x)
dg.subs(g==h*x)
sage output: D[0](g)(x)
The substitution is not done for the g function within derivatives. I tried dg.subs(g(x)==h(x)*x) too, got deprecation warnings and the same results. How can I make this work? This is a simplified example, in reality, instead of dg, I have the lhs of an ODE defined interms of g(x).
Thanks
sgiaThu, 21 Mar 2013 17:59:28 -0500http://ask.sagemath.org/question/9932/eigenvalues of a derivative vs derivative of eigenvalueshttp://ask.sagemath.org/question/9543/eigenvalues-of-a-derivative-vs-derivative-of-eigenvalues/Hi! I have this little problem. If anyone would be so kind to share his knowledge and shed some lite on it, I'd be very grateful. Big thanks in advance (and sorry for my english)!
I have a matrix M=M(x) depending on a variable x. I want sage to compute trace of a product of a derivative of M, M' and some function of it, f(M), at a fixed value of x=x_0; that is:
(tr[M'*f(M)])|_(x=x_0).
It just so happens that tr[M'*f(M)] = sum( ev_i' *f(ev_i) ), where {ev_i(x)} are eigenvalues of M. Lucky me. Diagonalisation of M commutes with differentiating or taking the function of it, one could say.
But my M and its derivative are somewhat complicated, yet simplify greatly after substituting x=x_0. So I would very much prefer first to compute M', substitute x_0 M0:=M|_(x=x_0) and M'0:=M'|_(x=x_0), and only after that ask sage for eigenvalues:
ev1=M0.eigenvalues()
ev2=M'0.eigenvalues()
So here's the question: do i have any reason for hoping that:
(tr[M'*f(M)])|_(x=x_0) = sum( ev2[i] *f(ev1[i]) for i in range(dim of M) )?
(That is, wether the order of eigenvalues changes if I exchange diagonalisation with differentiation?)ozikSat, 17 Nov 2012 12:18:33 -0600http://ask.sagemath.org/question/9543/How to plot derivative and antiderivative of a splinehttp://ask.sagemath.org/question/9491/how-to-plot-derivative-and-antiderivative-of-a-spline/Suppose I have a spline like that:
from sage.gsl.all import spline
values = [(-3,-2),(-2,0),(1,2),(3,1),(4,5)]
interpolation = spline(values)
plot(interpolation,(-3,5)) + list_plot(values)
![output](/upfiles/1351772799931024.png)
What's the easiest way to plot the derivative and the antiderivative functions of the spline?
Note that I want just the plot, not a symbolic expression of both, so numerical methods should apply. However getting a symbolic expression would be the best.
How can I find maxima, minima and roots of the spline? Numerically would be good enough.sagefanThu, 01 Nov 2012 00:20:14 -0500http://ask.sagemath.org/question/9491/