MaplePrimes Questions

I obtain the adjacency matrix from a graph. We know that it is indexed according to the order of vertices in the Vertices. But what if I want to rearrange it in a different order? Here is a specific example.

with(GraphTheory):
g:=Graph({{2,3},{1,2}});
Vertices(g); #[1,2,3]
AdjacencyMatrix(g);

I would like to display this matrix in the order of [3, 1, 2].

Hi

I get the following error: "Error, (in dsolve) invalid input: 'PDEtols/sdsolve' expects its 1st argument, SYS, to be of type OR(set(..."

I don't know what's wrong. My equations look like a set to me.

My equations:

{0 = -F__Ay - F__By, 0 = 25*F__Oy + 25*F__Ay - 25*F__By, diff(theta__1(t), t)*t - theta__1(t) = 0, -x__1(t) + 25*cos(theta__1(t)) = 0, -y__1(t) + 25*sin(theta__1(t)) = 0, (2500*cos(theta__1(t))*diff(theta__1(t), t)*pi)/3 - 50*cos(theta__1(t))*diff(theta__2(t), t)*theta__2(t) = F__Ax + F__Ox + F__Bx, (2500*cos(theta__1(t))*diff(theta__1(t), t)*pi)/3 - 50*cos(theta__1(t))*diff(theta__2(t), t)*theta__2(t) = F__Ay + F__Oy + F__By, diff(theta__2(t), t)*t - Pi/4 - theta__2(t) = 0, x__1(t) + 25*cos(theta__1(t)) - x__2(t) - 50*cos(theta__2(t)) = 0, y__1(t) + 25*sin(theta__1(t)) - y__2(t) - 50*sin(theta__2(t)) = 0, (1250*cos(theta__1(t))*diff(theta__1(t), t)*pi)/3 = -F__Ax - F__Bx, (1250*cos(theta__1(t))*diff(theta__1(t), t)*pi)/3 = -50*F__Ay + 50*F__By}

My solve:

dsolve({eqs[1] = 0, eqs[2] = 0, eqs[3] = 0, eqs[4] = 0, eqs[5] = 0, eqs[6] = 0, eqs_Mq[1] = eqs_g[3], eqs_Mq[1] = eqs_g[6], eqs_Mq[2] = eqs_g[1], eqs_Mq[2] = eqs_g[2], eqs_Mq[3] = eqs_g[4], eqs_Mq[3] = eqs_g[5]}, numeric)

Anyone can tell me what I'm doing wrong?

clutch.mw

I have say a

1) n cross n matrix A

2)  n cross 1 matrix B

I want to elementwise divide that is /~ each column of  by B and store in A itself like this 

If b_1 is in B and a_11 is in A i want   b_1/~a_11 in a_11

That is i divide

B /~ A first column

B /~ A second column

Like that for all its n columns

Kind help please

To illustrate, here is an HTML example that overlays a circle and a letter

<span style="position: relative; font-size: 2em;">&#x25CB;<span style="position: absolute; top: 1.0em; right: 0.4em; font-size: 0.4em;">Y</span></span>

than can be pasted here to visualize.

I am not sure if that is possible with Maples typesetting tags.

Hello everyone!

I have an expression for the resonant frequency in terms of some geometric paremeter, say "x", i.e. f(x). I want to plot it together with the resonant wavelength (lambda=c/f) in the same plot. The "dualaxisplot" produces two curves (f(x), lambda(x)) with two uniform axes to the left and to the right. I am wondering is there a reasonably simple way to make it look as one curve, but with the second (e.g. lambda) axes nonuniformely scaled to fit the curve f(x)?

Many thanks in advance for your suggestions!

How do I combine a number of functions into a composite one?

For example
x := T -> (A - 1/T)/C;

y := x -> sqrt(1/27*B^3/C^3 + 1/4*x^2);

Combined into a final composite function
R := T -> exp((y - 1/2*x)^(1/3) - (y + 1/2*x)^(1/3)); such that the function R evaluates x and y as functions themselves.

Many times this sort of function definition makes it easier for the human.

restart;

Frac_C := proc (expr, a, t, alpha) local ig, m, tau;

m := ceil(alpha);

ig := (t-tau)^(m-alpha-1)*(diff(eval(expr, t = tau), tau$m));

`assuming`([(int(ig, tau = a .. t))/GAMMA(m-alpha)], [a < t]);

end proc;
r := .5;

k := .7;

eq1 := Frac_C(x, 0, t, r)-y(t) = 0;

eq2 := Frac_C(y, 0, t, k)-x(t)-2*t = 0;

eq3 := x(0)-y(1) = 0;

eq4 := Frac_C(x, 0, t, r)-(eval(diff(y(x), x), x = 1)) = 0;

eq5 := Frac_C(x, 0, t, r)-(eval(diff(y(x), x, x), x = 1)) = 0;

