Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Dear all, 

We are trying to use a fortran subroutine in maple using external calling. I was able to get the 'multiply' example working. i.e. through the steps descibed here: http://www.mapleprimes.com/questions/203646-External-Calling-FORTRAN-Dll--Error 

My mult.f looks like this: 

    subroutine multiply(a,b)
    real a,b,mult
    mult=a*b
    return 
    end

It simply takes two arguments (Real), and returns the product. I used the following commands to build the dll: 

1. gfortran -c mult.f        ## This creates the object file mult.o, which is used later. 

2. gfortran -shared -mrtd -o mult.dll mult.o ## This creates the dll and can be used in maple. 

The command in maple looks like this : 

mult := define_external("multiply",LIB="C:/shared/mult.dll",FORTRAN,'a'::(float[4]),'b'::(float[4]), RETURN::(float[4]));

And finally, 

mult(3., 3.) ## works, if it gives the correct output. 

Few things to note here are: 

1. The dll has to be generated from inside the Cygwin64 shell, with cygwin64/bin in the system path. 

2. This only worked for (some) 64-bit Maple version (Maple 2016 Standard). 

The reason, I repeated a working example, was because I tried following the same steps for the more complicated case, however without success so far.  This post explains an approach on how to pass a subroutine as an argument to a fortran subroutine in the dll. http://www.mapleprimes.com/posts/37031-Calling-An-External-Routine-That-Needs However the post is old and the steps did not work for me. 

My system is as follows: 

1. Fortran file to generate the dll, takefunc.f , takes a subroutine as an argument and calls it. 

    subroutine take(func)
    external func
    call func()
    end

2. Fortran driver file to verify that the dll generated through this program works: 

    PROGRAM main
    external take, fun
    call take(fun)
    END
    
    SUBROUTINE fun()
    PRINT *, "This is a nice one"
    END

I want the step 2 to be performed in maple, i.e. fun() should be a maple procedure, and we should be able to use either WRAPPER or second dll to use take() in maple. 

I want the process to work with latest maple versions and compilers, Windows7 64-bit or 32-bit (and hopefully later). F77 is fine. 

Regret the long post, will keep this post updated if I make any progress. Any guidance in this matter is highly appreciated. Anyway to make define_external spew more debug information will also help. 

- Chintan Pathak 

Research Scientist,

ChemE, University of Washington. 

Hi All,

