Items tagged with procedure procedure Tagged Items Feed

Hi,

 

Let, fixed an integer i and 1<=j<=2^{i}-1, for each x and y in [0,1] let the following mapping

Then, with the above procedure we can obtained, for a fixed i, all the mappings for j=1,...,2^{i}-1

 

However, How can I to evalute the "components" of the above procedure? For instance, I can not to compute CreaF(2)[1](0.35,0.465) (i.e., the first function in the "vector" CreaF(2), in x=0.35, y=0.465). 

 

Thanks very much for your time.

 

Hi there,

Recently, I started to learn maple. I came across a problem. 

I entered following codes:

with(plots);

ball := proc (x, y) fieldplot([x, y], x = -1 .. 1, y = -1 .. 1) end proc;

ball(1,1);      


However, it showed me Error, (in plots/animate) bad range arguments -10. = -10 .. 10, -10. = -10 .. 10.

could someone tell me how to put fieldplot into procedure? Very much appreciated.

Hi, I want to ask. the maple program that i have done have something wrong somewhere.

for an example changes basis

 from e_{1}e_{1}=e_{1} , e_{1}e_{2}=e_{2} maple program reading :A1 : (1,1,1)=1,B1: (1,2,2)=1

to e_{2}e_{2}=e_{2} , e_{2}e_{1}=e_{1} maple program reading :A2: (2,2,2)=1,B2: (2,1,1)=1

these changes basis above are 2 operation, left product and right product

A1 and A2 are left product, while B1 and B2 are right product,

i need to make A1 isomorphic to A2, and B1 isomorphic to B2.

by using maple program, i should get identity in matrix form 2x2

[0 1] but i get [0         1]

[1 0],            [C_{21} 0],

For isomorphism, the determinant should not be zero

here's are my maple program:

>isom := proc (A1, A2, B1, B2, n)

local i, j, k, s, r, eqns, t, TEST, BChange, sols, m, S1, S2, C;

C := matrix(n, n);

BChange := matrix(n, n);

TEST := 0; eqns := {};

for i to n do for j to n do for m to n do

S1 := sum(A1[i, j, k]*C[k, m], k = 1 .. n); S2 := sum(C[i, r]*(sum(A2[r, s, m]*C[j, s], s = 1 .. n)), r = 1 .. n);

eqns := `union`(eqns, {S1 = S2})

end do end do end do;

for i to n do for j to n do for m to n do

S1 := sum(B1[i, j, k]*C[k, m], k = 1 .. n); S2 := sum(C[i, r]*(sum(C[j, s]*B2[r, s, m], s = 1 .. n)), r = 1 .. n);

eqns := `union`(eqns, {S1 = S2})

end do end do end do;

sols := [solve(eqns)];

t := nops(sols);

for i to t do for j to n do for k to n do

BChange[k, j] := subs(sols[i], C[k, j])

end do end do;

if simplify(linalg:-det(BChange)) <> 0 then print("BChange", BChange);

print("s1", S1); print("s2", S2); print("The det is", simplify(linalg:-det(BChange)));

TEST := 1 end if end do;

if TEST = 0 then print("These two algebras are not isomorphic")

end if end proc

input maple program:

> DENDA1 := array(sparse, 1 .. 2, 1 .. 2, 1 .. 2, [(1, 1, 1) = 1]);
> DENDB1 := array(sparse, 1 .. 2, 1 .. 2, 1 .. 2, [(1, 2, 2) = 1]);
> DENDA2 := array(sparse, 1 .. 2, 1 .. 2, 1 .. 2, [(2, 2, 2) = 1]);
> DENDB2 := array(sparse, 1 .. 2, 1 .. 2, 1 .. 2, [(2, 1, 1) = 1]);
> isom(DENDA1, DENDA2, DENDB1, DENDB2, 2);

Hello everyone,

I have an issue that I don't know how to solve.
I would like to plot a part of a surface that is enclosed by another surface. I wrote a proc() function with an if statement and when the statement is statisfienied I returned desired function. The roblem is that if statement gets ploted as well..

Here is my proc()

yield := proc (sigma__x, sigma__y, tau__xy, sigma__cx, sigma__cy, f__45, f__cx, f__cy, tau__u, f__tx, f__ty, alpha)

