atlas[Functions] - declaration of functions 

Calling Sequence: 

    Functions(F1=F1(x1, x2, ...,xn), F2=F2(y1, y2, ..., ym), ..., Fk=Fk(z1, z2, ..., zj)) 

Parameters: 

    Fk=Fk(z1, z2, ..., zj) - equations where Fk-function identifier and zj - variables. 

Description: 

  • In the atlas package any identifier is treated as 0-form i.e. as non-constant scalar (if it not declared as constant, p-form, tensor etc. (see atlas[types])).
 

  • The Functions procedure allows one to declare functions. In the atlas package a function is non-constant 0-form which depends on other 0-forms.
 

  • There are two different syntaxes for function declaration.
 

  • Use the first form f=f(x,y,z) to declare a function f depending on x, y, and z;
 

  • Use the second form F=F(x[i]) i.e. F = F(x[i]) to declare a function F depending on x[i] if the working dimension is numeric or x[1], x[2], () .. x[n] if the dimension is symbolic (see atlas[dim]).
 

  • The function identifiers can be either symbolic or indexed values (see examples below).
 

Examples: 

> restart:
with(atlas):
 

Declare alpha[j] as a constant: 

> Constants(alpha[k]);
 

{`+`(`-`(I)), I, Pi, _Z, Catalan, alpha[k]}(2.1)
 

Declare H[i], alpha[i, j], F, z, f, h as functions:  

> Functions(f=f(x,y),h=h(phi,psi,chi),z=z(f,h),F=F(x[i]),
H[i]=H[i](x,y,x[k],y[j]),alpha[i,j]=alpha[i,j](x[k]));
 

{F, f, h, z, H[i], alpha[i, j]}(2.2)
 

Varify that f is a function using exterior derivative operator (see atlas[d]):  

> 'd(f)'=d(f);
 

d(f) = `+`(`*`(Diff(f, x), `*`(d(x))), `*`(Diff(f, y), `*`(d(y))))(2.3)
 

Verify that h is a function: 

> 'd(h)'=d(h);
 

d(h) = `+`(`*`(Diff(h, phi), `*`(d(phi))), `*`(Diff(h, psi), `*`(d(psi))), `*`(Diff(h, chi), `*`(d(chi))))(2.4)
 

Another example:  

> 'd(z)'=d(z);
 