To get EOM of a specific type of vibrating shell structure, I constructed the Hamilton equation of the system with messy and complex integrand (so many derivatives and variables are included). Now I have to calculate the variation of the Hamilton equation (del(int((T+U-V),t=t0..t1)=0) to get the EOMs and BCs of the system.

Is there anybody to know how to take a variation of such bulky integral in Maple?

Is there anyone to have experience in finding the EOM of shell structure using variational calculus in Maple?

Any comment will be useful.

Regards,

 

restart;
with(Statistics):
with(LinearAlgebra):
with(Optimization):
Digits:=10:

                      #********************************************#
lambda:=6328*10^(-10);
w0:=0.0005;
a0:=0.0004; 
z0:= a0^2/(4*lambda);  
N:=(a0^2)/(z0*lambda); 

                      #*********************************************#


u0:=x->((2/(w0*sqrt(2)))*sqrt(1./Pi))*LaguerreL(0,0.,2.*(x*a0)^2/w0^2)*exp(-(x*a0)^2/w0^2);

                                 
           #*****************************************************************
u1:=y->evalf(I*2*Pi*N*exp(-I*Pi*N*((a0*y)/a0)^2)*evalf(int(x*u0(x)*exp(-I*Pi*N*x^2)*BesselJ(0,2*Pi*N*(a0*y)*x/a0),x=0..1)));

          #*****************************************************************

u2:=r2->evalf(I*2*Pi*N*exp(-I*Pi*N*(r2/a0)^2)*evalf(int(y*u1(y)*exp(-I*Pi*N*y^2)*BesselJ(0,2*Pi*N*r2*y/a0),y=0..1)));

          #*****************************************************************
u3:=r3->evalf(I*2*Pi*N*exp(-I*Pi*N*(r3/a0)^2)*evalf(int(z*u2(z)*exp(-I*Pi*N*z^2)*BesselJ(0,2*Pi*N*r3*z/a0),z=0..1)));

 plot(abs(u3(r3)),r3=-0.0008..0.0008);

 

I have a code to write the equation of the plane passing through three points

restart:
with(geom3d):
point(A,1,-1,3):
point(B,-15,-17,11):
point(C,2,1,0):
plane(P,[A,B,C],[x,y,z]):
n:=NormalVector(P):
cdn:=ilcm(op(denom~(n))):
n:=cdn*n:
k:=igcd(n[1],n[2],n[3]):
if n[1]<>0 then sign(n[1])*cdn/k*sort(Equation(P))
elif n[2] <> 0 then sign(n[2])*cdn/k*sort(Equation(P))
else sign(n[3])*cdn/k*sort(Equation(P))
end;

How do I write the equation of the plane passing through list of following three points?
L := [[[-12, 2, -1], [-11, 1, -5], [-10, -2, 3]], [[-12, 2, -1], [-11, 1, -5], [-10, 6, 3]], [[-12, 2, -1], [-11, 1, -5], [-9, 5, -7]], [[-12, 2, -1], [-11, 1, -5], [-9, 8, -4]], [[-12, 2, -1], [-11, 1, -5], [-7, -6, -2]], [[-12, 2, -1], [-11, 1, -5], [-7, -2, -8]], [[-12, 2, -1], [-11, 1, -5], [-7, -2, 6]], [[-12, 2, -1], [-11, 1, -5], [-7, 3, -9]], [[-12, 2, -1], [-11, 1, -5], [-7, 3, 7]], [[-12, 2, -1], [-11, 1, -5], [-7, 6, -8]], [[-12, 2, -1], [-11, 1, -5], [-7, 9, 3]], [[-12, 2, -1], [-11, 1, -5], [-7, 10, -2]], [[-12, 2, -1], [-11, 1, -5], [-6, -4, -7]], [[-12, 2, -1], [-11, 1, -5], [-6, -4, 5]], [[-12, 2, -1], [-11, 1, -5], [-6, 8, -7]], [[-12, 2, -1], [-11, 1, -5], [-6, 8, 5]], [[-12, 2, -1], [-11, 1, -5], [-4, -6, 3]], [[-12, 2, -1], [-11, 1, -5], [-4, -2, -9]], [[-12, 2, -1], [-11, 1, -5], [-4, -2, 7]], [[-12, 2, -1], [-11, 1, -5], [-4, 6, -9]], [[-12, 2, -1], [-11, 1, -5], [-4, 6, 7]], [[-12, 2, -1], [-11, 1, -5], [-4, 10, 3]], [[-12, 2, -1], [-11, 1, -5], [-2, -6, 3]], [[-12, 2, -1], [-11, 1, -5], [-2, 6, -9]], [[-12, 2, -1], [-11, 1, -5], [-2, 6, 7]], [[-12, 2, -1], [-11, 1, -5], [-2, 10, 3]], [[-12, 2, -1], [-11, 1, -5], [3, 5, -7]], [[-12, 2, -1], [-11, 1, -5], [3, 8, -4]], [[-12, 2, -1], [-11, 1, -5], [4, -2, 3]], [[-12, 2, -1], [-11, 1, -5], [4, 6, 3]], [[-12, 2, -1], [-11, 1, -5], [5, 6, -2]], [[-12, 2, -1], [-11, 1, 3], [-10, -2, -5]], [[-12, 2, -1], [-11, 1, 3], [-10, 6, -5]], [[-12, 2, -1], [-11, 1, 3], [-9, 5, -7]], [[-12, 2, -1], [-11, 1, 3], [-9, 8, -4]], [[-12, 2, -1], [-11, 1, 3], [-7, -6, -2]], [[-12, 2, -1], [-11, 1, 3], [-7, -2, -8]], [[-12, 2, -1], [-11, 1, 3], [-7, -2, 6]], [[-12, 2, -1], [-11, 1, 3], [-7, 6, -8]], [[-12, 2, -1], [-11, 1, 3], [-7, 9, -5]]]

Friends

I have plotted some figures and saved them yesterfay!

now once i opened them some nonsence digits appear on the figure! see the picture please. anyone has similar experience? how to solve it!

Dont make me disappointed maple! two days work is invain now !

 

**I am trying write a procedure (bit(n,k)) that print all the binary sequences with 2 following conditions:
  - Each of the sequences has the length of 'n'. (n elements)
 - k bits of n elements have the value 1. (all the remains have the value 0)
   Example: bit(3,2) and the result is ((101),(110),(011)).
**My code:
bit := proc (n, k)
     local one, index, i, d;
     global A;
     one := 0;
     index := 1;
     A := [seq(0, i = 1 .. n)];
     d := proc (index)
        if one = k or index = n+1 then return NULL; end if;
        for i from 0 to 1 do
              A[index] := i;
              if i = 1 then one := one+1; end if;
              if one = k then print(op(A)); end if;
             d(index+1);
             if i = 1 then one := one-1; A[index] := 0; end if;
        end do;
     end proc;
     d(1);
end proc;
>bit(5,1);
result:
0, 0, 0, 0, 1
That 's not the answer for the excercise. What is the problem?

 

I have a question that I hope someone can help with. We perform extreme value analysis on expressions. My this I mean that we evaluate expressions for each combination of min or max values of each variable in the expression. For example, the expression a*b+c*d has 4 variables and we would evaluate the expression for all of the 16 combinations of a,b,c, and d to determine the worst-case result. I understand that the worst case results may not occur at the extreme values of the variables, but that is a different question.

 What I would like to know is if there is a way to reduce the number of calculations by splitting the expression into independent parts. In the example above, the expression consists of 2 parts a*b and c*d. These parts could be evaluated separately. Each has 2 variables, and each would therefore requires  4 combinations of variables to determine the extreme values of the results. So in this case, the number of calculations is 4+4=8, which is half of the initial 16  runs as would be done with a full-factorial analysis. Also, because each calculation is done on only part of the original expression, each calculation takes less time.

Is there a way to find the independent parts of an arbitrary expression so that each independent part could be evaluated separately to speed processing?

Thanks

In the right bottom corner of the Maple window, there is data on Time, Bytes, and Available. My task is supposed to perform computation, however the Time data reached the value of 33393.1 s (about 9 hours) and is not being updated (the value does not increase) anymore for at least half an hour. Is this normal or does it mean that something is wrong with my computation process? Windows Task Manager indicates that CPU Usage is 100% and mserver uses about 40-50%. The procedure I use (diffalg(04), Rosenfeld-Groebner) is such that I have no idea how much time the task will require.

Thank you

I use Maple worksheet mode (not document mode). When I have a long line of code, or when I display some Maple source code, and if the line do not fit the current window size, the line will wrap to the next line, and make it hard to read the code.

Is there a way to configure the setting do that Maple keeps long line on same line and then I can use the horizontal scroll bar if I want to see the full line. This way the code is easier to read for me.

I looked at OPTIONS->DISPLAY and no see no such option. I also looked at few other options.

Here is a screen shot of what  I mean. Line 165 is too long and it wraps for example

Any one know if it possible to see the steps used by the limit() function as one does with many other functions such as dsolve and int ?  This is what I tried

restart;
infolevel[limit]:=5;
interface(verboseproc=3);
limit(x^2 *log(x),x=0);

But I see no steps, only the final answer. Are not all Maple functions possible to trace? How does one know which functions can generate trace and which do not?

I am using Maple 2016.1

I wanted to see something like:

let x=1/t, hence expression becomes  (-ln t)/t^2, now taking limit as t->infinity. Applying L'Hopital rule, limit t->infinity of -1/(2 t^2) which gives zero.

I assumed this is something what Maple does internally, (but there are other ways also) and wanted to see what Maple does.

 

Hi

I would like to extract the Anew matrix from the old matrix A. such that each row from Anew matrix has a square form of old matrix i.e all number from each row in the Anew form a square in my old matrix A ...

Is there any loop to determie  the Anew matrix in general  case

Such that A new

A := Matrix([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36, 37, 38, 39, 40], [41, 42, 43, 44, 45, 46, 47, 48, 49, 50]])

