Skip to content

Commit 8899a78

Browse files
committed
Markdown
1 parent eb796f4 commit 8899a78

File tree

5 files changed

+291
-20
lines changed

5 files changed

+291
-20
lines changed

symja_android_library/doc/functions/D.md

Lines changed: 95 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,106 @@ D(f, x)
55
```
66
> gives the partial derivative of `f` with respect to `x`.
77
8+
9+
```
10+
D(f, x, y, ...)
11+
```
12+
> differentiates successively with respect to `x`, `y`, etc.
13+
814
```
915
D(f, {x,n})
1016
```
11-
> gives the `n`th derivative of `f` with respect to `x`.
12-
17+
> gives the multiple derivative of order `n`.
18+
19+
```
20+
D(f, {{x1, x2, ...}})
21+
```
22+
> gives the vector derivative of `f` with respect to `x1`, `x2`, etc.
23+
1324
**Note**: the upper case identifier `D` is different from the lower case identifier `d`.
1425

15-
### Examples
16-
17-
```
18-
>> D(Sin(x),x)
19-
Cos(x)
26+
### Examples
27+
First-order derivative of a polynomial:
28+
```
29+
>> D(x^3 + x^2, x)
30+
2*x+3*x^2
31+
```
32+
33+
Second-order derivative:
34+
```
35+
>> D(x^3 + x^2, {x, 2})
36+
2+6*x
37+
```
38+
39+
Trigonometric derivatives:
2040
```
41+
>> D(Sin(Cos(x)), x)
42+
-Cos(Cos(x))*Sin(x)
43+
44+
>> D(Sin(x), {x, 2})
45+
-Sin(x)
46+
47+
>> D(Cos(t), {t, 2})
48+
-Cos(t)
49+
```
2150

