gkokovidis

2335 Reputation

13 Badges

20 years, 298 days
Draeger Medical Systems, Inc.

 

 

Regards,
Georgios Kokovidis
Dräger Medical

MaplePrimes Activity


These are answers submitted by gkokovidis

The problem has to do with comparison of numbers that are not type "numeric".  In a boolean context, if this does not return true, then you get the erorr message that you reported above.  You already know what the workaround is.

> type(Pi,numeric);
                                false

> type (3.14,numeric);

                                 true

> type(evalf(Pi),numeric);

                                 true

 

>?type

for more help on this.

 

Your question is not clear with respect to what you want to do.  An exampe would be helpful.  Below is an example that uses the "degree" function.  For details look at help.



restart:

a := x^3+5*x^2+11*x+15;

(1)

pp:=[op(a)];

(2)

nops(pp);

(3)

seq(degree(pp[i]),i=1..nops(pp));

(4)

degree(5*x^3+y^4);

(5)

 



Download polypower.mws

 

 

Look @ ArrayTools[SearchArray]

(i, j, v) := ArrayTools:-SearchArray(x);

 

@tirazheh , I got the same error if I replace the mat_mult.dll with another file (non dll) and rename it.  So, it seems like you have a corrupt .dll file.  Try it with the Watcom compiler that ships with Maple, to determine whether or not the problem is with Visual Studio 2010.

This usually implies that Maple cannot find the .dll that it needs.  For the example, I created a directory in my temp folder called share, just like the example.  Then, using Visual C++ 9.0 Express, I launched the command line compiler, and changed to the directory that the .c file was located in.  Below is what it looks like in the dos command prompt window.

 

Setting environment for using Microsoft Visual Studio 2008 x86 tools.

C:\Program Files\Microsoft Visual Studio 9.0\VC>cd c:\temp\share

C:\temp\share> cl -Gz mult.c -link -dll -export:mult -out:mult.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

mult.c
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:mult.exe
-dll
-export:mult
-out:mult.dll
mult.obj
   Creating library mult.lib and object mult.exp

C:\temp\share>

 

In Maple, if I delete the .dll file from the share directory, I get the same error that you reported.


Error, external linking: error loading external library c:/temp/share/mult.dll: The specified module could not be found.

 

When the .dll is in the right spot, it works fine.

 

restart:

my_mult := define_external('mult', LIB = "c:/temp/share/mult.dll", 'a'::(integer[4]), 'b'::(integer[4]), RETURN::(integer[4])):

my_mult(10, 3);

(1)

 

 



Download mat_mult.mws

 

 

You can use "display", which is part of the plots package to combine more than one plot (it can be a mix of plot structures, like spacecurve and plot3d for example), or you can combine the curves you wish to plot in one statement.  See example below.  The first part is right out of the help page for the "spacecurve" command.

 



 

restart:with(plots):

spacecurve({[sin(t),0,cos(t),t=0..2*Pi],[cos(t)+1,sin(t),0,numpoints=10]},t=-Pi..Pi,axes=FRAME);

 

plot1:=spacecurve([sin(t),0,cos(t),t=0..2*Pi],t=-Pi..Pi):

plot2:=spacecurve([cos(t)+1,sin(t),0,numpoints=10],t=-Pi..Pi):

display(plot1,plot2,axes=FRAME);

 

spacecurve({[2*t+3,5*t-2,-t+1],[-2*t+7,t+8,2*t-1]},t=-4..4,axes=Normal,orientation=[45, 56,0],thickness=3);

 

eq1:=2*t+3=-2*s+7;

(1)

eq2:=5*t-2=s+8;

(2)

eq3:=-t+1=2*s-1;

(3)

solve({eq1,eq2},{t,s});

(4)

eval(eq1,{t=2,s=0});

(5)

eval(eq2,{t=2,s=0});

(6)

eval(eq3,{t=2,s=0});

(7)

ss:=spacecurve({[2*t+3,5*t-2,-t+1],[-2*t+7,t+8,2*t-1]},t=-4..4,axes=Normal,orientation=[45, 56,0],thickness=3):

pp:=pointplot3d([7,8,-1],symbol=solidcircle,symbolsize=30,color=red):

display(ss,pp);

 

 

 



Download IntersectingLinesSpa.mws

 

See if the command FromMatlab can convert your Matlab code for you.  There are a couple of examples in the help pages.

?Matlab[FromMatlab]

 

You can change the limit value to something greater than 1000000 under Options - Precision.

 

 

 

It did not occur to me to try the Standard interface, V14, because I rarely use it.  The other version I have @ home is v9.51, and with this version it works with both interfaces. 

 

 

The above code that you posted works for me, but it is hard to see what is going on with the default "point" style.  I changed the symbol to circle so that I could use the symbolsize option to make them bigger.  I also changed the axes to boxed to see what is going on.  From the animation, you are rotating the phi viewpoint of the plot, which gives the impression that the points are moving, even though they are static.  Is this what you are looking for with respect to the animation, or something else?



restart:

with(plots):
animate(pointplot3d,[[[1,2,3],[4,5,3],[2,2,2]],symbol=circle,color=blue,symbolsize=30,orientation=[45,A]],A=45..315,axes=boxed);

   



Download animpp3d.mws

 

 

 

 

For your particular example above, you could also do the following:

seq(convert(mylist[i],binary),i=1..nops(mylist));

 

 



restart:

M := Matrix(5, 5, proc (i, j) options operator, arrow; 7*j-i end proc);

(1)

with(LinearAlgebra):

ColumnOperation(M, 2, 10);

(2)

Using the deprecated linalg command mulcol:

with(linalg):

mulcol(M,2,10);

(3)

 

 

 



Download columnOperations.mws

 

 

 

 

The worksheet below has two examples using your data.  There are other ways to do this, by reading in your data from an external file.  For help on the commands used, look at plot, display, Scatterplot commands from the Help menu.



restart:with(plots):

v1:=<1.1,1.5,2,2.5,2.71>;

(1)

v2:=<0.751,0.764,0.777,0.796,0.81>;

(2)

v3:=<0,0.419,0.665,0.791,0.81>;

(3)

plot(<v1|v2>,thickness=3);

 

plot(<v1|v3>,thickness=3,color=blue);

 

with(plots):

p1:=plot(<v1|v2>,thickness=3):

p2:=plot(<v1|v3>,thickness=3,color=blue):

display(p1,p2);

 

with(Statistics):

P:=ScatterPlot(v1, v2, lowess, degree = 1, thickness = 2, title="Scatter Plot",color=red):

Q:=ScatterPlot(v1, v3, lowess, degree = 1, thickness = 2, title="Scatter Plot",color=blue):

display(P,Q);

 



Download dataplotvec.mws

 

 


The command modp in Maple can be used the same way that mod can in Matlab.  The mod command will give you the same answer, but the usage is different.

For example, in Matlab

mod(13,5)
ans =
3

mod([1:5],3)
ans =
1 2 0 1 2

In Maple

> modp(13,5);
                                  3

> modp([1,2,3,4,5],3);
                           [1, 2, 0, 1, 2]

> [1,2,3,4,5] mod 3;
                           [1, 2, 0, 1, 2]

 

The DynamicSystems package was built in.  I do not remember which version started to use it, but you can check to see if ver 11 has it by typing the following:

with(DynamicSystems);

If it was part of ver 11, then you will see all of the functions that are supported.  If it is not a part of ver 11, then you will get an error message, similar to the one below:

Error, invalid input: with expects its 1st argument, pname, to be of type {package, module}, but received DynamicSystems

 

Hope this helps.

First 22 23 24 25 26 27 28 Last Page 24 of 75