if eval(evalf(f__r(sigma__x, sigma__y, tau__xy, f__tx, f__ty, alpha)) < 0) then

return f__h(sigma__x, sigma__y, tau__xy, sigma__cx, sigma__cy, f__45, f__cx, f__cy, tau__u)

else 9999999

end if

end proc;


Here is my plot request:


Explore(implicitplot3d('yield(sigma__x, sigma__y, tau__xy, sigma__cx, sigma__cy, f__45, f__cx, f__cy, tau__u, f__tx, f__ty, alpha)' = 0, sigma__x = -10 .. 10, sigma__y = -10 .. 10, tau__xy = 0 .. 10, style = surfacecontour, numpoints = 100000, axes = normal), parameters = [f__cx = 0.1e-3 .. 10, f__cy = 0.1e-3 .. 10, f__45 = 0.1e-3 .. 10, sigma__cx = 0.1e-3 .. 10, sigma__cy = 0.1e-3 .. 10, tau__u = 0.1e-3 .. 10, f__tx = 0.1e-3 .. 10, f__ty = 0.1e-3 .. 10, alpha = 0.1e-3 .. 10]

 and this is what i get:

plot

The grainy surface should not be there. If it's not possible to remove it, it would be alright that surface would be smooth. Any ideas?


Dear Community,

I get this message

'EQU' is implicitly declared local to procedure 'Z_DAK_FSOLVE'Problem with procedurefor a procedure, and  cannot go further. How can I avoid it?

Tx for the help in advance,

best regards

Andras

Z_DAK_PROC.mw

I defined a procedure, OrderB(0,b,c), that essentially determines the order of a group that is defined by 2 parameters (the first parameter is always zero), so the output is an integer and the procedure is defined for every integer value of both parameters. I wanted to structure the outputs into a matrix with columns that represent one parameter and rows that represent the other. However, whenever I try to apply a method of defining the matrix, Maple returns the values of the procedure and then gives me an empty matrix.

>f:=proc (i, j) -> OrderB(0, i, j+3);
>Matrix(3, f);
                               1
                               4
                               1
                               1
                               4
                               1
                               1
                               4
                               1
               [NULL,NULL...]


I tried a second method where I defined a set s such that:

s:={(0,0)=OrderB(0,0,0) , (0,1)=OrderB(0,0,1).....}

but upon execution, maple returns:

1
4
1
....
s:={(0,0)=( ), (0,1)=( )...}

Please Help. I don't know what I'm mising in the code that is keeping Maple from putting the outputs of my procedure into the matrix.

The following code is part of my attempt to answer the recent Question about the bifurcation of the map f:= x-> exp(x^2*(a-x)). Two very weird things are happening. They can be seen by applying trace to f. The first is that the input argument to f seems to be changed to a very large integer. The second is that for some real values of a and x, I get imaginary results from this obviously real-valued function. Why are these things happening?

restart:

f:= x-> exp(x^2*(a-x)):

trace(f):

Iterate:= proc(a, x0:= 1., n:= 2000)
local A:= hfarray(1..n, [x0]), f:= subs(:-a= a, eval(:-f));          
     #evalhf(
          proc(f, A, n)
          local k;
               for k from 2 to n do A[k]:= f(A[k-1]) end do
          end proc
          (f, A, n);
     #);
     evalf[4]~(convert(A[1000..], set))
end proc:

Iterate(1.05);

{--> enter f, args = 4607182418800017408

 

HFloat(1.0512710963760241)

 

<-- exit f (now in unknown) = 4607413323290551347}
{--> enter f, args = 4607413323290551347

 

HFloat(0.9985962074909431)

 

<-- exit f (now in unknown) = 4607169774561176020}
{--> enter f, args = 4607169774561176020

 

HFloat(1.0525960836530153)

 

Warning,  computation interrupted

 

Iterate(.75);

{--> enter f, args = 4607182418800017408

 

.754589752755861+.192678397202388*I

 

<-- exit f (now in unknown) = HFloat(0.7545897527558614)+HFloat(0.19267839720238844)*I}

Error, (in unknown) unable to store 'HFloat(0.7545897527558614)+HFloat(0.19267839720238844)*I' when datatype=float[8]

 

 

 

Download bifurcation.mw

hi,

i'm trying to figure out where i did a mistake by coding reducedEchelonForm.

with(LinearAlgebra):
reduced:=proc(M)
 local l:=1, m:=RowDimension(M),n:=ColumnDimension(M),i,j; # l current column
 for i from 1 to m do # going trough every row item
  if n<l then # ColumnDimension need to be bigger than current column
   return M;
  end if;
 j:=i; # given current row item
 while M[j,l]=0 do # search for first rom item unequal zero
  j:=j+1;
  if m<j then # end of row
   j=i;
   l=l+1;
   if n<l then # end of rows and columns -> finish
    return M;
  end if;
 end if;
end do;
M:= perm(m,n,j,i).M; #permute row j and i
if not(M[i,l]=0) then # multiply row i with M[i,l])^(-1)
 M:= multiplikation(m,n,i,(M[i,l])^(-1)).M;
end if;
for j from 1 to m do # subtract every row j with row i for M[j,l]-times
 if not(j=i) then
  M:= addition(m,n,j,i,-M[j,l]).M;
 end if;
end do;
l:=l+1; # increase l by 1, next iteration i increase either
end do;
end proc:

 

Hint: perm(...),multiplikation(...) and addition(...) are the elementary matrices. They are working.

 

Now i got an error by running it: 

L:=Matrix(2,3,[1,2,3,4,5,6]);
reduced(L);
Error, (in reduced) invalid left hand side in assignment

Can someone explain me these error? And maybe a hint what i need to fix in my code?

Greets felix

How I can write a procedure in Maple 18 that it receives:

Inputs: function f(x) and real unmbers a and b (as interval [a,b]) and natural unmber n 

then devides interval [a,b] to n subinterval and computes f'(a), f'(a+(b-a)/n), f'(a+2(b-a)/n),..., and f'(a+n(b-a)/n)=f'(b)

and

showes at output: graph f(x) and all points [a,f'(a)], [a+(b-a)/n, f'(a+(b-a)/n)],[a+2(b-a)/n, f'(a+2(b-a)/n)]..., and [a+n(b-a)/n,f'(a+n(b-a)/n)] on a coordinate plane x-y

How I can write a procedure with Maple 18 that it receives function f(x) and x=a as inputs, 
then compute f'(a) and shows in output these 2 cases:

1) value f'(a)
2) curves f(x) ,y=f'(a)*(x-a)+f(a) and also the point (a,f'(a)) in a system ?

