MaplePrimes Questions

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.

 

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

In a video (watch from 7 min onwards) I have seen the definition of solution types in custom components. Is this possible in newer versions of MapleSim using the custom component app? If yes, how?

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): ?

I have a set of points. I only want to plot ones with x and y less that 5 units from [0,0]. I can do it with for do loop. Can't get it to work with seq. Ideally I don't want to create another list.

restart

NULL

points := [[-.4821957161, -.3251957485], [-1.079859775, -1.473869954], [.7429089919, .1649759550], [1.329939269, 0.7259335832e-1], [-.1254930617, .1268183497], [-10.63408888, -2.637665397], [-0.1855663689e-1, .1572001339], [8.963609684, 7.419424024], [.7724026996, .1662719092], [1.278337644, 0.7583092624e-1]]

``

" points2:= [seq('if'(" abs"(points[i,1])<5 and abs(points[i,2])<5, points[i] ,0)  ,i=1..10)] "

[[-.4821957161, -.3251957485], [-1.079859775, -1.473869954], [.7429089919, .1649759550], [1.329939269, 0.7259335832e-1], [-.1254930617, .1268183497], [-10.63408888, -2.637665397], [-0.1855663689e-1, .1572001339], `if`(false, [8.963609684, 7.419424024]), [.7724026996, .1662719092], [1.278337644, 0.7583092624e-1]]

(1)

``

redp := plots:-pointplot(points, colour = red, symbolsize = 4, symbol = solidcircle)

 

plots:-pointplot(points2, colour = red, symbolsize = 4, symbol = solidcircle)

Error, invalid input: `if` expects 3 arguments, but received 2

 

NULL

NULL

Download 13-3-22_remove_points_plotting.mw

First 328 329 330 331 332 333 334 Last Page 330 of 2426