eq6 := eval(diff(y(x), x), x = 0)-x(1)-2 = 0;

eq7 := y(0) = 0;

N := 5;

x[c] := [seq(a[i], i = 0 .. N)];

y[c] := [seq(b[i], i = 0 .. N)];

for n to N do

subs([seq(x(i) = x[c][i], i = 0 .. n), seq(y(i) = y[c][i], i = 0 .. n)], {eq1, eq2, eq3, eq4, eq5, eq6, eq7});
soln := solve({eq3, eq4, eq5, eq6, eq7, seq(coeff(lhs(eq), t, j) = 0, eq in {eq1, eq2})}, {a[n+1], b[n+1]});

x[c][n+1] := eval(a[n+1], soln);

y[c][n+1] := eval(b[n+1], soln);

end do;

x[s] := add(x[c][i]*t^(i-1), i = 1 .. N+1);

y[s] := add(y[c][i]*t^(i-1), i = 1 .. N+1);

x[s];

y[s];

Hi, i want to calculate fourier transform of functions with fractional powers. how can i do this? for example what is fourier transform of sqrt(x) ? I want a function or an expression as output, not the inetgral itself. thnx in advance

restart:with(inttrans):

f := x -> x^(1/2);
int(f(x)*exp(-I*w*x), x = -infinity .. infinity);

proc (x) options operator, arrow; x^(1/2) end proc

 

int(x^(1/2)*exp(-I*w*x), x = -infinity .. infinity)

(1)

fourier(f(x),x,w)

fourier(x^(1/2), x, w)

(2)

 

 

Download fracfourier.mw

How can I export data from the plot? Following is my Maple code.

 

restart;
with(PDEtools);
v_0 := 1;
vstar := 10;
r_0 := 1;
k := 0.1;
m := 0.1;
PDE := diff(v(r, t), t) = k*(diff(v(r, t), r, r) + diff(v(r, t), r)/r);
                                                / d         \
                           /  2         \   0.1 |--- v(r, t)|
          d                | d          |       \ dr        /
  PDE := --- v(r, t) = 0.1 |---- v(r, t)| + -----------------
          dt               |   2        |           r        
                           \ dr         /                    

ans := pdsolve(PDE, HINT = f(r)*g(t));
                             /                            
                             |                            
                             |                            
ans := Typesetting:-mcomplete|vApplyFunction(rt)equalsf__1
                             |                            
                             |                            
                             \                            

                                              //               
                                              ||               
                                              ||DifferentialD  
  ApplyFunction(r) f__2ApplyFunction(t) where ||-------------- 
                                              ||DifferentialDt 
                                              \\               

  f__2ApplyFunction(t)equals0.1 f__2ApplyFunction(t) _c[1]

               2                                                 
  DifferentialD                                                  
  --------------- f__1ApplyFunction(r)equals1. f__1ApplyFunction(
                2                                                
  DifferentialDr                                                 

                /DifferentialD                      \//  
             1. |-------------- f__1ApplyFunction(r)|||  
                \DifferentialDr                     /||  
  r) _c[1] - ----------------------------------------||, 
                                r                    ||  
                                                     \\  

                    /[           /                           [ /
                    |[           |                           [ |
                    |[           |                           [ |
  Typesetting:-_Hold|[PDESolStruc|v(r, t) = f__1(r) f__2(t), [< 
                    |[           |                           [ |
                    |[           |                           [ |
                    \[           \                           [ \

   d                               
  --- f__2(t) = 0.1 f__2(t) _c[1], 
   dt                              

                                       / d         \\ ]\]\\
    2                               1. |--- f__1(r)|| ]|]||
   d                                   \ dr        /| ]|]||
  ---- f__1(r) = 1. f__1(r) _c[1] - ---------------- >]|]||
     2                                     r        | ]|]||
   dr                                               | ]|]||
                                                    / ]/]//


build(ans);
                  /1         \             /           (1/2)  \
v(r, t) = c__3 exp|-- _c[1] t| c__1 BesselJ\0, (-_c[1])      r/
                  \10        /                                 

             /1         \             /           (1/2)  \
   + c__3 exp|-- _c[1] t| c__2 BesselY\0, (-_c[1])      r/
             \10        /                                 


design;
BC1 := eval(v(r, t) - v_0 = 0, r = 20);
                    BC1 := v(20, t) - 1 = 0

BC2 := D[1](v)(0, t) = 0;
                    BC2 := D[1](v)(0, t) = 0

NULL;
IC := v(r, 0) = v_0 + (vstar - v_0)*exp(-0.5*(r - r_0)^2/m^2)/(m*sqrt(2*Pi));
                                    (1/2)    /            2\
   IC := v(r, 0) = 1 + 25.38853126 2      exp\-50. (r - 1) /

