nm

11353 Reputation

20 Badges

13 years, 14 days

MaplePrimes Activity


These are replies submitted by nm

@acer 

Although eps works, I use lualatex and not pdflatex, which will end up converting eps to pdf on the fly, since native lualatex only reads pdf images.

So for this latex

\documentclass[12pt]{book}
\usepackage{graphicx}
\begin{document}

test

\includegraphics[width=.5\textwidth]{t.eps}

\end{document}

where t.eps was the file generated from Maple using

plotsetup(default):
plotsetup(postscript, plotoutput="t.eps", plotoptions=`color,portrait,height=300`);
plots[display](Array([p1,p2]));   #must be; to show up in file
plotsetup(default):

then compiling using lualatex foo.tex  it does the conversion on the fly

[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2020/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty

generating a file called t-eps-converted-to.pdf  in same folder, which then uses.  This is the final PDF of the above latex

But I also need all images in pdf becuase I use other tools that convert the PDF images to SVG (pdf2svg), since I need an SVG version for HTML (better quality than png, since SVG is vector graphics). I also use a PDF crop tool which automtically crops any empty spaces around images in PDF files and that works on PDF files only.

Bascially starting with PDF image file instead of eps is so much easier for me. pdflatex these days take PDF as image files as well.

The world runs on PDF these days. It is a universal format. eps and .ps are dead formats for all practical purposes. More reason for Maplesoft to add support for PDF's.

@acer 

"were interested in exporting the whole worksheet" sorry if I was not clear. I never actually export whole Maple document to anything. The output is not that useful. 

But I might want to export a specific plot or object to pdf to add it to latex.

I don't think that you're going to get great success (easily, or perhaps at all) by trying to deal with exporting arrays of plots by themselves.

Actually I just found out, when I export the Array of plots, it works and automatically removed all the spaces on its own. I assumed first is that what I am looking at in the screen is what will show up in pdf. 

restart;
p1:=plot(sin(x), x=-Pi..Pi, size=[300,300]):
p2:=plot(cos(x), x=-Pi..Pi, size=[300,300]):
plots[display](Array([p1,p2])); 

But now when I did this

 

plotsetup(default):
plotsetup(postscript, plotoutput="t.ps", plotoptions=`color,portrait,height=300`);
plots[display](Array([p1,p2]));   #must be; to show up in file
plotsetup(default):

And converted the generated t.ps file to t.pdf using adobe, the PDF output do not have the wasted space. But it is not very good looking. May be it needs more adjustments. Strange that what shows on the screen (in the worksheet) does not match what goes to the PDF file.  For example  on the screen the tick labels show as symbolic Pi/4, Pi/2, etc.. but in the PDF these got converted to actual numerical values.

This will make it very hard for normal person who is not expert in Maple to use Maple to generate plots and images to use for professional reports and papers which most use Latex and PDF, if the quality is like this as it seems it needs more tweeking. (fonts, etc...) but at least the wasted space is not there which is progress.

 

@acer 

Thanks. This did generate better result:

restart;

p1:=plot(sin(x), x=-Pi..Pi, size=[300,300]):
p2:=plot(cos(x), x=-Pi..Pi, size=[300,300]):
p:=DocumentTools:-Tabulate([p1,p2],width=50);

When I tried to export the above to PDF using the GUI first (by right-clicking) on both,, I could not select the whole output above at same time. I could only select either the left or the right plot, then do, using the menu export->PDF. So this does not work.

Next, I tried plottsetup as the export() command does not support PDF file option. (Very strange that to this day, one can not export a plot to pdf using the export command. How many more years it will take for Maplesoft to add direct support to exporting plots to pdf? It is the year 2020 after all. This is not 1990.)

Export("myPlot.pdf",p);
Error, (in Export) file type not recognized
 

So I tried 

plotsetup(default):
plotsetup(postscript, plotoutput=`t.eps`, plotoptions=`color,portrait,height=300`);
DocumentTools:-Tabulate([p1,p2],width=50):
plotsetup(default):

However, this genrated no file. I could not find `t.eps` anywhere. Also tried `t.ps` I think it did not work, since DocumentTools:-Tabulate  is not a plot command ofcourse. So this does not work. So I went back to the export command, and tried another format, such as JPEG and GIF, but these also did not work for Tabulate.

Export("myPlot.gif",p);

Error, (in Export) invalid input: format GIF not supported for this input

So I give up. Not able to figure how to export the output of DocumentTools:-Tabulate([p1,p2],width=50): to a file. May be there is a way. I do not know.

@Kitonum 

I tried it. I do not see any difference between it and the default color. But thanks for the suggestion.

restart;
#https://www.mapleprimes.com/questions/228539-Set-Size-Of-3D-Plot
setsize:=proc(P,sz::[posint,posint])
  op(0,P)(remove(type,[op(P)],'specfunc(ROOT)')[],
          ROOT(BOUNDS_X(0),BOUNDS_Y(0),
               BOUNDS_WIDTH(sz[1]),BOUNDS_HEIGHT(sz[2])));
end proc:

f:=-x^4-2*y^4+14*x^2*y^2/5:
p1:=plot3d(f, x=-5..5,y=-5..5,
   axes     = boxed,
   axesfont = [Times,default,10],
   axis  = [tickmarks=[3,subticks=5],thickness=0],
   labeldirections = [horizontal, horizontal, horizontal],        
   labels   = ['x', 'y', 'z'],
   title    = "default color",
   scaling  = unconstrained, view=[-5.2..5.2,-5.2..5.2,-1300..40]):
p1:=setsize(p1, [300,300]):
p2:=plot3d(f, x=-5..5,y=-5..5,
   axes     = boxed,
   axesfont = [Times,default,10],
   axis     = [tickmarks=[3,subticks=5],thickness=0,color="DarkSlateGray"],
   title    = "DarkSlateGray",
   labeldirections = [horizontal, horizontal, horizontal],        
   labels   = ['x', 'y', 'z'],
   scaling  = unconstrained, view=[-5.2..5.2,-5.2..5.2,-1300..40]):
p2:=setsize(p2, [300,300]):
p3:=plot3d(f, x=-5..5,y=-5..5,
   axes     = boxed,
   axesfont = [Times,default,10],
   axis  = [tickmarks=[3,subticks=5],thickness=0,color="gray"],
   title    = "gray color",
   labeldirections = [horizontal, horizontal, horizontal],        
   labels   = ['x', 'y', 'z'],
   scaling  = unconstrained, view=[-5.2..5.2,-5.2..5.2,-1300..40]):
p3:=setsize(p3, [300,300]):
plots[display](Array([p1,p2,p3]));

 

 

@Kitonum 

Thanks. When I used gray for the color of the frame, it made the actual ticks labels hard to read. Is there a way to make the frame itself light gray or gray or less thick of line, but not affect the actual ticks and the numbers on the tick? i.e. control the frame settings seperate from ticks and ticks labels?

restart;
f:=-x^4-2*y^4+14*x^2*y^2/5:
plot3d(f, x=-5..5,y=-5..5,
   axes     = boxed,
   axesfont = [Times,default,10],
   axis  = [tickmarks=[3,subticks=5],thickness=0,color=gray],
   labeldirections = [horizontal, horizontal, horizontal],        
   labels   = ['x', 'y', 'z'],
   scaling  = unconstrained, view=[-5.2..5.2,-5.2..5.2,-1300..40]);

 

 

@acer 

I see. This means someone got so upset with me to have to take away their vote for me for 3 different posts in such short time.

This has to have taken some work to do, as they would have to search for these in thre past and it is not easy to find where one have voted for someone else.

I am sorry I must have made someone so upset. I thought I was being helpful by posting some issues I found testing Maple, which took me 2 days to find them.

I will make sure from now on not to post about any problem I find in Maple any more. I really do not want to upset any one. This was the last post from me here.

 

I am also looking for the code for this book. Advanced Mathematical Methods with Maple, D. Richards

The link http://mcs.open.ac.uk/dr9  no longer works.

I gogoled and not able to find copy.

Any one has copy they can share? or place to download them from? The book itself I have a PDF copy of, but the book do not contain Maple code.

I would never export complete maple worksheet to Latex as the quality is not good at all. This is well known for years.

The best solution is to write the latex directly to a file, but one expression at a time (by converting the math expressions to latex using the latex() command, which for the most part works ok but could be better) and write, to the same file, any needed in-between Latex on the fly as the code runs.

At the end of the run, you have a latex file ready to compile.

This way you get best results. It is a little bit more work, but not too much, and with few helper functions it is not too much extra effort. But this assumes one knows some Latex themselves. This gives best results.

This is how I do everything when I want to export some work done using CAS to Latex. Been doing it for years and years using this method.

The hard stuff, which is converting math to Latex is done by CAS itself using its latex() command. The rest is just Latex formating which one can do themselfs. This way you control the actual formating in Latex instead of letting Maple do it.

 

I could give you an answer, but it will be deleted like the last question I answered which is very similar to yours. So will not bother wasting my time.

The command is called pdsolve. Someone below just asked for solution to 1D wave PDE in infinite domain. You can use the code posted there and modify it to fit your specific PDE. You can also look up help for pdsolve for more examples.

 

What are the PDE specification?

There are infinite number of combinations depending on what initial conditions, boundary conditions, domain type and so on.

So it will be a little hard to guess what you have in mind.

@Kros 

it works for me. Updated worksheet.

@Kros 

 

I put the worksheet. As you see, no errors.

@Katherina von Bulow 

Thank you!  I just downloaded version 633 of Physics package  and now Maple is able to solve this PDE as expected. Good job.

 

@vv 

I do not think there is ambiguity. The file is comma delimited. Mathematica can read the above using it as having 8 fields.

data = First@Import["data2.txt", "Table", "FieldSeparators" -> {","}, "Numeric" -> True]

           {1, 2, 3, "x+y, algorithm=[", 123, "]", "OK", 5}

 

 

 

First 57 58 59 60 61 62 63 Last Page 59 of 91