d(z) = `+`(`*`(Diff(z, f), `*`(`+`(`*`(Diff(f, x), `*`(d(x))), `*`(Diff(f, y), `*`(d(y)))))), `*`(Diff(z, h), `*`(`+`(`*`(Diff(h, phi), `*`(d(phi))), `*`(Diff(h, psi), `*`(d(psi))), `*`(Diff(h, chi), ...
d(z) = `+`(`*`(Diff(z, f), `*`(`+`(`*`(Diff(f, x), `*`(d(x))), `*`(Diff(f, y), `*`(d(y)))))), `*`(Diff(z, h), `*`(`+`(`*`(Diff(h, phi), `*`(d(phi))), `*`(Diff(h, psi), `*`(d(psi))), `*`(Diff(h, chi), ...
(2.5)
 

Some more examples
'd(F)'=d(F); 

d(F) = Sum(`*`(Diff(F, x[l[1]]), `*`(d(x[l[1]]))), l[1] = 1 .. dim)(2.6)
 

> 'd(f*F)'=d(f*F);
 

d(`*`(f, `*`(F))) = `+`(`*`(`+`(`*`(Diff(f, x), `*`(d(x))), `*`(Diff(f, y), `*`(d(y)))), `*`(F)), `*`(f, `*`(Sum(`*`(Diff(F, x[l[2]]), `*`(d(x[l[2]]))), l[2] = 1 .. dim))))(2.7)
 

As H[i] = H[i](x, y, x[k], y[j]) then: 

> 'd(H[j])'=d(H[j]);
 

d(H[j]) = `+`(`*`(Diff(H[j], x), `*`(d(x))), `*`(Diff(H[j], y), `*`(d(y))), Sum(`*`(Diff(H[j], x[l[1]]), `*`(d(x[l[1]]))), l[1] = 1 .. dim), Sum(`*`(Diff(H[j], y[l[1]]), `*`(d(y[l[1]]))), l[1] = 1 .. ...
d(H[j]) = `+`(`*`(Diff(H[j], x), `*`(d(x))), `*`(Diff(H[j], y), `*`(d(y))), Sum(`*`(Diff(H[j], x[l[1]]), `*`(d(x[l[1]]))), l[1] = 1 .. dim), Sum(`*`(Diff(H[j], y[l[1]]), `*`(d(y[l[1]]))), l[1] = 1 .. ...
(2.8)
 

But H[i, j] and H are just 0-forms: 

> 'd(H[i,j])'=d(H[i,j]);
'd(H)'=d(H);
 

 

d(H[i, j]) = d(H[i, j])
d(H) = d(H)(2.9)
 

As alpha[i, j] = alpha[i, j](x[k])  then: 

> 'd(alpha[n,m])'=d(alpha[n,m]);
 

d(alpha[n, m]) = Sum(`*`(Diff(alpha[n, m], x[l[1]]), `*`(d(x[l[1]]))), l[1] = 1 .. dim)(2.10)
 

As alpha[i] is a constant then: 

> 'd(alpha[i])'=d(alpha[i]);
 

d(alpha[i]) = 0(2.11)
 

But: 

> 'd(alpha[i,j,k])'=d(alpha[i,j,k]);
 

d(alpha[i, j, k]) = d(alpha[i, j, k])(2.12)
 

And more - using exterior product operator (see atlas[`&^`]): 

> 'd(f)&^d(phi)'=d(f)&^d(phi);
 

`&^`(d(f), d(phi)) = `+`(`-`(`*`(Diff(f, x), `*`(`&^`(d(phi), d(x))))), `-`(`*`(Diff(f, y), `*`(`&^`(d(phi), d(y))))))
`&^`(d(f), d(phi)) = `+`(`-`(`*`(Diff(f, x), `*`(`&^`(d(phi), d(x))))), `-`(`*`(Diff(f, y), `*`(`&^`(d(phi), d(y))))))
(2.13)
 

Some trivial examples: 

> 'd(exp(-x^2)+cos(y))'=d(exp(-x^2)+cos(y));
 

d(`+`(exp(`+`(`-`(`*`(`^`(x, 2))))), cos(y))) = `+`(`-`(`*`(2, `*`(exp(`+`(`-`(`*`(`^`(x, 2))))), `*`(x, `*`(d(x)))))), `-`(`*`(sin(y), `*`(d(y)))))(2.14)
 

> 'd(f*x^3)'=d(f*x^3);
 

d(`*`(f, `*`(`^`(x, 3)))) = `+`(`*`(`+`(`*`(Diff(f, x), `*`(d(x))), `*`(Diff(f, y), `*`(d(y)))), `*`(`^`(x, 3))), `*`(3, `*`(f, `*`(`^`(x, 2), `*`(d(x))))))(2.15)
 

And not so trivial ones (n - was not declared as a constant!): 

> 'd(f^n)'=d(f^n);
 

d(`^`(f, n)) = `+`(`*`(n, `*`(`^`(f, `+`(n, `-`(1))), `*`(`+`(`*`(Diff(f, x), `*`(d(x))), `*`(Diff(f, y), `*`(d(y))))))), `*`(`^`(f, n), `*`(ln(n), `*`(d(n)))))(2.16)
 

Declare lambda as a constant (see atlas[Constants]):
Constants(lambda); 

{`+`(`-`(I)), I, Pi, _Z, Catalan, lambda, alpha[k]}(2.17)
 

Thus:
'd(f^lambda)'=d(f^lambda); 

d(`^`(f, lambda)) = `*`(lambda, `*`(`^`(f, `+`(lambda, `-`(1))), `*`(`+`(`*`(Diff(f, x), `*`(d(x))), `*`(Diff(f, y), `*`(d(y)))))))(2.18)
 

Let's see "who is who" 

> Who([f,h,x,y,z,lambda]);
 

f: function
h: function
x: 0 - form
y: 0 - form
z: function
lambda: constant
 

> Who();
 

piecewise(Domains, {}, Mappings, {}, Tensors, {}, Forms, {}, Constants, {`+`(`-`(I)), I, Pi, _Z, Catalan, lambda, alpha[k]}, Functions, {F, f, h, z, H[i], alpha[i, j]})(2.19)
 

>
 

See Also:  

atlas, atlas[Constants], atlas[Forms], atlas[Vectors], atlas[Tensors], atlas[d], atlas[`&^`], atlas[Who].