conds := {BC1, BC2, IC};
              /                  
    conds := { v(20, t) - 1 = 0, 
              \                  

                                 (1/2)    /            2\  
      v(r, 0) = 1 + 25.38853126 2      exp\-50. (r - 1) /, 

                       \ 
      D[1](v)(0, t) = 0 }
                       / 


answer:=pdsolve(PDE,conds,HINT=);
Error, invalid =
Typesetting:-mambiguous(answerAssignpdsolveApplyFunction(PDEcomma

  condscommaTypesetting:-mambiguous(HINTequalslowast, 

  Typesetting:-merror("invalid =")))semi)


u := r -> v_0 + (vstar - v_0)*exp((-1)*0.5*(r - r_0)^2/m^2)/(m*sqrt(2*Pi));
u := proc (r) options operator, arrow, function_assign; 

   v_0+(vstar-v_0)*exp(-.5*(r-r_0)^2/m^2)/(m*sqrt(2*Pi)) end proc


plot(u(r), r = 0 .. 10);

conds := {BC1, BC2, IC};
              /                  
    conds := { v(20, t) - 1 = 0, 
              \                  

                                 (1/2)    /            2\  
      v(r, 0) = 1 + 25.38853126 2      exp\-50. (r - 1) /, 

                       \ 
      D[1](v)(0, t) = 0 }
                       / 


BCs := {BC1, BC2};
          BCs := {v(20, t) - 1 = 0, D[1](v)(0, t) = 0}

pde_solve = pdsolve(PDE, BCs, IC);
solution := pdsolve(PDE, conds, numeric);
                  solution := _m1440390954528

t1 = 0 .. 10;
r1 = 0 .. 10;
solution, t1, r1;
                        solution, t1, r1

sol := pdsolve(PDE, conds, numeric, time = t, range = 0 .. 20, spacestep = 0.1, timestep = 0.1);
                     sol := _m1440421519392

sol:-animate(t = 0 .. 20, frames = 100);

M := sol:-value();

sol:-plot3d(r = 0 .. 10, t = 0 .. 20);

I have give this below fit command my data is only continous data either positive or negative float data. Their never any complex number at all.

I use the below fit command

Error, complex argument to max/min

It can be observed it is running into error in C1 I dont know why can someone suggest where should I check and why is this happening kind help.   In Excel we can see the intercept coming big.

 

I attach the toycode to see the error I get too

toycode.mw

I want to know the exponent of one particular factor of an integer. For example:

k:=24;

ifactor(k) = (2)^3(3)

and I want to write a module to extract the exponent of (3) for any arbitrary k.

I can't select for the presence of 3 because it will pick up the factor (2)^3 and then it gets complicated to decide that I don't want this factor anyway.

If I somehow manage to select the factor (3) using "op" and scanning through each factor in turn, then substitute 3=x, it turns out that degree(%,x) doesn't work because the factor x is enclosed in brackets; similarly trying

log(%,3) fails for the same reason.

There has to be a simple way, but I just don't see it.

Any suggestions are appreciated.

In GraphTheory ,how do you make more than one edge between two points.

Could you help me to solve this problem for the parameter beta?

restart;

e1:= 0.5; e2:=0.2;theta:=5;yeq:=e2;

.5

 

.2

 

5

 

.2

(1)

f:=(theta*x-1)*(1-x)*(1+beta*x^2)-y;
g:=x/(1+beta*x^2); gs:=unapply(g,x);

(5*x-1)*(1-x)*(beta*x^2+1)-y

 

x/(beta*x^2+1)

 

proc (x) options operator, arrow; x/(beta*x^2+1) end proc

(2)

fs:=subs(y=yeq,f);

(5*x-1)*(1-x)*(beta*x^2+1)-.2

(3)

assumptions:=x>1/theta, x<1,beta>0,beta<1,gs(x)>e1;
solve(fs=0,x,useassumptions) assuming assumptions;

1/5 < x, x < 1, 0 < beta, beta < 1, .5 < x/(beta*x^2+1)

 

Warning, solve may not respect assumed property 'real' on 'x/(beta*x^2+1)'.

 

Error, (in type/realcons) too many levels of recursion

 

gs2:=subs(beta=0.6,gs(x));

x/(.6*x^2+1)

(4)

sol:= solve(subs(beta=0.6,fs=0),x,useassumptions) assuming x>1/theta, x<1;

.2514854589, .9665623271

(5)

subs(x=sol[1],gs2);

.2422912423

(6)

 

Download Rootsfind.mw

I put this command and It keep saying  plot(f(x), x = -0.667 .. 1.71, y = -5 .. 20, gridlines); Error, (in plot) unexpected options: [1.71 = -.667 .. 1.71, y = -5 .. 20] . How can I fix this

First 211 212 213 214 215 216 217 Last Page 213 of 2427