Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I tryning to to plot 3d and then contour plot of the function N vs alpha

This is my try please any comments might help

N_vs_alpha.mw

Dear all,

im having trouble with adding two matrixes when they are only described with a letter asigned to them. I really dont know why it is the case. But it has got the be done with letters only because later on i will need this a lot with vector calculations etc. 

Thank you!

A := matrix([[2, -5, 1], [0, 3, -2]]); B := matrix([[0, 2, -1], [7, 1, 3]]); matrix(A+B)

A := Matrix(2, 3, {(1, 1) = 2, (1, 2) = -5, (1, 3) = 1, (2, 1) = 0, (2, 2) = 3, (2, 3) = -2})

 

array( 1 .. 2, 1 .. 3, [( 1, 2 ) = (2), ( 2, 2 ) = (1), ( 2, 3 ) = (3), ( 1, 1 ) = (0), ( 2, 1 ) = (7), ( 1, 3 ) = (-1)  ] )

 

Error, (in matrix) invalid argument A+B

 

help("matrix")

(Matrix(2, 3, {(1, 1) = 2, (1, 2) = -5, (1, 3) = 1, (2, 1) = 0, (2, 2) = 3, (2, 3) = -2}))+(Matrix(2, 3, {(1, 1) = 0, (1, 2) = 2, (1, 3) = -1, (2, 1) = 7, (2, 2) = 1, (2, 3) = 3}))

Matrix(%id = 18446746769648450246)

(1)

A+B

A+B

(2)

evalc(%)

A+B

(3)

evalf(%)

A+B

(4)

``


Greetings,

The Function

Download Mapleprimes_Question_Book_2_Paragraph_4.1.mw

SlitRecoil.mw

At line 46 I do some integrals of a probablity function obainted from complex amplitudes. The plot of the function is shown above. However, the integral suddlenly drops to almost nothing when I increase the limits from +/- 0.195 to +/-0.2. The transition actually occus at ~0.196 (not shown)

This makes no sense. It doesn't seem  from the plot that the step size could get so large as to miss the peak! However, I don't know how to change numerical integral step size to test that.

---Arthur (a.k.a. Traruh)


 

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

I have an expression and I want to select the part of the expression which has diff(y(x),x) in the expression.

Using select(has,expr,diff(y(x),x) works, except when the expression happend to be exactly diff(y(x),x) in this case select returns diff()

I understand why this happens. But I can not avoid this problem by say first checking if the expression has more than one operand, because nops(diff(y(x),x) is 2 and not one. Also 1+diff(y(x),x) has two operands. And I can not check if the expression is of type `+` or `*` before, because other types can have more than one operand also.

So now what I do is the folliwng: first check if the expression has diff(y(x),x). If so, convert the expression to D and now check if nops is more than one, and if so, only now call select.

This is becuase nops(D(y)(x)) is one, while nops(diff(y(x),x) is two.

Is there a better way to do this, in order to avoid calling select and getting diff() ? I suppose I could also just check if the expression is exactly diff(y(x),x) before even calling select or has and avoid all this?

Worksheet attached


 

interface(version)

`Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`

#the wrong way
expr:=diff(y(x),x):
if has(expr,diff(y(x),x)) then
   part_with_diff:=select(has,expr,diff(y(x),x));
fi;

diff()

#add extra check,  example 1
expr:=diff(y(x),x):
if has(expr,diff(y(x),x)) then
    if nops(convert(expr,D))>1 then
       part_with_diff:=select(has,expr,diff(y(x),x));
    else
       print("expression is itself diff(y(x),x))");
    fi;
fi;

"expression is itself diff(y(x),x))"

#add extra check, example 2
expr:=1+3*diff(y(x),x):
if has(expr,diff(y(x),x)) then
    if nops(convert(expr,D))>1 then
       part_with_diff:=select(has,expr,diff(y(x),x));
       print("part_with_diff=",part_with_diff);
    else
       print("expression is diff(y(x),x))");
    fi;
fi;

"part_with_diff=", 3*(diff(y(x), x))


 

Download best_way_to_check.mw

Hi

I have an equation which i want solve it with DTM and sketch the graph of f(η) along y axis and η along x axis, f ‘( η) and g( η)

 

 

M:=0..5

F[0]:=0;F[1]:=1;F[2]:=a/2;G(0)=0

That's my pleasure If there is somebody help me to code and solve this problem.

Thanks for every one very very much.

maple_calculations.mw

Why does my sequence return 0 at n=9 and n=10, when it should be 4?

Beneath the sequence i have also calculated the limit of f, as x approaches infinity, and it returns 4.

Below the initial screenshot, i have displayed a screenshot of the same plot but with a much bigger x-axis. It seems something weird happens at very large numbers of x. Is it a glitch, and if so how do i fix it?

here is the maple document containing the calculations below: maple_calculations.mw

Good day.

Several years ago, I obtained access to a clustering package that was useful to my studies using Maple 17.

In the meantime, I switched to another computer and now, I  cannot access the file, ClusterAnalysis.mla.

Unfortunately, I do not recall how I was able to access this library file.

Can anybody please advise me on the exact steps that are necessary to initialize and execute this file?

Thanks for reading ...

I'd like to plot row[i] of M_jk (left axis) vs. row[i] of M_ki (right axis). i is the x axis, and varies discretely from 1 to 10 (number of runs). See attached screenshot below for details. My result is off in terms of values... How to fix my plot command?

 

Please, how do I generate a list of ones in maple?

Dear friends,

I found a file in the Maplesoft Application Center to evaluate the minimum of a function in two variables.

I tried to extend the code to find a minimum for a function in 4 variables.

But the code does not work. Any Help, I will be appreciated.

Amr

Gradient_Search_Program_Code-22-9-2022.mw

How to linearize eq (6) by neglecting all higher order terms i.e., epsilon[1]^2, epsilon[2]^2, epsilon[1]*epsilon[2]... etc? How to do it in maple?

Calculation.mw

Please help me create a variation table of the function in maple like the above figure.

 

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

I haven't managed to round values with units, and get the trailing zeroes cut away, so I'd like to use the MapleTA:-Builtin:-numfmt function to do the job.

The problem is, that this function doesn't accept values with units.

I have managed to write a rounding function to do the rounding, but the problem here is that it will write the values with trailing zeroes, which isn't what I want.

Any ideas how to fix that?

1 2 3 4 5 6 7 Last Page 1 of 1945