Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

with(geometry);
with(LinearAlgebra);
xA := 1;
yA := 0;
xB := 0;
yB := 0;
xC := 0;
yC := 1;
Mat := Matrix(3, 3, [xA, xB, xC, yA, yB, yC, 1, 1, 1]);
Miv := MatrixInverse(Mat);
phi := (x, y) -> Transpose(Multiphy(Miv), <x, y, 1>);
for i to 6 do
    B || i := phi(xA || i, yA || i);
end do;
Error, (in LinearAlgebra:-Transpose) invalid input: too many and/or wrong type of arguments passed to LinearAlgebra:-Transpose; first unused argument is Vector(3, {(1) = xA1, (2) = yA1, (3) = 1})
How to correct this error ? Thank you.

First, I should mention that I am new to Maple. When I try to solve the below system of ODEs

sys_ode := diff(x(t), t) = -x(t)^2/(4*Pi*y(t)*(x(t)^2 + y(t)^2)), diff(y(t), t) = y(t)^2/(4*Pi*x(t)*(x(t)^2 + y(t)^2))

with initial conditions of 

ics := x(0) = 1, y(0) = 1

using the command 

sol_analytic := dsolve([sys_ode, ics])

I receive the below error of 

Error, (in dsolve) numeric exception: division by zero

Any help or guidance to resolve this is greatly appreciated.

A ball on a turntable can move in circles instead of falling off the edge (provided the initial conditions are appropriate). The effect was demonstrated in a video and can be simulated with MapleSim. The amination below shows a simulation of a frictionless case (falling off the table) and the case with a coefficient of friction of one.

Also demonstrated in the video: Tilting the table leads to a sideward (not a downhill) movement of the ball.

The presenter of the video noted that in the untilted state, the ball eventually drifts off the table, attributing this to slippage. This drift is also observable in the animation above, where the ball starts moving in a spiral, whereas in a Maple simulation (below to the left), the ball follows a perfect circle. Only after optimizing contact and initial conditions, MapleSim produced a result (using the same parameters) that exhibits a similar circle, with a slight difference in angular orientation after completing two revolutions about the center of the circle.

 

Some observations on the MapleSim model:

  • The results only slightly depend on the solvers. Numerical inaccuracies do not seem to be the reason for the difference in orientation. (Edit: see update below for the reason).
  • The ball bounces up and down in the MapleSim simulation (0.0025 of the balls radius). The bouncing is caused by the fact that the initial position of the ball is above the elastic equilibrium position with respect to the table (the elastic contact makes the ball sink in a bit). Adding damping in the settings of the contact element attenuates this effect and reduces the drift.
  • Drift is not observable anymore if in the contact element setting for "kmu" (smoothness coefficient of sliding friction) is set to larger values (above 10 in this example). This is an indication that sliding friction occurs during the simulation.
  • Choosing the equilibrium position as initial condition for the ball does not prevent initial bouncing because MapleSim sets an initial velocity for the ball that is directed away from the table. I did not manage to enforce strictly zero velocity. Maybe someone can tell why that is and how to set MapleSim to start the simulation without vertical velocity. (Edit: see update below for the reason).
  • Assuming an initial velocity towards the contact to cancel the initial vertical velocity set by MapleSim substantially reduces bouncing and increases the diameter of the circle. This finally leads to a diameter that matches the Maple simulation. Therefore the initial bouncing combined with slippage seems to dissipate energy which leads to smaller circles. Depending on the contact settings and initial conditions for vertical movement the diameter of the circle varied moderately by about 15%.

In summary, MapleSim can be parametrized to simulate an ideal case without slippage. From there it should be possible to tune contact parameters to closely reproduce experiments where parameters are often not well known in advance.  

Some thoughts for future enhancement of MapleSim:

  • In the model presented here, a patterned ball would have been helpful to visualize the tumbling movement of the ball. Marking two opposite sides of the ball with colored smaller spheres is a fiddly exercise that does not look nice.
  • A sensor component that calculates the energy of a moving rigid body would have helped identifying energy loss of the system. Ideally the component could have two ports for the rotational and translational energy components. I see professional interest in such calculations and not only educational value for toy experiments.
  • A port for slippage on the contact elements would have helped understanding where slippage occurs. Where slippage is, there is wear and this is also of interest for industrial applications.

