Scott03

744 Reputation

10 Badges

14 years, 336 days

MaplePrimes Activity


These are answers submitted by Scott03

If you have a current version of Maple (or even if you have Maple 11 or later) there is a reference option so that you can reference label numbers in other worksheet.  So, the first thing you want to do is go to the first two worksheets and find out what was the label numbers you wanted to reference.  Then go to the third worksheet and click on Insert> Reference.  Then find one of the worksheets in the file dialog box and select OK.  On the next box it will provide you a list of labels in that worksheet and you can select the label you want to reference.  Once this is done, the information for that label is in your worksheet and you can then assign it to a variable name to use later on.

Scott
Application Developer
Maplesoft

Could you provide a worksheet that shows what you entered for both a and r?  I have tried a simple case and it does work, but the problem that you are getting may have to do with the functions being used or how something was typed.  You should be able to upload a Maple worksheet by using the green up arrow that is found in menu bar.

Scott
Application Developer
Maplesoft

I understand that this is one of the decisions that was made so that any code that is collapsed into a section should have some output so that you know where it is and don't accidentally delete the section with your code.  There is a way to get around this, all you need to do is add the following line to your code

  print(``);

Make sure that the above is also joined to the same Document block and is executed.  This produces a NULL character on the output which would satisfy Maple for some output and should satisfy your requirement to collapse the section with no visible output.  Just a warning, it will be hard to find that section later on when you come back to the worksheet.

Scott
Application Developer
Maplesoft

You should be able to either assign the result of the isolate function to a variable or use the label number that is generated.  You should then be able to refer to that variable or label number in the subs call.

The following shows this concept

eq1:=x^2+5*y=10;
eq2:=y=x/2+10;
Yval:=isolate(eq1,y);
subs(Yval,eq2);
isolate(%,x);

Scott
Application Developer
Maplesoft

The answer to your question why the last is true comes from the ?type,complex help page.  On this help page it says the following:

"The type(x, complex) function returns true if x is an expression of the form  a + I b, where a (if present) and b (if present) are finite and of type realcons."

Therefore a real number which would have 'b' being 0, would also be considered as type complex.

Scott
Application Developer
Maplesoft

Joe's suggestion would work if you are wanting to display the output in the Maple window.  If you want to display these numbers in a Maplet textbox you could try the following code:


G1:=proc()
Maplets:-Tools:-Set('TB1' = cat(seq((i,"\n"),i=1..5)));
end proc:

with(Maplets[Elements]);
maplet2 := Maplet([[TextBox['TB1']("", height = 6), Button("Append", Action(Evaluate('function' = 'G()'))), Button("Close", Shutdown())]]);
Maplets[Display](maplet2);
 

If you have text in the textbox that you would like to leave in the textbox and have these numbers show up after it, just chate the Maplets:-Tools:-Set command to the following:

Maplets:-Tools:-Set('TB1' ('appendline') = cat(seq((i,"\n"),i=1..5)));

Scott
Application Developer
Maplesoft

So this should work for you.

makearray:= proc()
 local L, i, x, y, xp;
 L := hfarray(1 .. 3,1 .. 2);
 x:= 0.6; y := 0.2;
 for i to 3 do
   xp := 1+y-1.4*x^2;
   y  := .3*x;
   x  := xp;
 L[i,1]:= x; L[i,2]:= y;
 od;
 L;
end:

L := evalhf(makearray());

plots:-pointplot3d([seq([L[i,1],L[i,2],9],i=1..3)],axes=framed, symbolsize=15, color=blue);

 

Scott
Application Developer
Maplesoft

What do you want the end result to show?  In your example, you will not be able to get the exact result from the movie with the same exact steps since in the movie all the commands being collapsed produced results.  In your case I would follow these steps:

  1. Remove the Document Block for that section
  2. While the section is still highligted go to Edit >Split/Join> Join Execution groups
  3. Now go to the Format menu and select "Create Document Block"

