nmacsai

260 Reputation

9 Badges

4 years, 64 days

MaplePrimes Activity


These are questions asked by nmacsai

Can Maple carry around an unevaluated/inert  Matrix-Vector product(A matrix product without executing the matrix multiplication)? See Maple sheet.

inert_matrix_products.mw

restart

with(LinearAlgebra)

NULLNULL

Can Maple carry around an unevaluated/inert explicit Matrix-Vector product?

 

Define a matrix K and vector U as:

 

U := `<,>`(u1, u2)

Vector[column](%id = 36893490583464982996)

(1)

K := Matrix(2, 2, symbol = k)

Matrix(%id = 36893490583464975884)

(2)

I can take their product using MatrixVectorMultiply( ) I get,

MatrixVectorMultiply(K, U)

Vector[column](%id = 36893490583464964812)

(3)

however output I am really looking for is

 

(Matrix(2, 2, {(1, 1) = k[1, 1], (1, 2) = k[1, 2], (2, 1) = k[2, 1], (2, 2) = k[2, 2]})).(Vector(2, {(1) = u1, (2) = u2}))

NULL

In the later case, K.U is still a product however the actual matrix multiplication is not carried out. Sure, eventually I will want to evaluate the matrix-vector product but sometimes when setting up a problem I want to look at the explicit matrix equation before any explicit matrix multiplication is carried out.NULL

NULL

Here I show some ideas that don't work but may give a sense of what I am going for. I am essentially trying to mute the computation of the product while keeping the elements of the product together for further substitutions elsewhere. This there a standardized way to complish this? Or do I have to write my own procedure for something like this?

 

`&MatrixVectorMultiply`(K, U)

`&MatrixVectorMultiply`(Matrix(%id = 36893490583464975884), Vector[column](%id = 36893490583464982996))

(4)

%MatrixVectorMultiply(K, U)

%MatrixVectorMultiply(Matrix(%id = 36893490583464975884), Vector[column](%id = 36893490583464982996))

(5)

`&.`(K, U)

`&.`(Matrix(%id = 36893490583464975884), Vector[column](%id = 36893490583464982996))

(6)

K*%.U

`&.`(Matrix(%id = 36893490583464975884), Vector[column](%id = 36893490583464982996))*Matrix(%id = 36893490583464939756).Vector[column](%id = 36893490583464982996)

(7)

NULLNULL

Download inert_matrix_products.mw

I often want to export an expression from Maple to LaTeX. Often, the output will contain commands that my LaTeX compiler doesn't recongnize. This hinders my LaTeX document production efficiency greatly. I use MiKTeX and Texmaker to generate documents in LaTeX language. Naively I assumed that Maple sticks to core LaTeX packages when generating an output. I still don't know if that is the case. The main issue is that, I don't know which LaTeX packages some of the Maple outputs use, and so, I don't know which packages to load in my LaTeX document.

As a concrete example, I show how I convert an expression to LaTeX language and how that particular output contains commands: \iup and \idn which are not recongnized by my LaTeX compiler since I don't know which package these commands come from. I google search for commands \iup and \idn came up empty. How do I figure out what package these commands come from

Latex_export_problems_1.mw

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)=&int;G(t,t')*psi(t') &DifferentialD;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

3 4 5 6 7 8 Page 5 of 8