Turntable_Paradox.msim (contains parameter sets for the above observations)

Certainly a standard question.

I have an integer n*n matrix A (the entries are explicitly integers; there is no variable -type x- in the matrix). I want the Smith normal form of A, that is A=UDV where U,V are integer matrices with determinant +-1 and D is a diagonal matrix with -eventually- some zero and positive integers d_i s.t. d_i divides d_{i+1}.

"SmithForm()" doesn't work directly (I get rational -non integer- matrices). Maybe it is necessary to declare the matrix A as 'Matrix(integer)' ...
Thank you in advance for your help.

Hello,

In my the script a determinant of a matrix is set equal to 0 and then solved for. This formula has infinite solutions. So i will find the second root with: Student:-Calculus1:-Roots(Y, N = 0 .. limit, numeric) . This gives me several solutions and then i pick the second one as this is the critical buckling load of the column with the current parameters. 

Everytime i change a parameter i need to rerun a part of the script. I would like to generate a table where i define lets say parameter A and B and then run the script to give me value Ncr. then repeat this a 100 times with diferent parameters to see the influence of the parameters. 

Ive been looking around but i am not able to figure this one out. I think something like this should be possible? Thank you very much in advance!

 

A B Ncr
0,1 0,1  
0,1 0,5  
0,1 1  
0,5 0,1  
0,5 0,5  
0,5 1  
1 0,1  
1 0,5  
1 1  

 

Has anybody been able to get Maple working on macOS Sonoma 14.4. I know it's not supported yet, but I thought there might be someone who has solved the issue with the app crashing immediately after startup.

The overloaded  procedure here test returns based on 2 lists or 3 lists entered. The two list has a mixed input type with a default value. The default value of "a" can cause a problem if an explicit value in not entered for "a" in foo1. I not sure is the mixed input type is adding to the problem.
By changing the order of the procedures the problem is avoidable here. But this just a simple example. When there are 6 or so procedures it can be very difficult to select a correct ordering.

Is there a way around this, apart from don't have default values?

I could experiment with changing the input order in each proc but that would break up some logical input sequences on me.

restart

 

foo:=overload([
                        proc(P1::list,P2::list,a::algebraic:=4,$)
                         option overload;
                         print("2 lists");
                          end proc,

                       proc(P1::list,P2::list,P3::list,$)
                         option overload;
                         print("3 lists");
                          end proc
                       ]);

proc () option overload; [proc (P1::list, P2::list, a::algebraic := 4, ` $`) option overload; print("2 lists") end proc, proc (P1::list, P2::list, P3::list, ` $`) option overload; print("3 lists") end proc] end proc

(1)

foo([1,2],[3,4])

"2 lists"

(2)

foo([1,2],[3,4],[4,7])

"3 lists"

(3)

 

 

 

foo1:=overload([
                        

                       proc(P1::list,P2::list,P3::list,$)
                         option overload;
                         print("3 lists");
                          end proc,

                        proc(P1::list,P2::list,a::algebraic:=4,$)
                         option overload;
                         print("2 lists");
                          end proc
                       ]);

proc () option overload; [proc (P1::list, P2::list, P3::list, ` $`) option overload; print("3 lists") end proc, proc (P1::list, P2::list, a::algebraic := 4, ` $`) option overload; print("2 lists") end proc] end proc

(4)

foo1([1,2],[3,4]); #incorrect output

"3 lists"

(5)

foo1([1,2],[3,4],4)

"2 lists"

(6)

foo1([1,2],[3,4],[4,7])

"3 lists"

(7)

 

Download 2024-02-3_Q_Overload_proc_.mw

February 2nd is Groundhog Day in North America. A day when we look to small marmots to prognosticate the weather. If the groundhog sees its shadow when it emerges from its burrow, then it predicts 6 more weeks of winter, and if not, then spring begins today! Unfortunately there are many official weather predicting groundhogs. Fortunately, the excellent website Groundhog-Day.com tracks each of their predictions. Unfortunately, it doesn't tell you which groundhog to trust. Fortunately, it has an API and we can take the data and map it in Maple:

