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.Wed, 20 Apr 2022 06:20:22 +0200Non-dimensionalization of a Partial Differential Equationhttps://ask.sagemath.org/question/62056/non-dimensionalization-of-a-partial-differential-equation/Hello all, I am interested in replacing the variables of a Partial Differential Equation (PDE) for their non-dimensional counterparts and then group together the dimensionless numbers. I think I would only need to be able to replace the variables and also the derivative operators (as in a change of variables $\hat{x}=x/L$), grouping the dimensionless numbers can be done by hand.
It is a similar procedure to what is being done here: (en.wikipedia.org/wiki/Non-dimensionalization_and_scaling_of_the_Navier%E2%80%93Stokes_equations) . I was wondering if this can be done with SAGE.salazardetroyaWed, 20 Apr 2022 06:20:22 +0200https://ask.sagemath.org/question/62056/Partial evaluation of a MV Polynomial.https://ask.sagemath.org/question/61402/partial-evaluation-of-a-mv-polynomial/I have a polynomial defined as:
q = next_prime(2^128)
P.< x1, x2, x3, x4, x5> = GF(q)[]
p = (x1*x2) + (x3*x4)
I would like to obtain the resulting polynomial by partially evaluating by some variables.
Example partial polynomial p' generated by evaluating p at x2 = 2:
p' = (2*x1) + (x3*x4)
Is there a way to accomplish this?cryptoqsSat, 05 Mar 2022 15:29:56 +0100https://ask.sagemath.org/question/61402/Partial derivative and chain rulehttps://ask.sagemath.org/question/60272/partial-derivative-and-chain-rule/I have the following variable and function:
var('r')
g = function('g')(r)
Now, I define the function `f`, which depends on `g`:
f = function('f')(g)
If I want to compute the derivative `diff(f,r)`, I get:
D[0](f)(g(r))*diff(g(r), r)
which is the usual chain rule. However, if I want the derivative with respect to `g`:
diff(f,g)
I get an error:
> TypeError: argument symb must be a symbol
Is there a way I can calculate the partial derivative of a function? I would expect a symbolic expression, like
$\\displaystyle \\frac{\\partial f}{\\partial g}$
I have seen that in [REDUCE](https://reduce-algebra.sourceforge.io/) there is the package [DFPART](https://reduce-algebra.sourceforge.io/reduce38-docs/dfpart.pdf) which accounts for derivatives with respect to generic functions, but I have not found an analogous module in SageMath.kekoWed, 15 Dec 2021 12:59:18 +0100https://ask.sagemath.org/question/60272/Evaluate partial derivativehttps://ask.sagemath.org/question/54029/evaluate-partial-derivative/I have a function `B(x,y)` and I have an expression `f` in which this function appears.
B(x, y) = function('B')(x, y)
f = B(v_m, v)*theta/(B(v_m,v) + theta)
g = f.diff(v_m)
I now have an expression, `g`, which involves the partial derivative of `B` w.r.t `v_m` , and I would like to evaluate this entire expression, including the partial derivative, at `v_m == v`.
I can do `g.substitute(v_m == v)` or `at(g, v_m == v)` but both of these just change the expression to give me the partial derivative of `B` with respect to `v`, which is not what I want.
Do I need to explicitly define that the partial derivative is a function somehow? I would like to be able to use this expression I have containing the partial derivative and evaluate it as if it is a function, where the output contains the value of the derivative of `B` w.r.t. `v_m`, evaluated at the input, in the context of the rest of the expression evaluated at that input.
In other words, in the latex representation, I'd like the notation to preserve the expression of the partial derivative and then have the vertical bar on the right hand side to indicate it's being evaluated at a particular point, or in this case, another variable. Here is the latex representation that I'm looking for, for the part of the expression involving the partial derivative:
$$
\\frac{\\partial}{\\partial v_{m}}B\\left(v_{m}, v\\right) \\Bigr\\rvert_{v_m = v}
$$jgrohSun, 25 Oct 2020 22:43:47 +0100https://ask.sagemath.org/question/54029/Matrix/Tensor derivative for Stress Tensorhttps://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 17:20:46 +0200https://ask.sagemath.org/question/8119/Matrix equations and derivativeshttps://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 08:25:00 +0100https://ask.sagemath.org/question/10759/partial fraction decomposition function for multivariate rational expressionshttps://ask.sagemath.org/question/8429/partial-fraction-decomposition-function-for-multivariate-rational-expressions/Hi all:
I'd like to extend Sage's partial fraction decomposition function in the QuotientField class to a function that works on quotients of *multivariate* polynomials. To this end, i've found it convenient to store a rational expression $F = P/(Q_1^{e_1} \cdots Q_m^{e_m})$ as a Python list of the form [P,[Q_1,e_1],...,[Q_m,e_m]], where $Q_1,\ldots,Q_m$ are the irreducible factors of $F$'s denominator. Let's call these special kinds of lists 'widgets'. I have several auxiliary functions that manipulate widgets.
Code design questions for you. Should i make a new class for widgets, and if so, where in the Sage tree of modules should i put this class? If not, where do i put the auxiliary functions that manipulate widgets?
Thanks for your attention.
Alex araichevWed, 02 Nov 2011 19:11:23 +0100https://ask.sagemath.org/question/8429/