Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Suppose I have a matrix say

A:=[[1,2,3],[3,4,5],[5,6,7]]

If I want to get the sum of all the elements of the matrix.

Kind help if any one.

I apologize for the disturbance

Send my matrix to word as matrix either via maple or phython

Say we have 

 

A:=Matrix([[0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]])

How to write this matrix to a word file in a matrix form

In general If I have a n cross n matrix  How to write this matrix to a word file in a matrix form

This a Adjacency matrix

If I have several n cross n matricies I want them to be fprintf in the same file one after other giving paragraph space with some name of the matrix at the top.

I'm practicing with matrices in Maple, but I have a question. My question is, how do I set up the differential equation system on matrix form x '(t) = Ax (t) + B?

Here are the equations:

x'1(t) = x1(t) - x2(t) - 3

x'2(t) = 12x1(t) - 8x2(t) + 4

 

I've been looking around for some help sources, but the only one I could find is this. I tried to set it up like that, but didn't work, it gave me an error.

How should I set it up (using Maple commands)?

I have found an unpleaseant feature of the define command. 
@Carl Love
See below for the example. Basically, after declaring a function orderless via the define command, 
a simple use of Categorize stops working.  Details in the file. 

How can one define a function f(x,y) to be symmetric under interchange x<-> y

 primes2.mw

In this worksheet, how do the several successful plot commands evaluate the complex expression being plotted, and why do the unsuccessful plot commands fail to do so?

Plot_complex_expression.mw

 

What is the best (easiest) way to build up a small sytem (procedures) for calculating with base4-numbers ?

...  like multiplication, ln, square, root and so on.

I was thinking about padic or convert-procedures in maple, but before I will begin with that it would be very friendly to have a hint or the opinion of a professional maple programmer.

 

Thanks for helping 😃

Arno

 

 

I am trying to do the integration on the picture (int1). V,omega,theta,rhotræ,ix,iy,ixy,E,R are constants. a(r),å(r),FL(r),FD(r) are splines. It seems to run forever without any error. I have tried a simpler version to figure out if the problem has to do with the splines or the arctan. They can run independently but not when combined. (int2). I use an i7 6700k. I am fine with an aproximated answer within a couple %.  

I noticed PDEtools:-Solve hangs sometimes on some input where solve does not. When I change the solver for PDEtools:-Solve to use solve, it did not hang.

This means PDEtools:-Solve default solver is something else. I did not see what it is by looking at help.

Here is an example

restart;
eq:=[1/3*(-334*I*(-4807763*I+27000*I*2^(1/2)+60*(1746675+72116445*2^(1/2))^(1/2))^(1/3)-2*(-4807763*I+27000*I*2^(1/2)+60*(1746675+72116445*2^(1/2))^(1/2))^(2/3)+56978)/(-4807763*I+27000*I*2^(1/2)+60*(1746675+72116445*2^(1/2))^(1/2))^(1/3)*v[1]-20*I*2^(1/2)*v[2] = 0, (-18000*I*2^(1/2)+33400*I-40*(1746675+72116445*2^(1/2))^(1/2)-40*(-167*I*(1746675+72116445*2^(1/2))^(1/2)+75150*2^(1/2)+10*(-4807763*I+27000*I*2^(1/2)+60*(1746675+72116445*2^(1/2))^(1/2))^(2/3)+145445)/(-4807763*I+27000*I*2^(1/2)+60*(1746675+72116445*2^(1/2))^(1/2))^(1/3))/(167*I*(-4807763*I+27000*I*2^(1/2)+60*(1746675+72116445*2^(1/2))^(1/2))^(1/3)+(-4807763*I+27000*I*2^(1/2)+60*(1746675+72116445*2^(1/2))^(1/2))^(2/3)-28489)*v[2]-20*I*2^(1/2)*t = 0];

solve(eq,[v[1],v[2]]); #OK
PDEtools:-Solve(eq,[v[1],v[2]],solver=solve); #OK
PDEtools:-Solve(eq,[v[1],v[2]]); #hangs

 

Maple 2021

Hey guys I need help solving the following system of trigonometric equations

invEqs := [a[3]*cos(theta[1] + theta[2] + theta[3]) + a[2]*cos(theta[1] + theta[2]) + a[1]*cos(theta[1]) = px, a[3]*sin(theta[1] + theta[2] + theta[3]) + a[2]*sin(theta[1] + theta[2]) + a[1]*sin(theta[1]) = py, theta[1] + theta[2] + theta[3] = phi]

which everything except theta[1], theta[2], theta[3] are known.

 

here what I came up with but no success

res := solve(invEqs, {theta[2], theta[3], sin(theta[1])})

or better be like this but no output printed

