Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi

I wanted to know how to search a list of permutations given criteria: print the permutation(s) If the 4th element of each perm was equal to [C,Z} and the seventh was equal to [B,Y]

perm.mw

Hello, 

I have an equation in the form:

x(t)=2*a+b*t+2*t;

where a and b are the unknowns that I have to find. 

my initial conditions are x(0)=1 and x(1)=1. How can I solve this equation in maple?

Thank you very much for your help!

So all I'm trying to do is a simple sequence like seq(i^2, i=1..10, 1) but with units.  The seq function is part of the Units:-Standard and Units:-Simple packages.  I couldn't find any examples with units in the help system.  For my first attempt, I tried to create a simple sequence of values with units using what is, to me, a logical syntax.  I have included the Maple input below.  I bolded the input.

with(Units:-Standard);
[*, +, -, /, <, <=, <>, =, Im, Re, ^, abs, add, arccos, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsin, 

  arcsinh, arctan, arctanh, argument, ceil, collect, combine, conjugate, cos, cosh, cot, coth, csc, csch, csgn, diff, eval, 

  evalc, evalr, exp, expand, factor, floor, frac, int, ln, log,  log10, log2, max, min, mul, normal, polar, root, round, sec, 

  sech, seq, shake, signum, simplify, sin, sinh, sqrt, surd, tan,   tanh, trunc, type, verify]

seq(ii, ii = 1.0*Unit('m') .. 10.0*Unit('m'), 1.0*Unit('m'));

Error, (in Units:-Standard:-seq) wrong number (or type) of parameters in function seq

Can anyone show me the correct syntax for this?  Is there something in the help?  I tried it in 2021 and 2022 with the same result.
 

Is it possible to read and/or convert Mapleflow sheets to Maple?

This is the first time I see such an error installing Maple on windows.

Right after the MS VS run-time installation completed (which is started by Maple installer) I got an error message saying it could not install fonts and to install them "manually".

Are there detailed instructions how is one supposed to do this? And what does this actually affect? As Maple starts ok and so far I see no issue with fonts but I have not done much with it yet other than open a worksheet and type few commands.

Looking at the folder in question, I see no instructions. Only font files. It will be good if Maplesoft could provide instructions for users on how to do that.  I do not want to do something that could end breaking the Maple installation or make things worst.

 

Background pattern

 

Today is one of my favorite days of the year. After months and months of hard work by a lot of people, it’s finally arrived:

 

It's Maple launch day!

 

Yes, I am very pleased to announce that Maple 2022 is here.

 

As we’ve done in years past, Samir and I started this release by spending many hours reviewing feedback from Maple Primes posts, support emails, sessions with staff who regularly talk with customers and who use Maple themselves, and our own direct conversations with customers. Of course a year is never enough to implement every good idea, but our goal was to identity a feature set that would appeal to, delight, and hopefully excite our customers.

 

Ultimately, you will be the judge, but I can tell that there are some things in Maple 2022 that I am personally very excited about. These are “quality of life” improvements that have been requested by customs and make some things in Maple that were frankly kind of annoying a lot better. The rest of this post will discuss my favorite improvements in more detail (or you can watch this video), and of course, you can get much more information about these and all the other improvements in What’s New in Maple 2022.

 

#1 – Did you ever find yourself jumping back and forth between your Maple document and Print Preview, again and again, as you prepare your worksheet for printing or export to PDF? It can be a pain, especially with long documents that include plots, tables, and sections. So I'm happy to announce that Maple 2022 includes a new Print Layout mode. This new layout mode lets you see the page boundaries as you edit the document, so you can adjust your content as you go. In Maple 2022, what you see on the page is what you get when you print or export to PDF. Hurray!

 

 

 

 

#2 – Are you tired of explaining to your students why the graph of tan(x) doesn’t look right in Maple?  Good news!  With Maple 2022, you won’t have to have that conversation ever again. Maple 2022's new adaptive plotting algorithm means that when you plot tan(x), 1/(1-x), floor and ceiling functions, and most other curves with discontinuities, you’ll get what you expect by default – no more vertical lines, no need to specify the discont option, and it’s still fast.

Diagram

Description automatically generated

 

#3 – Did you ever run into a situation where zooming, panning, or resizing your plot didn’t actually give you the better view of the plot you were looking for? Now Maple recomputes and redraws when needed to give you what you wanted – a good look at your plot.

   

 

#4 – Are you a fan of the Plot Builder? If you are, I'm delighted to let you know that the Plot Builder in Maple 2022 now supports plotting multiple expressions together on the same axes. So don't hold back - use the Plot Builder to customize plots and animations of any number of 2-D and 3-D expressions plots and animations. (We also got rid of that annoying empty plot when you first open it, too.)

 

 