Anew = Matrix([[2, 13, 22, 11], [4, 15, 24, 13], [6, 17, 26, 15], [8, 19, 28, 17], [13, 24, 33, 22], [15, 26, 35, 24], [17, 28, 37, 26], [19, 30, 39, 28], [24, 35, 44, 33], [26, 37, 46, 35], [28, 39, 48, 37]])

Many thanks

For some strange reason my matrices are shown in a very bizarre format (see imgur link). All I want is to simply see the 6x6 matrix with the numerical values - any help would be greatly appreciated. http://imgur.com/a/qaQmb

    My profile picture was formerly animation and looked like this: 


  It would be interesting to paint a triangle on a sphere. How can I do that?

> restart;
> with(plots); with(StringTools); with(plottools);
> INF := 999999999999999999999;
                     999999999999999999999
> NULL;
> MinoxAngle := 200; MikromaAngle := 350; MinicordAngle := 290; GamiAngle := 280; GamiFocal := 0.25e-1; SummitarDial := [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 2, 2.2, 3, 4, 5, 6, 7, 10, 20, INF]; Minox35MLDial := [3, 4, 6, 10, 20, INF]; Minox35Angle := 100; MinicordDial := [.35, .4, .5, .6, .7, .8, .9, 1, 1.2, 1.5, 2, 3, 4, 8, INF]; Mini := nops(MinicordDial); MikromaDial := [.5, .6, .7, .8, .9, 1, 1.2, 1.5, 2, 2.5, 3.5, 6, INF]; MinoxLXDial := [.2, .24, .3, .4, .6, 1, 2, 30]; MinoxLXAngle := 270; GamiDial := [.5, .6, .7, .8, 1, 1.2, 1.5, 2, 3, 5, 99990000000000]; MinoxBDial := [8*(1/12), 10*(1/12), 1, 1.5, 2, 3, 6, INF]; MinoxBAngle := 270;
                              200
                              350
                              290
                              280
                             0.025