Hello,

I would like to obtain the display of several outputs from a procedure.

Sorry for this question which should be quiet simple but I didn't manage to solve my issue. By the past, I always wanted to obtain only one output from a procedure.

I put attached a example of procedure which calculates x^2 and x^3 for a given value of x.

With my procedure, I didn't obtain the display of the output calculating the square value.

How can I display all the outputs of a procedure ?

Thank you for your help

ExampleOfprocedure.mw

I'm trying to write a procedure that computes Pollard's P-1 Method for a given integer n, and then outputs the prime factorisation of n.

Here is what I have so far:

Pollard := proc (n)
local i, r, g;
r[1] := `mod`(2^factorial(2), n);
for i from 2 while gcd(`mod`(r[i-1]-1, n), n) = 1 do
r[i] := `mod`(2^factorial(i+1), n) end do;
g[i] := gcd(`mod`(r[i-1]-1, n), n);
if g[i] < n then return g[i]
else return n
end if
end proc;

But my procedure doesn't seem to work for a lot of large values for n.
And also I can't figure out how to make it actually output the factorisation.

Any help would be appreciated.

>mylist:=462;

mylist:=462

>kekuncirahsia:=proc(n) local c,d,r,sum; c:=n; while (c>9) do sum:=0; d:=c; while (d>9) do r:=irem(d,10); sum:=sum+r; d:=iquo(d,10);od; c:=sum+d;print(c);od;end;

>kekuncirahsia(mylist);

12

3

 

Hi, anyone know how i need to write my command to get this >> kekuncirahsiafinal:=3

I just want it to print the last digit..

Thank you~=]]

The solution should show the procedure.
But without tutor.

 

Problem.mw

 

Atte.

Lenin Araujo Castillo

 

Every time I try to type in a procedure I get the error:  

Error, unterminated procedure

immediately after typing in the first line.  How can I type in the remaining lines of my procedure?

Note:  in maple 7 (years ago) I never had this problem.

1 2 3 4 5 6 7 Last Page 1 of 21