res := solve(invEqs, {theta[1], theta[3], cos(theta[2])})

thanks in advance

How to find the power series solution of a nonlinear 4th order ordinary differential equation.

>ode:=U""+c^2*U"+k*c*U"-(3U^2+a)*U''=0

where U' denotes the differential w.r.t  z and a,k,c are constants. Please help to find.

hi! is there any kind of formula for coloring functions by HUE like this

contourplot(abs(sin(x) + y^2 + y + x*I), x = -6 .. 6, y = -5 .. 5, contours = [seq(1/2^n, n = 1 .. 3), seq(2^n, n = 1 .. 5)], numpoints = 200000, thickness = 1.5, color = black);

I wonder about situation when we don't have function for example f(z)=z but f(x,y)=x+I*y and we want to use domain coloring for that. Thanks in advance.

Hi!

How do I solve a equation ln in Maple:ln.mw


 

Let E be a random variable of expectation mu and A an algebraic expression containing no random variable.
If E has any known Maple distribution, then  Mean(A+E) = A+mu.

But if E is an "abstract" random variable, Mean doesn't seem capable to compute the expectation of A+E.
Notional example:

restart:
with(Statistics):
E := RandomVariable(Normal(mu, sigma)):
Mean(f(x)+E)
                           f(x) + mu
E := RandomVariable(Distribution(PDF = (z -> f(z)), Mean=mu)):
Mean(f(x)+E); 
     int((f(x) + _t) f(_t), _t = -infinity .. infinity)

IntegrationTools:-Expand(%);
        f(x) (int(f(_t), _t = -infinity .. infinity)) + (int(f(_t) _t, _t = -infinity .. infinity))

Questions:

  • Why does Mean not behave as expected for an abstract random variable?
  • Is there a simple way to obtain the expected result (Mean (A+E) = A+mu) (maybe by completing the definition of the distribution of E, or by any other means)?

TIA

PS: I know that I can replace Mean(A+E)  by A+Mean(E)  to obtain the desired result: this is not the type of answer I look for.

PS: I know (since Carl Love showed me how long ago) that I can define a "random variable" plus an operator Expectation such that Expectation(A+E)  by A+Expectation(E) ... but it's not a way I would call simple

Expectation := proc(e::algebraic)
     local a,b;
     if not hastype(e, RV) then e
     elif e::RV then 'procname'(e)
     elif e::`+` then map(thisproc, e)
     elif e::`*` then
          (a,b):= selectremove(hastype, e, RV);
          b*thisproc(a)
     else 'procname'(e)
     end if
end proc:

#------------------------------------------------------------------------

TypeTools:-AddType(
     RV, 
     {RandomVariable, 
     'RandomVariable^posint', 
     '`*`'({RandomVariable, 'RandomVariable^posint'})
     }
):
eval(Expectation(f(x)+E), Expectation=Mean)
                           f(x) + mu

 


 

13.5.2021

 

 

 

 

   

``

 

 

 

 

NULL

NULL

NULL

`&*` := proc (A := 1, B := 4, b := 2, d := 4) local c, i, k; c := 0; [seq(irem(c+add(A[i]*B[k+1-i], i = 1 .. k), b, 'c'), k = 1 .. d)] end proc

NULL

NULL

NULL

`&*`()

[irem(1[1]*4[1], 2, c), irem(1[1]*4[2]+1[2]*4[1], 2, c), irem(1[1]*4[3]+1[2]*4[2]+1[3]*4[1], 2, c), irem(1[1]*4[4]+1[2]*4[3]+1[3]*4[2]+1[4]*4[1], 2, c)]

(1)

NULL

NULL


 

Download mod_proc.mw

Hi 😊

I have found this Code here somewhere in MaplePrimes.

I am very interested in that Procedure, but it doesn't run.

I will be very happy, to get help with that.

Thanks a lot,

Arno

 

 

Hello

 

When doing chemistry in Maple, I want to be able to do my calculations with units.

Maple does not support the unit [M] (molar concentration), so I have to manually type the unit as [mol/L].

 

That is not a problem in itself, but I have encountered som issues with Maple's own formatting of the units.

For example, in the attached document I want the output unit to be (mol/L)^(-2). However, Maple automatically formats it as (L^2)/(mol^2)

It even does the same thing in the "Maple Math" here on MaplePrimes - Here I try to type (mol/L)^(-2): (mol/L)^(-2)

 

So does anyone know a way to avoid Maple's auto-formatting of the output, or is there a way to customize it so I get my desired output?

 

I have attached the document with some screenshots in it: chemistry_units.mw

 

// Frederik

First 398 399 400 401 402 403 404 Last Page 400 of 2216