nmacsai

130 Reputation

5 Badges

1 years, 198 days

MaplePrimes Activity


These are questions asked by nmacsai

Is there a command that will count the number of digits in a binary number or any number for that matter? For example: 10110  has 5  digits in binary representation.

restart

I choose to define a number in base 10.

number := 22

22

(1)

Then I choose to convert that number into base 2.

number_binary := convert(number, binary)

10110

(2)

On visual inspection it is determined that number_binary has 5 digits in binary representation.

Is there a common command that can count the number of digits in a binary number? Such as, 10110 has 5 digits.

Download Count_digits_in_a_binary_number.mw

Count_digits_in_a_binary_number.mw


 

restart

NULL

How do I factor out a term,with command line, from an algebraic expression?

NULL

Consider the following algebraic expression.

NULL

f := A*sin(x)*theta(x)*k-A*sin(x)*theta(x)*m*omega^2

A*sin(x)*theta(x)*k-A*sin(x)*theta(x)*m*omega^2

(1)

Suppose I wanted to factor out the quantity A*sin(x)*theta(x)from both terms. Done by hand, it would look like:

"f:=A*sin(x)*theta(x)*k-A*sin(x)*theta(x)*m*omega^(2) =A*sin(x)*theta(x)*(k-m*omega^(2))."

NULL

What is the typical way to do this operation with a command? I tried using the collect() command with no success:

NULL``

collect(f, A*sin(x)*theta(x))collect(f, A*sin(x)*theta(x))

Error, (in collect) cannot collect A*sin(x)*theta(x)

 

NULL

From the help sheets, "The collect function views a as a general polynomial in x.  It collects all the coefficients with the same rational power of x." Though A*sin(x)*theta(x)could be expanded into a polynomial in x (if A and theta(x)are well-behaved), I just want to work algebraically and treat A, sin(x), and theta(x)as indeterminants.  


 

Download how_do_I_algebraically_factor_an_expression_from_an_expression.mw

restartNULL

NULL``

Can I disable maple's use of the ' function? (aka prime/derivative function)

 

For example, if

 

f := x^2+1

x^2+1

(1)

it's derivative is obtained as

 

Diff(f(x), x) = diff(f(x), x)

Diff(x^2+1, x) = 2*x

(2)

.

We used the prime operator on the f to obtain f' on the right-hand-side.

 

The problem is, I use prime notation as a naming convention like in defining an integral equation such as:

"psi(t)=∫G(t,t')*psi(t') ⅆt' ."

NULL

This is common practice in many texts.

 

Is there a way that I can disable the operator function of ' so I can use it as a naming scheme? I have tried using the Alias( ) command which works on one evaluation but if an equation is passed to another function the Alias( ) command is extinguished by the previous evaluation and it takes the derivative again which is undesired.

how_do_i_disable_prime_operation.mw

Unit_vectors_from_different_coordinate_systems.mw
 

restart

NULLNULL

with(Physics)``

with(Vectors)

NULL

It's common in mathematical physics to use cartesian unit vectors to describe the position of a point in space.

 

r_(t) = x(t)*_i+y(t)*_j

r_(t) = x(t)*_i+y(t)*_j

(1)

Sometimes it neccessary to convert a position vector like `#mover(mi("r"),mo("→"))`(t) to another cartensian coordinate system with different unit vectors, I call the primed system. In the primed system the position vector looks like:

"(r')(t)=x'(t) (i')+y'(t) (j')"

When using Physics[Vectors] and the unit vector hat notations to define vectors in cartesian space, can I define more than one cartesian space such as:

`#mover(mi("r"),mo("→"))`(t) = x(t)*`#mover(mi("i"),mo("∧"))`+y(t)*`#mover(mi("j"),mo("∧"))`

NULL

and

  "(r')(t)=x'(t) (i')+y'(t) (j')"?

Another way to ask the same thing: Can I define the position vector in different coordinates, each system having a distinct pair of orthogonal unit vectors?

 

The short answer I think is no. Given the current implementation it's not clear how one would go about defining the relationships between unit vectors from different coordinate systems. See below.

 

In 2D the transformation corresponds to a rotation of a vector the plane. The tranformation is characterized by the rotation angle α.

 

 

 

The unit vectors from different systems are related through scalar products.

 

"(i)*i' =(|i|)*|i'|*cos(alpha)=cos(alpha)"``NULL

NULL

"(j)*(j)' =(|j|)*|(j)'|*cos(alpha)=cos(alpha)"NULLNULL

``

"(j)*(i)' =(|j|)*|(i)'|*cos(3 alpha)=cos(3 alpha)"``NULL

 

Is there a way to implement scalar products of vectors from different coordinate systems using the Physics Tensors package? Here I create three different coordinate systems. I don't know whether the unit vectors systems X and Y have the same (i, j, k) unit vectors or does each system have its own triplet?

NULL

Setup(coordinates = cartesian, metric = Euclidean, dimension = 3, spacetimeindices = lowercaselatin, geometricdifferentiation = true)

[coordinatesystems = {X}, dimension = 3, geometricdifferentiation = true, metric = {(1, 1) = 1, (2, 2) = 1, (3, 3) = 1}, spacetimeindices = lowercaselatin]
````

(2)

Coordinates(Y, Z, Z = cylindrical)

{X, Y, Z}

(3)

NULL

NULL


 

Download Unit_vectors_from_different_coordinate_systems.mw

 

Formatting_exponents_in_typesetting_situations.mw
How do I format express an exponent in standard notation when typesetting a caption?  10^2 displays as 100 when I want it to display as 10^2 but without the caret.

restart

with(plots)

logplot(10^x, x = 0 .. 8, size = [300, 300], legend = [y(x) = 10^x], legendstyle = [location = top], caption = typeset("How do I type,", 10^8, ", and have it show up as 10^8 in the caption?"))

 

NULL

Download Formatting_exponents_in_typesetting_situations.mw

1 2 3 Page 1 of 3