This should produce the result that the Maple Commands are hidden and only the results are being displayed.

Scott
Application Developer
Maplesoft

Could you provide the worksheet as well as the operating systems that are on each of the computers.  Without that information, anyone who tries to answer your question can only guess what you may be seeing.

Scott
Application Developer
Maplesoft

With the code that you wrote, you now have a three sets of points (both x and y), but for a 3-D plot you will need a third point.  Going from the previous post, you can use these points as input for your function to get the third point.  For example the following will work

makearray:= proc()
 local L, i, x, y, xp;
 L := hfarray(1 .. 3,1 .. 2);
 x:= 0.6; y := 0.2;
 for i to 3 do
   xp := 1+y-1.4*x^2;
   y  := .3*x;
   x  := xp;
 L[i,1]:= x; L[i,2]:= y;
 od;
 L;
end:

L := evalhf(makearray());

f:=(x,y)->x^2+y^2;

plots:-pointplot3d([seq([L[i,1],L[i,2],f(L[i,1],L[i,2])],i=1..3)],axes=framed, symbolsize=15, color=blue);

 Of course, you could always alter the makearray procedure to add the third column and it would make this call a lot easier.  For example if I use the same function as above you could do something like this

makearray:= proc()
 local L, i, x, y, xp;
 L := hfarray(1 .. 3,1 .. 3);
 x:= 0.6; y := 0.2;
 for i to 3 do
   xp := 1+y-1.4*x^2;
   y  := .3*x;
   x  := xp;
 L[i,1]:= x; L[i,2]:= y; L[i,3]:=x^2+y^2;
 od;
 L;
end:
L := evalhf(makearray());
plots:-pointplot3d(L, axes = framed, symbolsize = 15, color = blue);

I hope this helps.

Scott
Application Developer
Maplesoft

Is something like the following what you are looking for?

x:=RandomTools:-Generate(list(float,10)):
y:=RandomTools:-Generate(list(float,10)):
f:=(x,y)->sin(x+y);
 

points:=[seq([x[i],y[i],f(x[i],y[i])],i=1..10)];

The first three lines can be changed do your definition of your x and y lists and the function f with two inputs.

 

Scott
Application Developer
Maplesoft

I don't have a comment on the formatting issue that you are mentioning.  I haven't tried that yet.  But if you are just converting to RTF just for PDF, why don't you use a program to convert to a pdf directly.  On my windows computer I have a program called PDFCreator that acts as a printer but converts the worksheet into a PDF.  I also know of others who use CutePDF.  In Maple 13 there is a build in option for creating a pdf from a Maple worksheet.

Scott
Aplication Developer
Maplesoft

The plot command will work, provided you have already defined what u(x) is equal to.  The plot commands in Maple need the function that is being plotted to be a numeric value at each of the x values.

Scott
Application Developer, Maplesoft

What did you do to get this error?  Did you get this in Maple or another product?  If you got it in Maple, could you try posting the a simple worksheet that produces the error message?

Scott
Application Developer, Maplesoft

One way to do this is to include the call within a try catch loop.  For example if you try the following where the file doesn't exist you would get:

> ImportMatrix("C:\\This_File_Doesnt_exist.txt");

    Error, (in ImportMatrix) file or directory does not exist
 

But if you place a try catch statement you can do something like the following:

> try
ImportMatrix("C:\\This_File_Doesnt_exist.txt");
catch "file or directory does not exist":
error "This is my error message";
end try;

   Error, This is my error message
 

You can also place this within your proc like the following:

> MyImport := proc (StringIn) try ImportMatrix(StringIn) catch "file or directory does not exist": error "This is my error message" end try end proc;
> MyImport("C:\\This_File_Doesnt_exist.txt");

   Error, (in MyImport) This is my error message
 

In these cases I have only been catching the one error, but if you leave out the string, then you can catch most of the errors that ImportMatrix will throw.

Scott
Maplesoft

5 6 7 8 9 10 11 Last Page 7 of 30