Ex

90 Reputation

7 Badges

11 years, 271 days

MaplePrimes Activity


These are questions asked by Ex

How to get n th term of an equation and total number of terms in equation?

for example if f := 2*x+3*y+2

 

any function can extract term from equation such as second term is 3*y

 

total number of terms is 3

testerror := proc(b)
if b > 3 then
    return;
end if;
b = b+1;
proc(b);
return;
end proc;

where is wrong?

illegal use of a formal parameter

 

evolf := proc(z, f, terminal_counter)
h1 := z + f;
h2 := z - f;
h3 := z*f;
h4 := z+diff(f,x);
h5 := z-diff(f,x);
h6 := z*diff(f,x);
h7 := subs(x=z, f);
N := 7;
test := [h1, h2, h3, h4, h5, h6, h7];
print(test);
fitness := [0, 0, 0, 0, 0, 0, 0];

if terminal_counter > 5 then
    return fitness;
end if;

total_fitness := 0;
for i from 1 to N do

How to find the index of a number in an array?

if a := [11 12 13 14 15];

which function output  number 12's index is 2

 

when write

indexarray := proc(f, target)

N = 7;

for i from 1 to N do

    if f[i] = target then

           return i;

    end if

od;

end proc;

 

error final...

evolf := proc(f);
h1 := z + f(x);
h2 := z - f(x);
h3 := z*f(x);
h4 := f(x)/z;
h5 := z+diff(f(x),x);
h6 := z-diff(f(x),x);
h7 := z*diff(f(x),x);
h8 := diff(f(x),x)/z;
h9 := subs(x=z, f(x));
test := [h1, h2, h3, h4, h5, h6, h7, h8, h9];
F = 0;
for i from 1 to 9 do
    F = F + 1/(1+exp(subs(x=0,test[i])-subs(x=0,f(x))));
end proc;            

First 14 15 16 17 18 Page 16 of 18