Items tagged with record

Feed

What is the best way for Maple to create datasets with attributes?

There must be a better way than just listlists  ie [[Honda, green, 2008],[Honda, red,civic,2004],[Hoda, blue, CRV, 2WD]] etc....

It would be similar to the table of elements using get properties. 

Hi everyone,

I would like to use structs

    struct sname {
        smem1;
        smem2;
    }

in my C code defined elsewhere. How do I get CodeGeneration to produce variable names like

    sname.smem1

?

The appoach to use the respective maple data type

  sname := Record('smem1', 'smem2'):
  CodeGeneration[C](sname);

results in

    Warning, procedure/module options ignored
    double smem1;
    double smem2;

and the appoach to define it as name

    CodeGeneration[C](`sname.smem1`);

results in

    Warning, the following variable name replacements were made: sname.smem1 -> cg0
    cg = cg0;

Your answer is appreciated

Fabian

Hi,

Following situation: I have Records with several members. These members in turn have varied expressions assigned to them: some have numbers, one has a Matrix, some have formulae. Example:

q:=Record(l=len,k1=kl/len,R=(a 6x6 Matrix dependent on len and kl/len));

I want to be able to use the limit command on each of the members of q such that each member gets assigned the correct limit of its expression. I.e. I want to write a function limit2 such that

limit2(q,len=0);

yields

Record(l=0,k1=infinity,R=(limit~(the Matrix,len=0))

The trick here is that the members of the Record vary for different Records but I want to write a function limit2 that works for all of these. I can make a list of the members by using exports(q) like this:

exlist:=[exports(q)];

and after some fiddling I found that I can run limit on each member in turn:

for nam in exlist do
  limit~(eval(parse(cat(elm,":-",eval(nam)))),len=0)
end do;

What I have not been able to do is putting the result back into the member of the Record. Usually I would use assign for such a task, but I am unable to get the correct name on the left side that lets me assign to it. These names would of course be q:-l, q:-k1 and q:-R in the above example. I tried the parse(cat(...)) construct above and variations, but in the best case the assignment does not happen, in worse cases I get an error thrown. Never do I get the actual assignment.

Any hint how to do this?

TIA,

M.D.

PS: FWIW, I am doing this on Mape 15.

 

Find a loop do define these matrices, even for large values of n. Record the Matrix Mn 

 

all i,j=1,2,13,..,n for example 

N := `<|>`(`<,>`(1, 2), `<,>`(2, 2))

P := `<|>`(`<,>`(1, 2, 3), `<,>`(2, 2, 3), `<,>`(3, 3, 3))

Q := `<|>`(`<,>`(1, 2, 3, 4), `<,>`(2, 2, 3, 4), `<,>`(3, 3, 3, 4), `<,>`(4, 4, 4, 4))

 

Please help!!!

Hi; I am working on a package where the data mostly come in Maple records with a varisble number of fields with different names. At least one field in each record has a 6 by 6 matrix, the expressions of which involve the values associated with at least some of the other fields.

Occasionally I have the need to, say, apply a function to each of these fields. E.g., I want to substitute a value for a specific name; this name may show up in several fields and also will show up in the matrix.

Here are 30 all-time men's best 100m  (see http://en.wikipedia.org/wiki/100_metres
 and  http://www.alltime-athletics.com/m_100ok.htm )
        1      9.58       +0.9    Usain Bolt          16.08.2009

Page 1 of 1