#5 - And, by popular demand, Maple 2022 now magnifies the text in the table of contents/search results when you magnify a help page. No more squinting to find the topic of interest. My eyes are much happier.

 

Those are my favorites, but there is a lot more in the release. To learn more about all the improvements in Maple 2022, visit What’s New in Maple 2022

Does anyone know how to make a command for Leibniz formula for pi?

I would preferably like to use: 1-1/3+1/5-1/7+1/9..=pi/4

I don't want to sit and write everything out, but would like to make it a command, and decide myself how many calculations I would like. I have no clue how though. Anyone have an idea for that?

restart;
with(LinearAlgebra):
a := .1093;
b[3] := -0.1104e-2;
k[1] := 3.8*10^(-12);
d := 0.2e-3;
xi := -1;
theta0 := 0.1e-3;
eta[1] := 0.240e-1;
alpha := 1-b[3]^2/(a*eta[1]);
c := b[3]*xi*alpha/(eta[1]*(4*k[1]*q^2/d^2-b[3]*xi/eta[1]));

f:= q-(1-alpha)*tan(q)- c*tan(q) ;
plot(f,q=0..4*Pi,view=[DEFAULT,-1..10]):

   
n:=3: 
q[1]:=fsolve(f,q=(0..Pi/2)): 
for i from 2 to n do
q[i]:=fsolve(f,q=(2*i-3)*Pi/2..(2*i-1)*Pi/2): ##q[n]
od:

printlevel := 2;
for i from 2 to n+1 do for j from i+1 to n do b[i, j] := int((cos(q[i]-2*q[i]*z/d)-cos(q[i]))*(cos(q[j]-2*q[j]*z/d)-cos(q[j])), z = 0 .. d); b[j, i] := b[i, j] end do end do;

for i from 2 to n do a[i, i] := int((cos(q[i]-2*q[i]*z/d)-cos(q[i]))*(cos(q[i]-2*q[i]*z/d)-cos(q[i])), z = 0 .. d) end do;

for i from 2 to n do f[i] := theta0*(int(cos(q[i]-2*q[i]*z/d)-cos(q[i]), z = 0 .. d)) end do;

 

## I have generated a matrix using the a[i,i] above
A := Matrix([seq([seq(a[i, j], i = 2 .. n)], j = 2 .. n)]);

b := Vector([seq(f[i], i = 2 .. n)]);
     

#Please, how do I generate an upper triangular matrix using b[i,j] above?        

I am using Maple 2021.2 on Ubuntu Linux 20.04 LTS. Sometimes the Maple after start does not show Sig in part of top Maple desktop panel. So I need to restart Maple and 2nd or 3rd start is mostly OK. After that is the situation for some time good.

See attached snapshot... Any idea what is wrong?

hallo every body 

please how i do find a real roots for this equation system 

roots.mw

I set infolevel[dsolve]:=2; and first time I use it, it gives very long output. Next time I use it on same ode with same command it gives much shorter output.

Why is that and how to make it give the shorter output from first call?  This is very strange behavior.  One would expect the same output each time. The worksheet attached shows that first time it is used, the output is very long. At the end of the worksheet the call is made again with same infolevel, and now output is much smaller.

(getting error uploading worksheet. Will try again. Unable to do insert content keep getting error from this site. So I am just attaching it as link. May be due to large size of the worksheet)

infolevel_changes.mw

The Dates are not ordered in a timeseries. The Dates are random variables coming from a dataFrame

How can I write a formula for odd numbers?
Such that :
Show each odd number from the sum of two numbers: even + odd, except for one

The IsSubgraphIsomorphic command accepts either two undirected graphs or two directed graphs as input.  It returns true if G1 is isomorphic to some subgraph of G2. The GraphTheory [IsSubgraphIsomorphic] command was introduced in Maple 2021.

If a graph T is isomorphic to some subgraph T' of  a graph GIsSubgraphIsomorphic(T,G)  will  return true. But there is no option to return T'. That makes it hard to check manually.

I've seen  IsSubgraphIsomorphic behaving strangely lately. I want to check whether K8-P6 contains K7-K3 as its subgraph.

T:=DeleteEdge(CompleteGraph(7),{{1,2},{2,3},{3,1}},inplace= false): 
G:=DeleteEdge(CompleteGraph(8),{{1,2},{2,3},{3,4},{4,5},{5,6}},inplace= false): 
IsSubgraphIsomorphic(T,G)

