Maple Questions and Posts Maple Questions and Posts Feed

These are Posts and Questions associated with the product, Maple

So if I have a procedure like 

with(GraphTheory)

tneighbors := proc (G::Graph)

local numvertices::integer, i::integer, currentvertex;

numvertices := nops(Vertices(G));

for i to numvertices do

currentvertex := Vertices(G)[i];

if nops(Neighbors(G, currentvertex)) = 2 then print(currentvertex)

end if;

end do;

end proc;

How do I make it so the output gets returned as a set?

For example, if I do  twoneighbors(G); and get
1

7

4

How do I make it so the output is listed as a set like {1,4,7}? Thanks.

Hi Maple friends.

How can I find the domain of y=sqrt(3*x-5)? or of y=1/(x+2)^2?

Thanks in advance.

I need to write a procedure that returns the cut vertices of a graph, but I think I'm having trouble defining my local variables. This is what I have so far.  I think my error might be in defining H since that's the line the error message I get keeps referencing.  Am I defining H incorrectly or in the wrong spot? Any advice would be appreciated. Thanks


cutvertices := proc (G)

local numvertices::integer, currentvertex, i::integer, H;

description "Returns a set of all the cut-vertices of the given graph";

numvertices := nops(Vertices(G));

for i to numvertices do

currentvertex := Vertices(G)[i]

H:=DeleteVertex(G, currentvertex)

 

if nops(ConnectedComponents(G)) = nops(ConnectedComponents(H)) then print(currentvertex)

end if;

end do;

end proc:

When I open my file I got an error message says "there were problems during loading process"

and some of my text are missing.

Maple Worksheet - Error

Download quant_hw_5.mwquant_hw_5.mw

Download quant_hw_5.mw

Can anyone help me,please

i want to solve an equation by fsolve but i cant assign a value as an input for next step!

please help me

s := fsolve(G), x = -1 .. 1     

s := .1449607418, x = -1 .. 1  

 a:=s+1  

Error, invalid input: subs received .1449607418, which is not valid for its 1st argument                  

Hello everybody. I'm newbie and my english are not very good. Please help me debug an error in my files DSOLVE_NOT_SUCCESSFULL.zip: "Error, (in ans) cannot determine if this expression is true or false"
Thanks.

See AAAA.mw

The alpha and beta are 'randomly' chosen, both >0, to produce some values, hence a value for the target function to optimize.

I am having trouble to evaluate the expression in the middle of the calculation.

Sometimes, the 'chosen' alpha and beta works fine with 'method = _d01amc' for numerical integration. and such way is really "fast".

 

But sometimes, the the 'chosen' alpha and beta will fail. Even when both of them are perfectly defined. and the integral can be easily evaluated using Int() and then evalf().

 

So what's be best way to proceed?

Thanks,

casperyc

Kronecker Delta in a Sum....

Yesterday at 10:16 AM H-R 40

Consider the following sum:


We know that if k is between 1 and N, the result will be



and otherwise the sum is zero.

How can I tell maple to compute this sum in each case without giving numerical values to the parameters "N" and "k"?

Thanks. :)

If I were to evaluate a single numerical integral, I can use evalf( Int(,method = _d01amc)).

But when the expression say is created by a built in function, Student[VectorCalculus][Hessian], from a complicated expression involve integrals. The resulting expression does not have the option "method = _d01amc". It then takes a long time to evaluate.

See this "HE" variable for example. HE.txt

value(HE); # takes a long time

evalf(HE); # takes a long time

 

Is there a way to evaluate "HE", using ",method = _d01amc" wherever necessary?

 

Thanks!

I'm doing some stuff with Taylor Polynomials on Maple. In particular, I'm trying to find the second order Taylor Polynomial of e^x cos x. I'm using the "taylor" command.

 

This is what I have so far:

 

> f := proc (x) options operator, arrow; exp(x)*cos*x end proc;
x -> exp(x) cos x
> s2 := taylor(f(x), x = (1/3)*Pi, 2);
> p2 := convert(s2, polynom);
1 /1 \
- exp|- Pi| cos Pi
3 \3 /

/ /1 \ 1 /1 \ \ / 1 \
+ |exp|- Pi| cos + - exp|- Pi| cos Pi| |x - - Pi|
\ \3 / 3 \3 / / \ 3 /
> y1 := evalf(subs(x = .5, f(x)));
0.8243606355 cos
> y2 := evalf(subs(x = .5, p2));
-0.208092943 cos

 

Everything looks fine until the last two lines.

 

How do I interpret ".8243606355*cos" ? Cosine should have an argument. Am I messing up something with my code, or is this standard in Maple language?

Hi all,

Assume that we have a vector, namely v:=[1,-2,3,-4] and we want to construct special matrix namely Z, from Vector v as follow:

first row is 1, secnond row is -2,..., the end row is -4 namely
Matrix([[1,1,1,1],[-2,-2,-2,-2],[3,3,3,3],[-4,-4,-4,-4]]);

in the other word every row of matrix is 4 times corresponding componet in vector.(for example v is (1*4))

how can we do this?

best wishes

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

n=512, what is number = nops(T) without actual running code?

 

n := 512;
T := [];
for i from 1 to n do
for j from 1 to n do
if i < j then
for k from 1 to n do
if j < k then
T := [op(T), [i,j,k]];
end:
od:
end if:
od:
od:
nops(T);
T;

Good day everyone, please help in writing finite difference algorithm for these coupled nonlinear ODE. See it here Algorithm.mw 

As title.

 

While  I can  decide velocity,charge and Distance.

 

 

 

Hi

I have three system of ODE and i would like to solve it using Homotopy perturbation method. Could you please provide to me the code in Maple or the Maple pachage that used to solve it by Homotopy perturbation method ?

I hope to hear you soon

Sara

 

1 2 3 4 5 6 7 Last Page 1 of 952