7 years, 95 days

## How to select monomials based on a rule?...

Maple

Hello

Unfortunately I got stuck again when trying to work with monomials.  Consider the following set of set of monomials:

f := [theta[1]*y+theta[2]*z,theta[3]+theta[4]*x+theta[5]*y+theta[6]*z+theta[7]*x*y+theta[8]*x*z+theta[9]*y*z,theta[10]*x+theta[11]*y+theta[12]*z+theta[14]*x*y+theta[15]*x*z+theta[16]*y*z+theta[17]*x^2+theta[18]*y*y+theta[19]*z*z+theta[20]];

x, y and z are the variables and thetas are the coefficients.  The coefficients theta can be zero and I need to classify the resulting set as valid or not.   Here are some examples of not valid sets

fff:=[theta[1]*y+theta[2]*z,theta[5]*y,theta[10]*x+theta[11]*y+theta[12]*z+theta[14]*x*y+theta[15]*x*z+theta[16]*y*z+theta[17]*x^2+theta[18]*y*y+theta[19]*z*z+theta[20]];

ffff:=[theta[1]*y+theta[2]*z,theta[5],theta[10]*x+theta[11]*y+theta[12]*z+theta[14]*x*y+theta[15]*x*z+theta[16]*y*z+theta[17]*x^2+theta[18]*y*y+theta[19]*z*z+theta[20]];

fffff :=[theta[1]*y+theta[2]*z,theta[3]+theta[4]*x+theta[5]*y+theta[6]*z+theta[7]*x*y+theta[8]*x*z+theta[9]*y*z,theta[12]*z+theta[19]*z*z+theta[20]];

that is, the first coordinate of the set cannot be a function of x alone, the second coordinate cannot be a function of y alone and the third coordinate cannot be a function of z only.

I could not figure out how to do that automatically, can you help me, please?

Many thanks.

## How to update old help files (Maple V2)...

Maple

Hello

Thanks to the help of several list members I managed to translate and update some old procedures.  These procedures were part of a packcage and they all had help files.   Here is an example

# E. Mendes - 25/04/94

`help/text/sampling`:=TEXT(``,
`FUNCTION: sampling - finds the discretized model`,
` `,
`CALLING SEQUENCE:`,
` sampling(f)`,
` sampling(f,k)`,
` sampling(f,k,vars)`,
`PARAMETERS:`,
` f - state space`,
` k - order of approximation`,
` vars - variables`,
``,
`SYNOPSIS:`,
`- sampling(f,k) returns a discrete approximation for a continuous`,
` system`,``,
` dx(t)/dt=f(x(t),u(t)) `,
``,
`EXAMPLE: `,``,
`> with(linalg):`,
`> f:=vector([x2,x3,-x1+x2^2+2*x3]):`,
`> sampling(f,1)`,
``,
` 2`,
` [- x1, x2 + x1 ]`,``,

I have browsed the help documentation but I must confess I don't feel comfortable to modify the help database.  Do I have to wrap all the functions up as a package and then write the help files?   I am lost here.  Any help will be most welcome.

Many thanks

Ed

## List - position of repeated elements...

Maple

Hello

I am working my way back to use Maple for some calculations I did in the past.   ListTools seems to have some of the functions I need but I couldn't find anything that gives me the position of all groups of repeated elements in a list of a list.  For instance, ListTools:~MakeUnique removes the copies of all repeated elements but it seems that there is no counterpart function that gives the position of the repeated elements, is there?

Search and SearchAll return position but they seem to be the only ones.

Example:

a:=[[x+y+z],[2*x+y+z],[x-y+z],[2*x+y+z]];

and the expected output would be

pos:=[[1],[2,4],[3]];

Many thanks

Ed

## How to retrieve only the monomials (no c...

Maple 14

Hello

I wonder if there is a function to retrieve only the monomials from a multivariable polynomial in x, y and z. Below is one such polynomail.

theta[2]*x3*x0-theta[8]*x2*x1*x0-theta[2]*x2*x1-theta[6]*theta[2]*x2*x0^2-theta[4]*theta[2]*x2*x0-theta[2]*theta[7]*theta[10]*x1*x0^3+theta[8]*theta[2]*theta[9]*x1*x0^2-theta[2]*theta[5]*theta[10]*x1*x0^2-theta[2]^2*theta[3]*theta[10]*x0^3+theta[6]*theta[2]^2*theta[9]*x0^3+theta[4]*theta[2]^2*theta[9]*x0^2

and the result

[x3*x0,x2*x1*x0,x2*x0^2,x2*x0,x1*x0^3,x1*x0^2,x0^3,x0^2]

Many thanks

Ed

## Functional operator within a proc...

Maple 18

Hello

It has been years since I last used maple so I apologize if my question makes no sense and my code is outdated (and wrong!).

I need to write a function (proc) that uses a functional operator inside.  Something like

test:=proc()

local f,vars, func, aux, res;

f:=arg[1]; # a list

vars:=arg[2]: # a list

aux:=op(vars):

func:=aux -> f:  # a function from () to []

res:=func(op(func(aux))):

return(res):

end:

This is the basic idea of the proc.  If f:=[y, y*z-x, -15*x*y-x*z-x] and vars:=[x,y,z], the function of a function does not return as it supposes to.  Please tell me what I am doing wrong and how to improve and update the code.

many thanks

Ed

 First 10 11 12 13 Page 12 of 13
﻿