Getting MATLAB/muPad to recognize and treat variables in a custom manner

2 Ansichten (letzte 30 Tage)
Kobye
Kobye am 23 Jul. 2013
I have a symbolic vector that looks as follows:
n=4;
syms x y z
B = sym(zeros(n, 1));
for k=0:n
B(k+1) = sym(sprintf('B_2_%d',k));
end
B=[B;zeros(n,1)]
The entries in vector B of the format B_{#}_{#} are special objects, in the sense that they are differentiated in a special manner. This special rule is given below:
d/dx(B_{k}_{n}(x)) = n * ( B_{k-1}_{n-1}(x) - B_{k}_{n-1}(x) ) - eqn.(1)*
*note that this is not matlab syntax, but just mathematical notation
Any other symbols should be treated as they would normally be, as symbols. So, let me give an example of what should ideally happen, following eqn. (1):
diff(B_2_4,x) = 2 * (B_1_3 - B_2_3)
another example, this time including some extra, normal terms:
diff(B_2_4 + x^3 - 2*x^2 ,x) = 2 * (B_1_3 - B_2_3) + 3*x^2 - 4*x
How can I get muPad to recognize these variables as special objects, that may be part of a larger symbolic expression, and treat them by the special rule I have described? i.e. they should inherit the properties of a symbolic variable, except for differentiation which should occur in the way described above.

Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by