Joe Riel

9660 Reputation

23 Badges

20 years, 3 days

MaplePrimes Activity


These are answers submitted by Joe Riel

You might try creating a table that does reverse-lookup. 

BasisIndex := table([seq(basis[i] = i, i=1..upperbound(basis,1))]):

Then, to get the index of Vector v, do BasisIndex[v]. Because v may not be in the basis, you might do

if assigned(BasisIndex[v]) then
   indx := BasisIndex[v];
else
   whatever is appropriate
end if;



A simple way is to use the ?trace command.  Execute

trace(myproc):

where myproc is the name of your procedure, then execute your procedure.  The output of each statement is printed.  From that you might be able to figure out where the error occurs.

Better is to use the debugger.  Execute the command

stoperror('all'):

That tells Maple to launch the debugger when an untrapped error occurs. Execute your procedure.  That should cause the debugger to be launched with the control at the place in the procedure that raises the error. That will likely be inside a Maple library procedure called by your procedure. To figure out the cause you can query the values of variables and expressions in the procedure.

 

 

 

 

For the filename, you can use cat("row",i), "row"||i, or sprintf("row%d",i) (similarly for the ExportMatrix command).

For the M, you can just use an indexed variable: M[i].

Use ?unapply.  For example

A[1] := 23:
unapply(piecewise(x<0, A[1], y < 1, 2, 3),x,y) ;
        (x, y) -> piecewise(x < 0, 23, y < 1, 2, 3)


The problem is that you have not initialized band[i].

You state that N is unknown. But that cannot be the case, it appears as the end point in the first for-loop.  That is, it must be known at that point.

Followup:

I see you did initialize band[i]. Not sure why that didn't work.  Anyhow, because N is known, you can use a seq statement to generate band[i]:

band[i] := [seq( ..., i = 1..2*N)]:

Addendum:

The problem with your initialization is that the for-loop only goes to N, while the assignment loop goes to 2*N.  Change the initialization loop to end at 2*N.  Alternatively, and better, is to use seq as I suggested.

Use the ?currentdir procedure to determine the active directory of each worksheet.

What do you expect the answer to be?  Seems like it should be 1=0. You can use ?frontend to compute that 

frontend(diff, [eq,diff(u(x,t),t)], [{equation,`+`,`*`},{}]);

One way is to create a simple text file that assigns the procedure and then use the ?read statement to read that file from another file or a Maple worksheet.  For example, you might create a file names myfunc.mpl:

---- start of myfunc.mpl --- 
SomeFunc := proc(x)
   return x^2;
end proc:
---- end of myfunc.mpl ---

A better approach is to save the procedure [or module] in a Maple archive (file with extension *.mla).  That can be done with the ?LibraryTools:-Save command. For example, you could include the following line at the bottom of the above file

LibraryTools:-Save('SomeFunc', "MyArchive.mla"):

If you read the entire file into Maple, it will create an archive named "MyArchive.mla" (in the ?currentdir). If that archive is saved in a location read by Maple (in the ?libname path), then the SomeFunc procedure will be available to any Maple session.

There are undefined terms in eq:

remove(type,eq,equation);
       [PropAgua, PropGases, CoefConvAgua, CoefConvGases]

solve(y*log(x) = y + x*log(x), {y});
                                     x ln(x)
                               {y = ---------}
                                    ln(x) - 1

There isn't necessarily a solution.  Are the known matrices, A and E, numeric?  If so, I'd try the following (assuming A and E are assigned)

R := Matrix(12, symbol=r):
eqs := convert(E.R.R^(%T).E^(%T) - A, set):
fsolve(eqs);

If you used ?add to implement the function, then the function is well defined for non-integer x, F(x) = F(floor(x)). Err, no.  I read the x that appeared in the cos term as a multiplication.  Regardless, add is well defined with non-integer range values.

I know nothing about pile foundations, but this sounds readily doable in MapleSim.  What do you model?  Vertical movement?  Lateral movement? If the latter, then do you also have to model bending of the pile?

It would be helpful if you had uploaded the worksheet (with the green arrow), or included text that could be copy pasted.

First off, there is a minor problem with the conditional as presented.  The second condition (elif) is pointless; if it is true, then the first conditon must be true, so the elif condition is never seen.

Second, to avoid singularities at zero, it is better to formulate the first condition as nar(t) >= 2*nch4(t).

Currently, the custom component template code expects that the equations are actually equations.  As such, you will need to reformulate the conditonal statement to be an equation.  You can try using the Maple ?piecewise function to express the condition.  For example,

 piecewise(nar(t)>=2*nch4(t), nco(t), no2(t)) = 0

That, however, may not necessarily result in valid Modelica code. Try it and see what happens.

One way is to replace the plot command with

   plt[M] := plot(IQ,DT);

and then, outside the loop, do

plots:-display(entries(plt, 'nolist'));
First 36 37 38 39 40 41 42 Last Page 38 of 114