## Complex ODE solutions using dsolve and fsolve....

I am currently trying to solve the following ODE using numerical methods:

+ [(z+ I*y)2/k12 -k22 +

Where the complex value (in this case, , has been written as z+Iy). I believe dsolve has capabilities for solving this as an initial value problem with complex values and thus to solve this as a boundary value problem I aim to use fsolve to find a zero other a function which is the (IVP solution) - (the non-initial boundary). This has worked very well for the case where y=0 however does not work for values of y>0, and it seems the problem is with fsolve. Any advice on how to deal with this problem, perhaps alternatives to fsolve?

## Table / table width...

Is there any possibility to modify column width within tables, so that they become equal?

## Problem in evaluating 2D improper integral ...

Dear Users!

I want to evaluate following integral (f[i]'s) for different values of rho as shown. But find some problem and can't find f[3], f[4], f[5] and f[6]. If the integral from direct way is hard to calculate please guide me how I can evaluate it using numerical integration?

restart; HAM := [1, 2, 3, 4, 5, 6]; U := y^6*sin(x); alpha := 1/3;

for i while i <= nops(HAM) do

rho := op(i, HAM);

f[i] := int(int(U/((x^rho-p^rho)^alpha*(y^rho-q^rho)^alpha), q = 0 .. y), p = 0 .. x)

end do

Special request to @acer @Carl Love @Kitonum @Preben Alsholm

## How to fasten this simulation?...

Hi,

I want to simulate a decision rule (let's say a production control strategy to fix the ideas) based on the outcomes of a binomial random variable.

One stage of this simulation involves operations which correspond to the NaiveProc described below. This procedure is a straightforward and rather naive translation in Maple of these operations.
It is given here to help you to understand what is to be done.

This coding being extremely slow, I implemented the required operations differently.
Given the fact that I'm only concerned by binomial samplings with outcomes 0 and 1, I basically replaced these samplings by three operations  U:=... , Got01:=... , Got0:= ... .
Each new implementation is about 200 times faster than the naive one.

My question is: Can we do still better?
For information the same simulation realized with R runs in less than 15s when REP = 10^8 (more than 100 times faster than what I'm capable to do with Maple)

 > restart:
 > with(Statistics):
 > # This is the naive coding of the problem # # It has the advantage to explain clearly (at least I hope so) what is to be done. NaiveProc := proc(REP, a, b, N)   local roll, rep, p, K, N0, N1:   roll := rand(a .. b);   N0   := 0:   N1   := 0:   for rep from 1 to REP do     p := roll();     K := Sample(Binomial(N, p), 1)[1]:     if K=0 then       N0 := N0+1:     elif K=1 then       N1 := N1+1:     end if:   end do:   N0, N1: end proc:      CodeTools:-Usage(NaiveProc(10^3, 0, 5e-4, 25000));
 memory used=78.92MiB, alloc change=68.00MiB, cpu time=1.21s, real time=6.30s, gc time=24.80ms
 (1)
 > # As the previous code is very slow I implemented several variants based on the fact # that I care only on values of K equal to 0 and 1 and that it is then useless to sample # a Binomial random variable to do this. # # Each of them is much faster than the naive coding... but can we even faster? # For comparison, the same simulation realized in R takes less than 15s to run with REP=10^8 pi := (n, p, k) -> binomial(n, k) * (1-p)^(n-k) * p^k; f1 := proc(REP, a, b, N)   local Q, P0, P1, P01, U, Got01, Got0, N01, N0, N1:   Q     := Sample(Uniform(a, b), REP)^+:   P0    := pi~(N, Q, 0):   P1    := pi~(N, Q, 1):   P01   := P0 + P1:   U     := Sample(Uniform(0, 1), REP)^+:   Got01 := Select(t -> is(t <= 0), U-P01):   Got0  := Select(t -> is(t <= 0), U-P0 );   N01   := numelems(Got01):   N0    := numelems(Got0):   N1    := N01-N0:   N0, N1; end proc: CodeTools:-Usage(f1(10^5, 0, 5e-4, 25000)); print(): f2 := proc(REP, a, b, N)   local Q, P0, P1, P01, U, Got01, Got0, N01, N0, N1:   Q     := Sample(Uniform(a, b), REP)^+:   P0    := pi~(N, Q, 0):   P1    := pi~(N, Q, 1):   P01   := P0 + P1:   U     := Sample(Uniform(0, 1), REP)^+:   Got01 := select[flatten](<=, U-P01, 0):   Got0  := select[flatten](<=, U-P0 , 0):   N01   := numelems(Got01):   N0    := numelems(Got0):   N1    := N01-N0:   N0, N1; end proc: CodeTools:-Usage(f2(10^5, 0, 5e-4, 25000)); print(): f3 := proc(REP, a, b, N)   local Q, P0, P1, P01, U, Got01, Got0, N01, N0, N1:   Q     := Sample(Uniform(a, b), REP)^+:   P0    := pi~(N, Q, 0):   P1    := pi~(N, Q, 1):   P01   := P0 + P1:   U     := Sample(Uniform(0, 1), REP)^+:   Got01 := Vector(REP, i -> if(U[i] <= P01[i], 1, 0)):   Got0  := Vector(REP, i -> if(U[i] <= P0 [i], 1, 0)):   N01   := add(Got01):   N0    := add(Got0):   N1    := N01-N0:   N0, N1; end proc: CodeTools:-Usage(f3(10^5, 0, 5e-4, 25000));
 memory used=376.83MiB, alloc change=296.77MiB, cpu time=4.12s, real time=4.03s, gc time=430.38ms
 memory used=173.26MiB, alloc change=0 bytes, cpu time=2.30s, real time=1.98s, gc time=461.22ms
 memory used=154.19MiB, alloc change=0 bytes, cpu time=2.28s, real time=2.01s, gc time=432.40ms
 (2)
 >
 >

## improvement to Latex. Removing extra \\ at end of ...

When Maple converts a matrix or a vector to Latex it uses latex array, which  is fine, but what it does is insert an exatra \\ at the end of the last row, just before the \end{array}

This causes problem for some software which reads the latex file. It causes the software to take this as empty row and inserts a blank row at the end.

Here is a small example

A:=Matrix([[1,2],[3,4]]);
Physics:-Latex(A);

\left[\begin{array}{cc}1 & 2 \\3 & 4 \\\end{array}\right]

Notice the extra \\  just before the \end{array} In Latex, this tells latex compiler to insert newline basically.

When opening the latex file using external software, which reads Latex and converts it to GUI, it show this

And now I have to go edit the latex by hand removing the extra \\ (inside the editor I can do global search and replace)

A better outout from Maple's Latex command would be the following

\left[\begin{array}{cc}1 & 2 \\3 & 4 \end{array}\right]

Even though both are valid Latex, the above is better.  I was wondering how hard it is to do this change.

All what the conversion needs to do is just check if the row in the matrix (or Vector) is the last one, and omit the extra \\ at the end of the last row. That is all.

I could ofcourse write code to try to parse this each time I call Latex and to remove \\ myself in the program, but it will be much easier if Maple automatically did this.

ps. if the Latex conversion source code could be made public, others could help make improvement to it for free, benefiting Maple and everyone using it. Maplesoft would still approve the changes before checkin, and retain the copy right of the source code ofcourse.

Maple 2020.1

## How to "remove output from worksheet" while it is ...

One of the known issues with Maple GUI (written in Java) is that it is slow.

When I run a long script, which prints few lines to the screen for each step (to help tell where it is during a long run), and if there are 20,000 steps to run which takes 2 days to finish), then the worksheet and I think all of Maple seem to slow down. May be due to GUI trying to flush output to worksheet which now has lots of output.

I noticed when I terminate the loop in the middle and then clear the worksheet from the output and start it again from where it stopped, then it runs/scrolls much faster initially untill the worksheet starts to fill up.

The problem is that one can no longer do Evaluate->Remove output from worksheet as worksheet is busy. This option becomes grayed out.

Is there a trick to bypass this limitation? It will be really nice to be able to clear output from worksheet while it is running.  I do not understand why a user can not do this now even if worksheet is running. In Mathematica for example, this is possible to clear the output while notebook is busy running. Not in Maple.

ps. I want to try to change my program to print output to external file instead to the worksheet and then can monitor the output progress using that file outside of Maple to see if this helps with performance.

This is until Maplesoft adds support to allow one to clear worksheet while it is busy.

Using Maple 2020.1 on windows. Using worksheet mode, not document mode.

## Multiply Quaternions...

Hello again,   I'm trying to write a procedure to multiply quaternions.   We know that they can be represented as a vector of length 4.   See Wikipedia.   My try  -

qaa=[8,4,6,2] and qab =[2,,4,6,8]
mult:=proc(a,b)

end proc;

maybe needs some looping or data from a table.

Regards,

Matt

## Margins in a Bode plot...

Hello All, is there a command/instruction that can tell me the phase margin, gain margin automatically after I have a bode plot, please?

## Units Standard / compare values with zero...

Units are a neverending story, here's a variant of a problem raised before.

How can i get the minimum of 2 values with Units[Standard] loaded, when one of them could be zero (this loosing its units)?

• https://www.mapleprimes.com/questions/229640-Units-Disappearing
• https://www.mapleprimes.com/questions/230165-Error-in-UnitsTestDimensions-Invalid
• https://www.mapleprimes.com/questions/230064-Compare-Similar-Units

 (1)

 (2)

 (3)

 (4)

 >
 >
 (1)
 >
 (2)
 >
 (3)
 >
 (4)
 >
 >

## How to write Explore command ?...

I want to vary t from -15 to -7 and from 7 to 15 how to write the Explore command?
example : Explore(Fig(t), t=-15..-7 and t=7..15); which does't work.  Thank you.

## How do I solve this using Maple? Integrals - sphe...

The center of mass for the density function p(r,θ,φ) = ln(r^2 + θ^2 + φ^2 +1) over the solid sphere radius 2.

I'm not sure how to do this on Maple.

Many thanks!

## A little about controlled platforms (parallel...

by: Maple 17

Controlled platform with 6 degrees of freedom. It has three rotary-inclined racks of variable length:

and an example of movement parallel to the base:

Perhaps the Stewart platform may not reproduce such trajectories, but that is not the point. There is a way to select a design for those specific functions that our platform will perform. That is, first we consider the required trajectories of the platform movement, and only then we select a driving device that can reproduce them. For example, we can fix the extreme positions of the actuators during the movement of the platform and compare them with the capabilities of existing designs, or simulate your own devices.
In this case, the program consists of three parts. (The text of the program directly for the first figure : PLATFORM_6.mw) In the first part, we select the starting point for the movement of a rigid body with six degrees of freedom. Here three equations f6, f7, f8 are responsible for the six degrees of freedom. The equations f1, f2, f3, f4, f5 define a trajectory of motion of a rigid body. The coordinates of the starting point are transmitted via disk E for the second part of the program. In the second part of the program, the trajectory of a rigid body is calculated using the Draghilev method. Then the trajectory data is transferred via the disk E for the third part of the program.
In the third part of the program, the visualization is executed and the platform motion drive device is modeled.
It is like a sketch of a possible way to create controlled platforms with six degrees of freedom. Any device that can provide the desired trajectory can be inserted into the third part. At the same time, it is obvious that the geometric parameters of the movement of this device with the control of possible emergency positions and the solution of the inverse kinematics problem can be obtained automatically if we add the appropriate code to the program text.
Equations can be of any kind and can be combined with each other, and they must be continuously differentiable. But first, the equations must be reduced to uniform variables in order to apply the Draghilev method.
(These examples use implicit equations for the coordinates of the vertices of the triangle.)

## Logaritmic curve to determine Eigenvalues...

Hello friends

I am a PhD student at the University of Miskolc (Hungary). I am writing to asking for help.

considering that my matrix is correct (based on Article 1) and I have all the values needed:

-  From Article 2, How can I plot the graph of Figure 2 and Figure 3 in a logarithmic scale (X-axis) and linear scale (Y-axis). Also, how can I plot the mode shapes of Figure 7 and Figure 8?

I tried to do it (below) but I am not sure it is correct.

Graphs_Article_2.mw

Reference:
Article 1 - Doyle, Paul F., and Milija N. Pavlovic. "Vibration of beams on partial elastic foundations." Earthquake Engineering & Structural Dynamics 10, no. 5 (1982): 663-674.

Article 2 - Cazzani, Antonio. "On the dynamics of a beam partially supported by an elastic foundation: an exact solution-set." International Journal of structural stability and dynamics 13, no. 08 (2013): 1350045.

## How to generate a matrix given a certain lenght an...

Hi friends!

I have the following problem.

I'm trying to generate a matrix given a certain lenght n and a polynomial g(x) of degree r as follows:

If n=10, g(x)=x^4+3x^3+x^2+2x+1 and r=degree(g(x))=4, then the resulting matrix will be

i.e. a matrix with 10 columns, n-r=6 lines, and whose inputs are the coefficients of the polynomial, as follows:

Any help will be very appreciated.

Thank you!

 First 15 16 17 18 19 20 21 Last Page 17 of 1757
﻿