[1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 2, 2.2, 3, 4, 5, 6, 7, 10, 

  20, 999999999999999999999]
            [3, 4, 6, 10, 20, 999999999999999999999]
                              100
 [0.35, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.2, 1.5, 2, 3, 4, 8, 

   999999999999999999999]
                               15
    [0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.2, 1.5, 2, 2.5, 3.5, 6, 

      999999999999999999999]
              [0.2, 0.24, 0.3, 0.4, 0.6, 1, 2, 30]
                              270
   [0.5, 0.6, 0.7, 0.8, 1, 1.2, 1.5, 2, 3, 5, 99990000000000]
         [2  5                                        ]
         [-, -, 1, 1.5, 2, 3, 6, 999999999999999999999]
         [3  6                                        ]
                              270

> NULL;
> dd := GamiDial; N := nops(dd); dstx := [seq(convert(dd[i], string), i = 1 .. N)];
   [0.5, 0.6, 0.7, 0.8, 1, 1.2, 1.5, 2, 3, 5, 99990000000000]
                               11
  [".5", ".6", ".7", ".8", "1", "1.2", "1.5", "2", "3", "5", 

    "99990000000000"]
> NULL;
> MinicordAngle := 290;
                              290
> NULL;

> LensDial := proc (LensName, focal, Angle, scale, dr) local p1, p2, p3, p8, pk, pt, rk, R, R2, R3, Rc, c1, ds2; R := 1600; R2 := 1400; R3 := 1200; Rc := 1500; CaptionTail1 := "EXTENSION ANGLE"; CaptionTail2 := "LENS FOCUSING DIAL"; Caption1 := Join([LensName, CaptionTail1]); Caption2 := Join([LensName, CaptionTail2]); q := 180/Pi; rotation := 90; dir := dr; ds := scale; N := nops(ds); dstx := [seq(convert(ds[i], string), i = 1 .. N)]; ds2 := subs(dstx[N] = infinity, dstx); MaxAngle := Angle; f := focal; degr := -(-ds[1]+f)*Angle/(D-f)+rotation; g1 := degr/q; for j to N do deg[j] := subs(D = ds[j], degr) end do; for i to N do rdn[i] := evalf(deg[i]/q); xv[i] := R2*cos(rdn[i]); yv[i] := R2*sin(rdn[i]); wx[i] := R3*cos(rdn[i]); wy[i] := R3*sin(rdn[i]) end do; pk := {seq([ds[i], deg[i]], i = 1 .. N)}; rk := {seq([dir*xv[i], yv[i]], i = 1 .. N)}; txt := {seq([dir*wx[i], wy[i], ds2[i]], i = 1 .. N)}; p3 := pointplot(rk, caption = Caption2, captionfont = ["ROMAN", bold, 22], symbol = solidcircle, symbolsize = 15, color = red, axes = none); c1 := circle([0, 0], Rc, thickness = 8); p8 := textplot(txt, 'font' = ["times", "bold", 14]); display(p3, c1, p8, scaling = constrained) end proc;
Warning, `CaptionTail1` is implicitly declared local to procedure `LensDial`
Warning, `CaptionTail2` is implicitly declared local to procedure `LensDial`
Warning, `Caption1` is implicitly declared local to procedure `LensDial`
Warning, `Caption2` is implicitly declared local to procedure `LensDial`
Warning, `q` is implicitly declared local to procedure `LensDial`
Warning, `rotation` is implicitly declared local to procedure `LensDial`
Warning, `dir` is implicitly declared local to procedure `LensDial`
Warning, `ds` is implicitly declared local to procedure `LensDial`
Warning, `N` is implicitly declared local to procedure `LensDial`
Warning, `dstx` is implicitly declared local to procedure `LensDial`
Warning, `MaxAngle` is implicitly declared local to procedure `LensDial`
Warning, `f` is implicitly declared local to procedure `LensDial`
Warning, `degr` is implicitly declared local to procedure `LensDial`
Warning, `g1` is implicitly declared local to procedure `LensDial`
Warning, `j` is implicitly declared local to procedure `LensDial`
Warning, `deg` is implicitly declared local to procedure `LensDial`
Warning, `i` is implicitly declared local to procedure `LensDial`
Warning, `rdn` is implicitly declared local to procedure `LensDial`
Warning, `xv` is implicitly declared local to procedure `LensDial`
Warning, `yv` is implicitly declared local to procedure `LensDial`
Warning, `wx` is implicitly declared local to procedure `LensDial`
Warning, `wy` is implicitly declared local to procedure `LensDial`
Warning, `txt` is implicitly declared local to procedure `LensDial`
> ;
> NULL;
> LensDial("MEOPTA MICROMA  HELGOR 25mm", 0.25e-1, 350, MikromaDial, 1);

> LensDial("GOERZ MINICORD  25mm", 0.25e-1, 335, MinicordDial, 1);


> ;
> LensDial("MINOX LX MINOX 15mm", 0.15e-1, 270, MinoxLXDial, 1);

> LensDial("GAMI ESAMITAR 25mm", 0.25e-1, 290, GamiDial, 1);

First 997 998 999 1000 1001 1002 1003 Last Page 999 of 2215