MaplePrimes Questions

I am trying to calculate numerically a triple integral of a function (see below). However I could not get a result. I stopped the calculation after one hour of evaluation. One of the integral is from 0 to infinity and uses NAG d01amc. The 2 other integrals have finite bounds and use NAG _d01ajc. I also tried to use maple default integration algorithms for the 2 finite bounds integrals but without success. in the following xs, ys, zs, k, k_0, x, y, rho_0 and d are real numbers. k_m, rho_me, nu_m are complex numbers. The variable sof integration are k (from 0 to +infinity), x (from -1 to +1) and y (from -1.5 to 1.5). Here is the Maple script. restart; Digits := 15; nu_0 := sqrt(k^2 - k_0^2); nu_m := sqrt(k^2 - k_m^2); pref2 := 2*rho_me*exp(-nu_0*(zs + z))*BesselJ(0, k*sqrt((xs - x)^2 + (ys - y)^2))*k/(rho_me*nu_0 + rho_0*nu_m*tanh(nu_m*d)); (evalf@Int)(eval(0.5*Re(`~`[evalf@Int]((Re + Im*I)(eval(pref2, [z = 0, k_0 = 0.018371886863098, xs = 0, ys = 0, zs = 10, rho_0 = 1.2, d = 0.04, rho_me = 1.528516816439260 - 1235.297048886680*I, k_m = 0.490806242885258 - 0.490314205803914*I])), k = 0 .. infinity, epsilon = 0.1*10^(-5), method = _d01amc)), [z = 0, k_0 = 0.018371886863098, xs = 0, ys = 0, zs = 10, rho_0 = 1.2, d = 0.04, rho_me = 1.528516816439260 - 1235.297048886680*I, k_m = 0.490806242885258 - 0.490314205803914*I]), [x = -2/2 .. 2/2, y = -3/2 .. 3/2], epsilon = 0.1*10^(-5), method = _d01ajc); Thanks for the help.

Hi All!  New to MapleSIM and working on a program help my FIRST Robotics team start using MapleSIM.  I am looking for any presentation material already created, directed at high school kids.

Appreciate any links to presentation material I can repurpose for them.  

Cheers,

Andy 

In the worksheet below is an equation for non-Euclidean lines. How can Maple plot these?

NonEuclideanLines.mw

Recently I saw a heated discussion on this post:https://www.mapleprimes.com/questions/233026-Write-Output-Of-For-Loop-To-txt-File

In Carl Love  's answer, I felt the power of adjacency matrix of graph. I carefully read maple's function to generate non IsomorphicGraphs:  NonIsomorphicGraphs. There was one passage that I thought was really interesting.

selectform = graph, adjacency, or bits
This specifies the form used for a graph when it is being passed to the select procedure. The forms are identical to those for outputform, but note that adjacency and bits are the most efficient forms, while graph is only reasonable for a relatively small number of comparison operations (1000 or less), as it needs to form a Graph for every comparison. Note also that when selectform=adjacency the same read-only Matrix is internally used to pass the data for every call to reduce overhead. This is not possible with a Graph structure.

I never quite understood what the advantage of this bits was. At least according to the help documentation, we have  to do many works to do to convert this into a adjacency matrix of graph.

[NonIsomorphicGraphs(8, output = graphs, restrictto = regular[2])]

bit := Vector[row](Bits:-Split(210256131, bits = (8*(8 - 1))/2));
M := Matrix(8, 8, shape = symmetric, datatype = integer[1]);
M[1, 2 .. 8] := bit[1 .. 7];

M[2, 3 .. 8] := bit[8 .. 13];

M[3, 4 .. 8] := bit[14 .. 18];
M[4, 5 .. 8] := bit[19 .. 22];

M[5, 6 .. 8] := bit[23 .. 25];

M[6, 7 .. 8] := bit[26 .. 27];
M[7, 8 .. 8] := bit[28 .. 28];
M;

From adjacency matrix of graph,  we can diractly get a lot of information about the graph, like edges, and the number of closed walks of a particular length, but from bits , what imformation of graph we can get?

If we have to convert it to an adjacency matrix fist, maybe it's a little bit more complicated from above long codes. At least there isn't a more efficient way to convert?

Hi,

I am generating several random weighted graphs using the following code:

with(GraphTheory):
with(RandomGraphs):
G:=RandomGraph(10,20,connected):
G1:=AssignEdgeWeights(G,5..25):
DrawGraph(G1,showlabels=true,stylesheet=[edgecolor=blue,weightfont = [times,bold,11]])