This map assumes that each groundhog's prediction is valid at it's exact geographic coordinates, but that it's predictive powers fall off in inverse proportion to the distance away.  So, exactly halfway between a groundhog predicting early spring, and one predicting 6 more weeks of winter, we expect 3 more weeks of winter.  I handle that with Maple's Interpolation:-InverseDistanceWeightedInterpolation command with a radius of 1500 miles.  I plot a contourplot of that interpolating function, and then display it with the world map in DataSets:-Builtin:-WorldMap to generate the image above.

All the code to do that can be found in the following worksheet which also using the URL packaget to fetch the most recent groundhog data possible from the website.

Groundhog-Map.mw

I've commented out a few lines that you might use to explore other possible maps.  You can filter to file to just include real living groundhogs and not all the other precitions (some from puppets, some from other animals) if you find that more trust worthy. You might also prefer to change the interpolation command, one of my collegues suggests that Interpolation:-NaturalNeighborInterpolation might be a better choice.

 

I don't why the limit is not providing me the answer; What did I do wrong?

Im trying to replicate a shape in maple but everytime i plot it i get a big red block of line and i don't know why.

 

g := piecewise(0 <= x and x < 33, -50*x + 33*y, 33 <= x and 38.78 < y, (x - 47.94)^2 + (y - 40.55)^2 - 312.36, 58 <= x and x < 100 and 0 <= y and y <= 38.78, 0.5778*x^2 - 66.08774*x - y + 1887.9165);
implicitplot(g, x = 0 .. 80, y = 0 .. 60, scaling = constrained)

Any help is greatly appreciated

I have been able to sucessfully use the WeibullPlot function of the statistics package.

Is there an output option (similar to summarize = true for other regressions) for the (reference=true) intercept of (X) value (eta) with the 0.632 line and and slope (Beta) of the line, r^2, etc.?

Thanks,
Bill

I am trying to plot the following.

it consist of a line and a circle.

if tried doing it as so:

f := x -> piecewise(0 <= x and x <= 1.588125352, (-1)*0.39*x^2 + 1.459*x - y, 1.588125352 <= x and x < 4, (x - 1.81)^2 + (y - 0.42)^2 + (-1)*0.94^2);

implicitplot(f(x), x = 0 .. 3, y = 0 .. 1.5, scaling = constrained);

every time i get this ugly line in the point where the funktion switches and i can't seem to remove it.

I've tried discont = true, but it doesn't seem to work on implicitplots. 

Hello,

I am using the Weibullplot function and have gotten a good plot out.  The issue is the gradations on the subticks per decade.

If I set it to three (3) I get 0.2, 0.3, 0.4 subgrid correctly, but only 0.6, 0.7, 0.8 between ).5 and 1.0.

If I set it to four (4) - I get the reverse.

Is this a log plot issue or a weibullplot function issue with respct to setting the subticks on the 10ths correcty of a decade span?  I look forward to thoughts.

with(Statistics);
XX := RandomVariable(Weibull(1, 0.6));
AA := Sample(XX, 100);

AA is a sample matrix of 100 Weibull distributed data points.

WeibullPlot(AA, reference = false, style = line, gridlines = true, size = [800, 500], axis = [tickmarks = [default, subticks = 4], color = darkgreen])

WeibullPlot.mw

Thanks,
Bill

Hi. i want to select terms with sum of powers equal to 1 and other terms with sum of powers more than 1 for the following equation.

restart

eq:=-2.*10^(-12)*p[1](t)*q[1](t) + 7.133360604*10^(-8)*p[1](t)*q[0](t) + 2.839877758*10^(-7)*q[0](t)*p[2](t) + p[0](t)*q[0](t) + p[0](t)^2 + q[0](t)^3 + p[1](t) + 8*q[4](t)

-0.2000000000e-11*p[1](t)*q[1](t)+0.7133360604e-7*p[1](t)*q[0](t)+0.2839877758e-6*q[0](t)*p[2](t)+p[0](t)*q[0](t)+p[0](t)^2+q[0](t)^3+p[1](t)+8*q[4](t)

(1)

 

 

Download problem.mw

 actually i need an algorithm to select linear terms from nonlinear ones(sum of powers equals to more than one) and vice versa.

It is &ndash; that is not rendered.

Maple 2023

For comparision Maple 2022.

Can someone reproduce this? Anything I can do about it (some settings maybe)?

Both session directly after restart of Maple.

First 13 14 15 16 17 18 19 Last Page 15 of 2097