tomleslie

13876 Reputation

20 Badges

15 years, 164 days

MaplePrimes Activity


These are answers submitted by tomleslie

F:=piecewise(t>=0 and t<1, t^2, t>=1 and t<3, 3-t);

maximize(F, location);

works for me.

When I tidy up a lot of your code, I cannot get around the error message

Error, (in dsolve/numeric) cannot numerically solve a parametric boundary value problem

However I can solve this problem for any' supplied' value of 'omega2'. See the attached, where the vlaue of omega2 is hardwired to 1.0e-04. (It would be trivial to change the attached so that one could supply a range of values for omega2).

I'm reluctant to do much more than is in the attached at the moment because I had to do a reasonable amount of hacking just to get any kind of answers at all, and I may be on completely the wrong track.

However if I'm getting close to what you want/need then I'm sure I could probably modify it pretty easily

odeprob.mw

A "toy" example

ans:=solve(x^4-x^3+1,x);
op(1, ans[1])

Since you do not provide the functions f1 or f2, ther is a limitted amouont I can illustrate.

However your basic problem is that on each iteration of the loop, the previous values 'c' and ''roll' are overwritten by the current values. So when the loop exits, both 'roll' and 'c' will contain one value (the last one)

Simplest way round this is to assign the pair [roll,c] to an indexed array value, as in

with(plots):
with(Optimization):
ind:=1:
ans:=Array():
for i from 1.73205080756887853 by 0.5e-2 while i < 2.87500000000000000 do
     roll := i;
     f1max := NLPSolve(f1, {f2 = i}, x1 = 0 .. 2, x2 = 0 .. 3, method = sqp, maximize = false);
     #c := op([1], f1max),
     #print(c, roll)
     ans(ind):=[roll, op([1], f1max)];
     ind:=ind+1:
end do:
ans;

On completion ans will be an array of points which can be used as input to pointplot(). pointplot() takes a set or list as its first argument. The above loop produces an array, so youu will need something like

pointplot( convert(ans), list) )

Whenever I see a problem like this I eliminate all the "clever" stuff, just to see what happens when I use the basics.

When I eliminate all of the "clever" stuff pdsolve() provides a perfectly satisfactory solution, involving four arbitrary constants - which is exactly what I would expect from the structure of the original PDE

Now you have to decide what is wrong with my "basic" solution - and what purpose all the "clever" stuff in your originak worksheet serves. Basic solution is given in the attached

pdeSol.mw

Many Maple commands can be applied "elementwise" by incorporating a ~ symbol, as in

ln~([2,3,4])

See the help page at ?Elementwise Operators

(Corrected by Douglas Meade, based on typo noted by Joe Riel. 29 July 2016)

When you ask for a "step-by-step method of solving equations" a lot depends on the type of equations you want to solve - simple linear equations, ordinary differential equations, partial differenatial equations, what? Assumng the first of these then try playing with

with(Student[LinearAlgebra]):
M := <<1,2,0>|<2,3,2>|<0,2,1>|<3,5,5>>;
LinearSolveTutor( M );
LinearSolveTutor( M, v );

When it comes to solving quadratic equations, then

solve(a*x^2+b*x+c,x);

works pretty well, and gives the solutions in standard form. For guidance on how to solve quadratic equations, then you may find

with(Student[Precalculus]):
CompleteSquare(a*x^2+b*x+c,x);

somewhat informative.

In general, if you type "step by step" in the Maple Help search box, the it will give you a pretty fair idea for which problems "step by step" solutions exist

I think I have figured out what you want

posRoots.mw

Your solve() command returns three expressions containing 'so'.

These three expressions only return real values for limited ranges of 'so'

None of these three expressions evaluates to zero (ie a root) for any value of 'so' which I have tried - and certainly do not do so for values of 'so' in the range 0..5.

Try the following

restart:
assume(so,real):
m1:=5:     m2:=2:    m3:=1.5: a1:=0.16:  a2:=0.45:
a3:=0.833: d1:=0.25: d2:=0.1: d3:=0.075:
ys:=a3*d3/(m3-d3):
d:=0.5:
w3:=d*(m1-d1):
w2:=d*d1*so-d*m1*so-2*a1*d*d1+a1*d*m1-a2*m1^2+a2*d1*m1+m1*m2*ys:
w1:=2*a1*d*d1*so-a1*d*m1*so-a1^2*d*d1+a1*a2*d1*m1+a1*m1*m2*ys:
wo:=a1^2*d*d1*so:
#Q:=s->w3*s^3+w2*s^2+w1*s+wo:
#Q(s):
#sol:=evalf(solve(Q(s),s)):
#sol:=solve(Q(s),s):
sol:=solve(w3*s^3+w2*s^2+w1*s+wo,s):
plot([sol], so=4..5, color=[red,green, blue]);
plot([sol], so=-10..10, color=[red,green, blue]);