By default weight labels appear to be positioned at the midpoint of each edge. Is there a way to change that positioning?

Thanks!

For example, given two zero-one n*n Matrices R and S. Find their transitivities (find [a,b] that satisfy Ra,x = 1 and Sx,b = 1)

How can I do this?

Dear All, If I understood well dsolve uses the RK45 method to solve an ODE. I would like to compare the results of tha attached worksheet with the results of another software that uses RK4 as a standard. Can I adapt my worksheet to use RK4 and how do you do that? Thanks in advance for your willingness to help me out.QMP_Nov21.mw

Hi ! 

I want to know how to ask Maple to transform a system of ODE in cartesian coordinates (e.g. [x'(t)=u(t) , u'(t)=-x(t)])

into a system in polar coordinates (in my example [r'(t)=0, theta'(t)=-1]). 

Many thanks!

Kevin

Hi,

I am trying to evaluate the diff of a function at a parametric point. But the outcome seems wrong in comparison with a case that we evaluate diff at a numeric point. 

Please observe the attached picture to get my problem.

Thanks in advance.

have table like table(symmetric, [() = x]) from other code not mine, strange syntax

how to extract x from table thanks

I have the following code. I want to do the modify it so that:

1. The outputs of each for loop are merged in such a way that the outputs from the first loop (Es) that are also outputs of the second loop (Fs) are removed from the outputs of (Es).

2. The resulting outputs G= .... are saved to a text file, one to each line.

3. In between each output, I want to add 5 lines of text and a blank line, say

text1 text2 text3

text2 text2 text3

text3 text3 text3

text4 text4 text4

text5 text5 text5

(blank line)

so that in the text file, the format is (e.g.)

G={{1,2}};

text1 text2 text3

text2 text2 text3

text3 text3 text3

text4 text4 text4

text5 text5 text5

(blank line)

G={{1,2},{1,3}};

text1 text2 text3

text2 text2 text3

text3 text3 text3

text4 text4 text4

text5 text5 text5

(blank line)

etc.

What is the easiest way to accomplish this?

restart;
 
with(GraphTheory):
 n:= 4:
  L:= NonIsomorphicGraphs
      ( n,
        output=iterator,
        outputform=graph):
  Es:= Array
       ( [ seq
           (  Edges( L() ),
              j=1..NonIsomorphicGraphs
                   ( n,
                     output=count
                   )
           )
         ]
       ):


  M:= NonIsomorphicGraphs
      ( n-1,
        output=iterator,
        outputform=graph):
  Fs:= Array
       ( [ seq
           (  Edges( M() ),
              j=1..NonIsomorphicGraphs
                   ( n-1,
                     output=count
                   )
           )
         ]
       ):
;

numelems(Es): 
for i from 1 to numelems(Es) do G:=Es[i]:  od;
                           
numelems(Fs):
for i to numelems(Fs) do G := Fs[i]; od;
                        

Hey everyone ! 

I want to get the analytical function from a piecewise differential equation defined on 6 intervals but Maple returns me a numerical result... I think it hides a Runge Kutta method.. However, it returned me an analytical function for a similar piecewise differential equation defined on 3 intervals.

Do you know how I could get the analytical function defined on the 6 intervals ?

Thank you very much for your time ! 

Alex

eq := diff(Uy(x), x, x)-piecewise(x < d1, 12*F*x/(E*b*h^3), d1 < x and x < d2, 12*((F+F1)*x-F1*d1)/(E*b*h^3), d2 < x and x < d3, 12*((F+F1+F2)*x-F1*d1-F2*d2)/(E*b*h^3), d3 < x and x < d4, 12*((F5+F4-F)*x+F*L-F5*d5-F4*d4)/(E*b*h^3), d4 < x and x < d5, 12*((F5-F)*x+F*L-F5*d5)/(E*b*h^3), 12*F*(L-x)/(E*b*h^3))

diff(diff(Uy(x), x), x)-piecewise(x < d1, 12*F*x/(E*b*h^3), d1 < x and x < d2, 12*((F+F1)*x-F1*d1)/(E*b*h^3), d2 < x and x < d3, 12*((F+F1+F2)*x-F1*d1-F2*d2)/(E*b*h^3), d3 < x and x < d4, 12*((F5+F4-F)*x+F*L-F5*d5-F4*d4)/(E*b*h^3), d4 < x and x < d5, 12*((F5-F)*x+F*L-F5*d5)/(E*b*h^3), 12*F*(L-x)/(E*b*h^3))