true

I think theoretically, the result of IsSubgraphIsomorphic is not correct. I also tested it from Mathematica, and it worked as I expected.

h = EdgeDelete[ CompleteGraph[7], {1 <-> 2, 2 <-> 3, 3 <-> 1}]; 
g = EdgeDelete[ CompleteGraph[8], {1 <-> 2, 2 <-> 3, 3 <-> 4, 4 <-> 5, 5 <-> 6}]; 
IsomorphicSubgraphQ[h, g]

False

I wonder what went wrong.

 

PS: Subgraph isomorphism is a question I've asked before, and we can refer to the following links and code. https://www.mapleprimes.com/questions/226937-How-To--Test--A--Graph--Whether-Contains

with(GraphTheory):
with(combinat):
T:=DeleteEdge(CompleteGraph(7),{{1,2},{2,3},{3,1}},inplace= false): 
G:=DeleteEdge(CompleteGraph(8),{{1,2},{2,3},{3,4},{4,5},{5,6}},inplace=false): 
nE,nV := NumberOfEdges(T), NumberOfVertices(T):
# Produce all subgraphs of G which have the same number of edges and vertices as the "test" sub-graph T
U:=choose(Edges(G),nE): nops(%):
U1:=select(t -> (nops(`union`(t[]))=nV), U): nops(%):
gL:= Graph~(U1): nops(%):
ans:= [ seq
          ( `if`
            ( IsIsomorphic( T, gL[j] ),
              j,
              NULL
            ),
            j=1..numelems(gL)
          )
        ]:
if   numelems(ans)>0
then HighlightSubgraph( G, gL[ans[1]], edgestylesheet=[thickness=4, color="Red"]);
     DrawGraph(G, style=spring);
fi;

These codes are due to tomleslie  and  vv. According to above codes, it seems that there is something wrong with IsSubgraphIsomorphic too.

I capture the output of dsolve after setting infolevel to some file so I can later read that output and put it in my own document (Latex).

Currently what I do is set infolevel, then use writeto(file_name) to send all the output that would normally go to standard output to the text file, then later do readline to read it back for further processing.

The problem is that Maple does not put the output in the file the same way as it appears on the screen when using worksheet.

For example, all newlines are lost. So everything comes out in one line in the file_name .  I am not sure why that is.

Is there an option or trick to make the output not lose the newlines? It also seems to format things differently in the file. An example will make this clear

When running this code

restart;
currentdir("... set the directory to where you want to save the file to ..");

infolevel[:-dsolve]:=5;
writeto("output_of_dsolve.txt");  #send all output to file
sol:=dsolve(diff(y(x),x)=sin(x),y(x)); 
close("output_of_dsolve.txt"):
writeto(terminal); #to send output back to terminal

When I open the file output_of_dsolve.txt this is what shows

`Methods for first order ODEs:``--- Trying classification methods ---``trying a quadrature``<- quadrature successful`     solAssignyApplyFunction(x)equalsuminus0cosApplyFunction(x) + _C1, [

       Typesetting:-mprintslash([sol := y(x) = -cos(x) + _C1], 

       [y(x) = -cos(x) + _C1])]

 

But in the worksheet, when I run the same code without writeto("output_of_dsolve.txt");  so output goes to terminal as normal, here it is how it looks like

Is there a way to keep the newlines? And why there is some extra stuff in the file that do not show on the screen? Should one change the Settings for Display before doing the above? Currently the default I have is typesetting level is "Extended". Do not know if this affects it or not.

Is the above method the only way to capture the output of dsolve from infolevel to a text file? It looks like Maple uses `` in the file in place where there should be a newline (CR) inserted.

Update

I did this experiment but there is still some strange formatting coming out in the file. Here is an example

 

restart;

interface(typesetting=standard): #added this
interface(prettyprint=0):  #added this
currentdir(".....");

:-infolevel[:-dsolve]:=5;
writeto("output_of_dsolve.txt"); 
sol:=dsolve(diff(y(x),x)=sin(x),y(x)); 
close("output_of_dsolve.txt"):
writeto(terminal);

And now the text file has this

`Methods for first order ODEs:``--- Trying classification methods ---``trying a quadrature``<- quadrature successful`Typesetting:-mprintslash([(sol := y(x) = -cos(x)+_C1)],[y(x) = -cos(x)+_C1])

What is Typesetting:-mprintslash at the end of the line above? it is duplicate.

And how to get rid of it? Is there another settings to set other than interface(typesetting=standard): and interface(prettyprint=0): ?

First 325 326 327 328 329 330 331 Last Page 327 of 2217