zenterix

405 Reputation

5 Badges

3 years, 126 days

MaplePrimes Activity


These are questions asked by zenterix

Why does sqrt(-2) give as a result only i*sqrt(2)?

Why does the result not also include -i*sqrt(2)?

Suppose we have the following simple Matrix

T := <1,2;3,4>;

How do we replace an entry with another expression?

I know that for a list L := [1,2,3] we can do, for example subsop(2=500,L) to replace the entry at index 2.

This creates a new list since lists are immutable.

As far as I can tell, a Matrix is mutable.

However, I wish to change an entry in a Matrix without mutating it.

My actual use case is the following.

I use LinearAlgebra:-Eigenvectors to obtain a Matrix of eigenvectors. Some of the entries are huge expressions with many variables. I would like to sub in placeholders where these huge expressions are so I can visualize the Matrix better, but without modifying the original Matrix.

In the Programming Guide, Ch. 3 "Maple Expressions", subsection 3.13 "Other Expressions" there is a section called "Composition".

There is the following snippet

In particular, although the inverses of the circular functions are commonly denoted by a power-like notation in written mathematics, in Maple, for example, sin^(-1) denotes the reciprocal of the sin function, while sin@@(-1) denotes the arcsine (arcsin).

I opened a new worksheet to check this. I found the results confusing.

1/sin

1/sin

(1)

arcsin(x)

arcsin(x)

(2)

sin^(-1)

1/sin

(3)

sin^(-1)(x)

1/sin

(4)

(sin^(-1))(x)

1/sin(x)

(5)

sin@@(-1)

arcsin

(6)

sin@@(-1)*x

arcsin*x

(7)

sin@@(-1)

arcsin

(8)

sin@@(-1)(x)

arcsin

(9)

(sin@@(-1))(x)

arcsin(x)

(10)

NULL

 

Consider (1) and (2). 

(1) is in accordance with the quoted snippet: sin^(-1) is the reciprocal of the sine function. But when we use this same expression as a function call, the function that is called is arcsine. Does this make sense to be this way?

Next, consider (3), (4), and (5), which I expected to be the same expressions as (1), (2) and (2), respectively. The only difference is that (1) and (2) use 2D math and (3), (4), and (5) use Maple input.

Both results using Maple input give as output the reciprocal of sine.

Why is there this difference between the 2D version and the Maple input version?

Consider (4) and (5). Why is it that we need to add parentheses for the argument x to be applied to the function?

Finally, what is the reasoning behind the syntax sin@@(-1) denoting arcsine?

@@ represents repeated composition. sin@@3 represents the function sin(sin(sin))). 

Is sin@@(-1) equal to arcsine simply by convention or is there some logical reason?

Download Repeated_Composition.mw

I am reading the Maple Programming Guide chapter 3 "Maple Expressions". There are subsections on "Indexed Expressions" and "Member Selection".

The following is based on reading these sections.

Consider the following module definition

m := module() export e, f:=2; end module:

What is the difference between m[e] and m:-e or m[f] and m:-f?

The documentation says that both evaluate module m's export e but the difference is that the index selection form will evaluate e before resolving the export.

What does this mean exactly?

When I try out in a worksheet both m[f] and m:-f return 2 and m[e] and m:-e return the name e.

I am going through the documentation on ScientificConstants and trying things out in a worksheet.

My first question about this package is about the following

with(ScientificConstants)

GetConstants()

`A[r](alpha)`, `A[r](d)`, `A[r](e)`, `A[r](h)`, `A[r](n)`, `A[r](p)`, E[h], F, G, G[0], K[J], M[Earth], M[Sun], M[u], N[A], Phi[0], R, R[Earth], R[K], R[infinity], V[m], Z[0], a[0], a[e], a[mu], alpha, b, c, c[1, L], c[1], c[2], e, epsilon[0], g, g[e], g[mu], g[n], g[p], gamma[e], gamma[n], gamma[p], gamma_prime[h], gamma_prime[p], h, hbar, k, l[P], lambda[C, mu], lambda[C, n], lambda[C, p], lambda[C, tau], lambda[C], m[P], m[alpha], m[d], m[e], `m[e]/m[mu]`, m[h], m[mu], m[n], m[p], m[tau], `m[tau]c^2`, m[u], mu[0], mu[B], mu[N], mu[d], `mu[d]/mu[e]`, mu[e], `mu[e]/mu[p]`, `mu[e]/mu_prime[p]`, mu[mu], mu[n], `mu[n]/mu_prime[p]`, mu[p], mu_prime[h], `mu_prime[h]/mu_prime[p]`, mu_prime[p], n[0], r[e], sigma, sigma[e], sigma_prime[p], t[P]

(1)

Copy and paste from the list above.

GetConstant(g[n])

neutron_g_factor, symbol = g[n], derive = 2*mu[n]/mu[N]

(2)

Manually try to type in g__n.

GetConstant(g__n)

Error, (in ScientificConstants:-GetConstant) `g__n` is not a known Constant

 

NULL

Why doesn't the latter work?

Download ScientificConstants.mw

2 3 4 5 6 7 8 Last Page 4 of 20