(1)

dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x))

assign(dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x)))

Uy_sol := unapply(Uy(x), x)

proc (x) options operator, arrow; Uy(x) end proc

(2)

E := 210*10^9; L := 4; d1 := (1/6)*L; d2 := 2*L*(1/6); d3 := 3*L*(1/6); d4 := 4*L*(1/6); d5 := 5*L*(1/6); b := 0.1e-1; h := 0.5e-2

210000000000

 

4

 

2/3

 

4/3

 

2

 

8/3

 

10/3

 

0.1e-1

 

0.5e-2

(3)

eq

diff(diff(Uy(x), x), x)-piecewise(x < 2/3, 0.4571428572e-1*F*x, 2/3 < x and x < 4/3, 0.4571428572e-1*(F+F1)*x-0.3047619048e-1*F1, 4/3 < x and x < 2, 0.4571428572e-1*(F+F1+F2)*x-0.3047619048e-1*F1-0.6095238096e-1*F2, 2 < x and x < 8/3, 0.4571428572e-1*(F5+F4-F)*x+.1828571429*F-.1523809524*F5-.1219047619*F4, 8/3 < x and x < 10/3, 0.4571428572e-1*(F5-F)*x+.1828571429*F-.1523809524*F5, 0.4571428572e-1*F*(4-x))

(4)

dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x))

Uy(x) = -(1/4)*(Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. 4))*x+Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. x)

(5)

Uy(x)[0]

Uy(x)[0]

(6)

assign(dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x)))

Uy(x)[0]

(-(1/4)*(Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. 4))*x+Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. x))[0]

(7)

Uy(x < d1)

Uy(x < 2/3)

(8)

Uy(x)[x < d1]

(-(1/4)*(Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. 4))*x+Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. x))[x < 2/3]

(9)

NULL

Download cas_5v_F_inconnues.mw

restart; N := 100; dx := evalf(2*Pi/N)

100

 

0.6283185308e-1

(1)

f1 := proc (x) options operator, arrow; sin(x) end proc;

proc (x) options operator, arrow; sin(x) end proc

(2)

DiscX := proc (N, dx) local i, xv; xv := Vector(N); for i to N do xv[i] := evalf((i-(1/2)*N-1)*dx) end do; return xv end proc:

Xfun := proc (f1) local i, xa1, xa2; xa1 := Vector(N); xa2 := Vector(N); for i to N do xa1[i] := evalf(subs(x = a[i], f1(x))) end do; return xa1 end proc:

IntNum := proc (N, a, c) local i, xv1; xv1 := Vector(N); for i from 2 to N-1 do xv1[i] := evalf((1/2)*(a[i]-a[i+1])*(c[i]+c[i+1])) end do; return xv1 end proc:

a := DiscX(N, dx); a[1]; a[100]

a := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

-3.141592654

 

3.078760801

(3)

c := Xfun(f1); c[1]

c := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

0.4102067615e-9

(4)

k := IntNum(N, a, c)

k := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(5)

plot([seq([a[i], k[i]], i = 2 .. N)], style = line, title = typeset("Integ_of_sin(x)"), titlefont = [times, bold, 30]);

 

``

Download test.mw

Hey everyone!

I would like to plot the integral of a discrete function. For simplicity, I choose the function sin(x) between –Pi and Pi, which has as an integral -cos(x). I tried to implement that in Maple using the Trapezoidal rule, but the result is simply wrong. Any help would be much appreciated!

I have the following Maplesoft code:

with(ImageTools);

with(IterativeMaps):
Crystal, xrange, yrange := Attractor([x, y], [[1/2 - y/2, x/2], [y/2 + 1/2, 1/2 - x/2], [x/2 + 1/4, y/2 + 1/2]], height = 400, width = 400, xmin = -1, xmax = 2, ymin = -1, ymax = 1, fixview = true, [0, 0], [0.33, 0.33, 0.33], greenexpression = 1 - 1/(1/(1 - G) + 1), iterations = 2500000);
xrange, yrange;
                        -1 .. 2, -1 .. 1

ColouringProcedures:-HueToRGB(Crystal);
                               0.

Embed(Crystal);

which yields the following image:


However, I should be seeing the following image:

Any help would be appreciated. Thanks!

First 246 247 248 249 250 251 252 Last Page 248 of 2308