51+
Unknown variables are treated as constant:
52+
```
53+
>> D(y, x)
54+
0
55+
56+
>> D(x, x)
57+
1
58+
59+
>> D(x + y, x)
60+
1
61+
```
62+
63+
Derivatives of unknown functions are represented using 'Derivative':
64+
```
65+
>> D(f(x), x)
66+
f'(x)
67+
68+
>> D(f(x, x), x)
69+
Derivative(0,1)[f][x,x]+Derivative(1,0)[f][x,x]
70+
```
71+
72+
Chain rule:
73+
```
74+
>> D(f(2*x+1, 2*y, x+y)
75+
2*Derivative(1,0,0)[f][1+2*x,2*y,x+y]+Derivative(0,0,1)[f][1+2*x,2*y,x+y]
76+
77+
>> D(f(x^2, x, 2*y), {x,2}, y) // Expand
78+
2*Derivative(0,2,1)[f][x^2,x,2*y]+4*Derivative(1,0,1)[f][x^2,x,2*y]+8*x*Derivative(
79+
1,1,1)[f][x^2,x,2*y]+8*x^2*Derivative(2,0,1)[f][x^2,x,2*y]
80+
```
81+
82+
Compute the gradient vector of a function:
2283
```
23-
>> D(x^5,{x,2})
24-
20*x^3
25-
```
84+
>> D(x ^ 3 * Cos(y), {{x, y}})
85+
{3*x^2*Cos(y),-x^3*Sin(y)}
86+
```
87+
88+
Hesse matrix:
89+
```
90+
>> D(Sin(x) * Cos(y), {{x,y}, 2})
91+
{{-Cos(y)*Sin(x),-Cos(x)*Sin(y)},{-Cos(x)*Sin(y),-Cos(y)*Sin(x)}}
92+
93+
>> D(2/3*Cos(x) - 1/3*x*Cos(x)*Sin(x) ^ 2,x)//Expand
94+
1/3*x*Sin(x)^3-1/3*Sin(x)^2*Cos(x)-2/3*Sin(x)-2/3*x*Cos(x)^2*Sin(x)
95+
96+
>> D(f(#1), {#1,2})
97+
f''(#1)
98+
99+
>> D((#1&)(t),{t,4})
100+
0
101+
102+
>> Attributes(f) = {HoldAll}; Apart(f''(x + x))
103+
f''(2*x)
104+
105+
>> Attributes(f) = {}; Apart(f''(x + x))
106+
f''(2*x)
107+
108+
>> D({#^2}, #)
109+
{2*#1}
110+
```
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## Derivative
2+
3+
```
4+
Derivative(n)[f]
5+
```
6+
> represents the `n`-th derivative of the function `f`.
7+
8+
```
9+
Derivative(n1, n2, n3,...)[f]
10+
```
11+
> represents a multivariate derivative.
12+
13+
### Examples
14+
```
15+
>> Derivative(1)[Sin]
16+
Cos(#1)&
17+
18+
>> Derivative(3)[Sin]
19+
-Cos(#1)&
20+
21+
>> Derivative(2)[# ^ 3&]
22+
6*(#1&)
23+
```
24+
25+
`Derivative` can be entered using `'`:
26+
```
27+
>> Sin'(x)
28+
Cos(x)
29+
30+
>> (# ^ 4&)''
31+
12*(#1^2&)
32+
33+
>> f'(x) // FullForm
34+
"Derivative(1)[f][x]"
35+
```
36+
37+
The `0`th derivative of any expression is the expression itself:
38+
```
39+
>> Derivative(0,0,0)[a+b+c]
40+
a+b+c
41+
```
42+
43+
Unknown derivatives:
44+
```
45+
>> Derivative(2, 1)[h]
46+
Derivative(2,1)[h]
47+
48+
>> Derivative(2, 0, 1, 0)[h(g)]
49+
Derivative(2,0,1,0)[h(g)]
50+
```

symja_android_library/doc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ Documentation can be displayed by asking for information for the function name.
241241
* [DeleteDuplicates](functions/DeleteDuplicates.md)
242242
* [Denominator](functions/Denominator.md)
243243
* [Depth](functions/Depth.md)
244+
* [Derivative](functions/Derivative.md)
244245
* [DesignMatrix](functions/DesignMatrix.md)
245246
* [Det](functions/Det.md)
246247
* [DiagonalMatrix](functions/DiagonalMatrix.md)

symja_android_library/matheclipse-core/src/main/resources/D.md

Lines changed: 95 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,106 @@ D(f, x)
55
```
66
> gives the partial derivative of `f` with respect to `x`.
77
8+
9+
```
10+
D(f, x, y, ...)
11+
```
12+
> differentiates successively with respect to `x`, `y`, etc.
13+
814
```
915
D(f, {x,n})
1016
```
11-
> gives the `n`th derivative of `f` with respect to `x`.
12-
17+
> gives the multiple derivative of order `n`.
18+
19+
```
20+
D(f, {{x1, x2, ...}})
21+
```
22+
> gives the vector derivative of `f` with respect to `x1`, `x2`, etc.
23+
1324
**Note**: the upper case identifier `D` is different from the lower case identifier `d`.
1425

15-
### Examples
16-
17-
```
18-
>> D(Sin(x),x)
19-
Cos(x)
26+
### Examples
27+
First-order derivative of a polynomial:
28+
```
29+
>> D(x^3 + x^2, x)
30+
2*x+3*x^2
31+
```
32+
33+
Second-order derivative:
34+
```
35+
>> D(x^3 + x^2, {x, 2})
36+
2+6*x
37+
```
38+
39+
Trigonometric derivatives:
2040
```
41+
>> D(Sin(Cos(x)), x)
42+
-Cos(Cos(x))*Sin(x)
43+
44+
>> D(Sin(x), {x, 2})
45+
-Sin(x)
46+
47+
>> D(Cos(t), {t, 2})
48+
-Cos(t)
49+
```
2150

51+
Unknown variables are treated as constant:
52+
```
53+
>> D(y, x)
54+
0
55+
56+
>> D(x, x)
57+
1
58+
59+
>> D(x + y, x)
60+
1
61+
```
62+
63+
Derivatives of unknown functions are represented using 'Derivative':
64+
```
65+
>> D(f(x), x)
66+
f'(x)
67+
68+
>> D(f(x, x), x)
69+
Derivative(0,1)[f][x,x]+Derivative(1,0)[f][x,x]
70+
```
71+
72+
Chain rule:
73+
```
74+
>> D(f(2*x+1, 2*y, x+y)
75+
2*Derivative(1,0,0)[f][1+2*x,2*y,x+y]+Derivative(0,0,1)[f][1+2*x,2*y,x+y]
76+
77+
>> D(f(x^2, x, 2*y), {x,2}, y) // Expand
78+
2*Derivative(0,2,1)[f][x^2,x,2*y]+4*Derivative(1,0,1)[f][x^2,x,2*y]+8*x*Derivative(
79+
1,1,1)[f][x^2,x,2*y]+8*x^2*Derivative(2,0,1)[f][x^2,x,2*y]
80+
```
81+
82+
Compute the gradient vector of a function:
2283
```
23-
>> D(x^5,{x,2})
24-
20*x^3
25-
```
84+
>> D(x ^ 3 * Cos(y), {{x, y}})
85+
{3*x^2*Cos(y),-x^3*Sin(y)}
86+
```
87+
88+
Hesse matrix:
89+
```
90+
>> D(Sin(x) * Cos(y), {{x,y}, 2})
91+
{{-Cos(y)*Sin(x),-Cos(x)*Sin(y)},{-Cos(x)*Sin(y),-Cos(y)*Sin(x)}}
92+
93+
>> D(2/3*Cos(x) - 1/3*x*Cos(x)*Sin(x) ^ 2,x)//Expand
94+
1/3*x*Sin(x)^3-1/3*Sin(x)^2*Cos(x)-2/3*Sin(x)-2/3*x*Cos(x)^2*Sin(x)
95+
96+
>> D(f(#1), {#1,2})
97+
f''(#1)
98+
99+
>> D((#1&)(t),{t,4})
100+
0
101+
102+
>> Attributes(f) = {HoldAll}; Apart(f''(x + x))
103+
f''(2*x)
104+
105+
>> Attributes(f) = {}; Apart(f''(x + x))
106+
f''(2*x)
107+
108+
>> D({#^2}, #)
109+
{2*#1}
110+
```
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## Derivative
2+
3+
```
4+
Derivative(n)[f]
5+
```
6+
> represents the `n`-th derivative of the function `f`.
7+
8+
```
9+
Derivative(n1, n2, n3,...)[f]
10+
```
11+
> represents a multivariate derivative.
12+
13+
### Examples
14+
```
15+
>> Derivative(1)[Sin]
16+
Cos(#1)&
17+
18+
>> Derivative(3)[Sin]
19+
-Cos(#1)&
20+
21+
>> Derivative(2)[# ^ 3&]
22+
6*(#1&)
23+
```
24+
25+
`Derivative` can be entered using `'`:
26+
```
27+
>> Sin'(x)
28+
Cos(x)
29+
30+
>> (# ^ 4&)''
31+
12*(#1^2&)
32+
33+
>> f'(x) // FullForm
34+
"Derivative(1)[f][x]"
35+
```
36+
37+
The `0`th derivative of any expression is the expression itself:
38+
```
39+
>> Derivative(0,0,0)[a+b+c]
40+
a+b+c
41+
```
42+
43+
Unknown derivatives:
44+
```
45+
>> Derivative(2, 1)[h]
46+
Derivative(2,1)[h]
47+
48+
>> Derivative(2, 0, 1, 0)[h(g)]
49+
Derivative(2,0,1,0)[h(g)]
50+
```

0 commit comments

Comments
 (0)