The first plot command in the above will generate a warning message because the two of the three solutions returned by solve()  will only produce complex values in this range

The second plot command will generate curves for each of the three solutions returned by solve() where such solutions are real rather than complex

Not quite sure what you are geting at here, but my first suggestion would be to use the fieldplot() command, as in

plots:-fieldplot3d
         ( [ sin(x),
              sin(y),
              sqrt(sin(x)^2+sin(y)^2)
           ],
           x=-1..1,
           y=-1..1,
           z=-1..1
        );

or with z=0

plots:-fieldplot3d
         ( [ sin(x),
              sin(y),
              0
           ],
           x=-1..1,
           y=-1..1,
           z=-1..1
        );

Why do you think +0.4444364945e-1 is a solution. Examine the output from

eval(exp(-xi*Pi/(sqrt(1-xi^2))), xi=0.4444364945e-1);
eval(exp(-xi*Pi/(sqrt(1-xi^2))), xi=-0.4444364945e-1)

So far as I can tell tecPlot does not import 3D diagrams. It imports the data from which such diagrams can be constructed. This is an important distinction!

I have been unable to determine a "simple" data format which can be imported into tecPlot, but feel reasonabl sure that some sort of ASCII/csv must be supported - eg a text file containing lines such as

z1, x2, x3,.....,xn, f(z1, x2, x3,.....,xn)

or something very similar. If I could discover what simple text based formats are supported by tecPlot, then I could persuade Maple to generate them quite easily.

In your original post you state

I want to import a maple 3D Diagram to TecPlot or Excel.

Well this is easy - because Excel can import images (eq jpg, gif whatever) and Maple's exportplot() command can produce images in these formats. Alternatively if you wish to transfer the data to construct such a plot from Maple to Excel, then you could use something similar to the following "toy" example

restart;
xVals:=Vector[column]( [seq(evalf(j), j=-10..10) ] );
yVals:=Vector[row]( [seq(j, j=-1.0..1.0, 0.2)]);
func:=(x,y)->exp(x)*sin(y):
M:=Matrix( numelems(xVals),
                    numelems(yVals),
                    (i,j)-> func(xVals[i], yVals[j])
                 );
fname:="D:/Users/TomLeslie/myExcel/testData.xlsx":
ExcelTools:-Export(M, fname, "sheet1", "C3"):
ExcelTools:-Export(xVals, fname, "sheet1", "B3"):
ExcelTools:-Export(yVals, fname, "sheet1", "C2"):

Obviously you will have to change the string in fname() to something appropriate for your machine

Bear in mind my knowledge of Graph Theory is a little sketchy.

It is rather obvious that you are passing complex numbers to the min() function - which is therefore guaranteed to fail.

My understanding is that the laplacianMatrix of a graph may have complex eigenvalues, but that the symmetric normalized Laplacian matrix of the same graph is guaranteed to provide eigenvalues which are real and positive. The symmetric normalized Laplacian matrix, is obtained from the laplacian matrix L, by constructing

D^(-1/2)*L*D^(-1/2)

where D is the degree matrix.

See the wikipedia article at https://en.wikipedia.org/wiki/Laplacian_matrix

Not sure why you wnat to generate matrices, then write them out, then read them back in again - seems a bit pointless. However if you do reallly wish to do this then the following code should work (you will have to change the filename string to somehig appropriate for your machine

#
# Initialise
#
    restart;
    with(LinearAlgebra):
#
# Specify number of matrices to be generated
#
    numMat:=10:
#
# Generate required number of matrices and place
# them in a list
#
    OpMatList:=[ seq
                           ( RandomMatrix
                              ( 3,
                                3,
                                generator = -10 .. 10
                              ),
                              j=1..numMat
                           )
                        ];
#
# Write the list of matrices to the specified output
# file. NB OP will have to change the filename to
# something appropriate for his/her machine
#
    ExportMatrix( "D:/Users/TomLeslie/myMaple/matrices",
                            OpMatList,
                            target=Matlab
                         ):
#
# Re-initialise to clear memory etc
#
   restart:
#
# Read matrices from file and place them in a list
# for subsequent simple access
#
    ipMatList:=[ seq
                         ( j[2],
                            j in ImportMatrix
                                   ( "D:/Users/TomLeslie/myMaple/matrices",
                                      source=Matlab
                                   )
                         )
                       ];


Well, using the

ExcelTools[Import](fileName, sheetName, cellRange)

ought to import the relevant data from either an xls or xlsx file. An xlsm file is just an an xlsx file with "enabled macros". I have never tried to import from an "xlsm" file.  Becuase it implies enabled macros, I can imagine that their might(?) be security issues.

Try either

  1. Generate all the data in your Excel file and then save as .xlsx. Then read from Maple using the command given above with appropriate entries for all fields.
  2. Upload your xlsm file, and someone here might try it for you - you should also provide the sheetName(s) and cellRange(s) you want to read
First 184 185 186 187 188 189 190 Last Page 186 of 207