Joe Riel

9660 Reputation

23 Badges

20 years, 4 days

MaplePrimes Activity


These are answers submitted by Joe Riel

for i from 1 to 5 do
    t12[i] := ...;
    for n from 1 to 15 do
         Cn[i,n] := F(t12[i], ... );
     end do;
end do;

You wrote Cn(i,n), which in Maple notation indicates a function call to Cn.  I assume that is not what you really want.  Possibly you were just using it as a notational device.  In the above code I assigned to a table Cn (hence the square brackets).

An example of what you want would be useful.  The ?op procedure can be used to pick a term by position.  The ?select procedure is useful for selecting components, while ?indets can be used to select stuff at different levels.

The procedure ?combinat[randperm] uses an external compiled routine to generate a random permutation. It does not use the seed that is set with ?randomize. This can be demonstrated by reseeding randomize and calling randperm:

(**) randomize(23): combinat:-randperm(10);
                                             [10, 9, 7, 6, 3, 2, 1, 5, 4, 8]

(**) randomize(23): combinat:-randperm(10);
                                             [10, 8, 2, 6, 9, 7, 5, 1, 3, 4]

There should be  way to reseed the random generator used by randperm. I'll submit an SCR.

I'm not sure what you want.  You could use ?series to return a truncated series expansion. Maybe ?convert/Sum is what you want:

(**) y := 1/sqrt(9+4*x^2);
                                              1
                                   y := -------------
                                                2 1/2
                                        (9 + 4 x )

(**) convert(y,Sum);      
                    infinity
                     -----   /        _k1  (-_k1)           (2 _k1)\
                      \      |    (-1)    9       (2 _k1)! x       |
                       )     |1/3 ---------------------------------|
                      /      |                       2             |
                     -----   \                 (_k1!)              /
                    _k1 = 0

Change R := [][]; to R := Matrix(n*s,m*s);  Also, change M := matrix(...); to M := Matrix(...); matrix is an old data structure that has been superceded by Matrix.

You could use an indexed name, x[i].  If you really want the symbol, x1, etc., do cat(x,i) or x||i.

Here is Georgios' suggestion, used with ?ListTools:-MakeUnique.  For simplicity I used Vectors rather than Matrices. Note that the structure you gave is a list, not a set.

L := [<1>,<2>,<1.0>]
ListTools:-MakeUnique(L, 1, LinearAlgebra:-Equal);
                         [<1>,<2>]

Could you upload the model?  It's hard to say what could be wrong from just the description.

You need to use ?dsolve, which is Maple's differential equation solver.  Note that for consistency you need to change y^2 to y(x)^2.  Try it without making that change, dsolve will give an appropriate error message indicating what is wrong.

Alas, I wasn't able to get dsolve to return a solution. One way to work around that is to remove one of the boundary conditions, then pass that to dsolve.  The result is an equation with a constant that you need to solve for.  That can be done with a call to fsolve.

Here's the basic idea,

deq := {diff(y(x),x,x)-y(x)^2=0, (y(0)=100};
dsol := dsolve(deq):
eqC2 := eval(dsol, [x=2, y(x)=1]):
solC2 := fsolve(%, {_C2});
                     {_C2 = -0.4846159078}

Because I'm uncertain how the system is supposed to be configured, I'll describe a simpler system that might be applicable.

Consider a system consisting of a mass connected by a spring to a fixed point.  The spring allows the mass to both rotate and move back and forth.  The mass is constrained to move along the line from the mass to the reference point. This line also defines the single axis of rotation.  You can model that with four multibody components: a fixed reference, a prismatic joint, a revolute joint, and a rigid body.  The joints have parameters for the corresponding spring constants (and dampers, if desired). The rigid body has parameters for mass and moment of inertia.  Align the axis of movement of the prismatic joint with the axis of revolution of the revolute joint (the e_1 parameter is used for each of them).

You could look at what is used in DynamicSystems:

kernelopts(opaquemodules=false):
print(DynamicSystems:-PhasePlot:-unwrap):

It has its uses. For example, following a while loop it can be used to determine the final count.  It also can be use to determine whether a loop exited early.  Given that it has been this way for a long time, and a change would break exisiting code, it is likely to remain.

There are multiple ways to do so.  Two possiblities are ?rtable_dims and ?LinearAlgebra,Dimension.

That is not a solution.  Note the absence of t.

What do you want it to do with, say, a*c*b?  Or a*b*a?  The latter could return either a or -a depending whether the operator is left or right associative.

First 53 54 55 56 57 58 59 Last Page 55 of 114