sand15

787 Reputation

11 Badges

9 years, 177 days

MaplePrimes Activity


These are replies submitted by sand15

@Rouben Rostamian  

ContoursWithLabels is Kitonum's code see_here

@C_R 

Thanks for your return.

Go here help(dsolve[numeric]), search for 'known', try to understand hot to proceed from examples dsol8 and dsol8b.

@Muhammad Usman 

Does this suit you?

plots[display](
  PP
  , size = [500, 400]
  , axis[1]=[tickmarks=[seq(k=k/10., k=0..20, 5)]]
  , axis[2]=[tickmarks=[seq(k=k/10., k=0..20, 5)]]
);

But given L=1 and T=2, it seems to me that this

plots[display](
  PP
  , size = [500, 400]
  , axis[1]=[tickmarks=[seq(k=evalf(k*`&Delta:x`), k=0..20, 5)]]
  , axis[2]=[tickmarks=[seq(k=evalf(k*`&Delta:t`), k=0..20, 5)]]
);

would be more correct.

What is the structure of the data you want to send to Tecplot?
I guess it is a collection of contours, each contour being a collection of segments, that is a collection of 2x2 matrices.
The question is what structure Tecplot can manage? Once defined, the corresponding structure can be build in Maple.
But the "precision" of a contour of a given length is defined by the number of segments which approximate this contour. So the drawing in Tecplot of a contour made of, for instance, 100 segments constructed in Maple, will not have an higher resolution than thesame contour directly drawn in Maple.

As you defined

N := 20: 
Mx := 20: 

and plotted

plots:-contourplot(
        interfunc, 
        0 .. Mx, 0 .. N
        ...
)

why do you say "Here the t-axis is from 0 to 20 but its actual value is from 0 to 2 and the x-axis is from 0 to 20 but its actual value is from 0 to 2"?

If you want them to range from 0 to 2 just write

plots:-contourplot(
        interfunc, 
        0 .. 2, 0 .. 2
        ...
)

instead or set

N := 2: 
Mx := 2: 

It's up to you to lnow what you want to do.

About your claim "How I can, I extract data in the form of a dat file to plot in some professional software? " (which, I'm afraid of, will be likely understood as "Maple is not a professional software") you must be more detailed.
If you have professional in mind, I think that best thing to do is to give him interfunc plus some indications and let him manage to provide a "real professional layout".

@RaySierra 

And NO, I have no idea where your error came from.
What I can say is that your file, when opened with Maple 2015 on an iMac, generates a "Connection to the kernel lost" infamous message (which means that the only thing to do is to quit Maple).

@RaySierra 

There are probably hidden characters somewhere in your file that I don't have time to seek out (they could come from some copy/paste operation)
Just open the attached file and check if it works correctly with your Maple version
Test_cooling_task_model_rewritten.mw

Please keep me informed and let me know if you'd like an example of a Monte-Carlo simulation distributed over several cores (see my comment in my first reply).

restart

kernelopts(version)

`Maple 2015.2, APPLE UNIVERSAL OSX, Dec 20 2015, Build ID 1097895`

(1)


ref: Programing_Guide_2023

pages 583-584

add_range := proc(lo, hi)

local i;

add( i, i = lo..hi );

end proc:

parallel_add_range := proc( lo, hi, n )

local i,step,d;

d := hi-lo+1;

step := floor( d/n );

Threads:-Task:-Continue( `+`, Tasks=[ add_range,

seq( [i*step+lo,(i+1)*step], i=0..n-2 ),

[ (n-1)*step+lo,hi ] ] );

end proc:

N := 3*10^7;

30000000

(2)

start := time[real]():

add_range( 1, N );

time[real]()-start

450000015000000

 

1.581

(3)

start := time[real]():

Threads:-Task:-Start( parallel_add_range, 1, N, 2 );

time[real]()-start

450000015000000

 

1.081

(4)

start := time[real]():

Threads:-Task:-Start( parallel_add_range, 1, N, 4 );

time[real]()-start;

450000015000000

 

.506

(5)

start := time[real]():

Threads:-Task:-Start( parallel_add_range, 1, N, 10000 );

time[real]()-start;

450000015000000

 

.536

(6)

 

Download Maple_PG2023_pp583-584.mw

About your Monte-Carlo simulatoin problem:
I use to do intensive MC simulations int he following specific context: some inputs X of a simulation code C are random variable and one is interested in assessing some statistics of the random output(s?) Y of C.

This problem is usually tackled by sampling X, running C over this sample, finally analyzing the induced Y sample. X sampling can be done through some strategy, in particular Monte-Carlo sampling (MCS).
MCS is largely used for a MC sample augmented by another MC sample is still a MC sample (specific properties MCS are conserved), opening the route to distributed computations, that is sampling+running on different cores/processors/machines.

This process is perfectly scalable meaning the sampling+running operation executed on P cores is exactly P times faster than executed on a single one (at least in theory for the OS of the machine host limits generally reduces the performance).
The time requires to gather the P partial simulations is general negligible

To do this I use to use the Grid package instead of the Threads one.

 @petit loup    @acer 

Sample(Normal(0, 1), [n, n])

@Jamie128 

So do you say that z = -2*M^2*sin(theta)^2 - 2*k*r^2?
What you need, I repeat myself, is a function r(theta, z) plot3d(r(theta, z), theta = a .. b, z = c .. d, coords = cylindrical)
and this expression of z doesn't make r uniquely defined:

restart
z = -2*M^2*sin(theta)^2 - 2*k*r^2;
r =~ [solve(%, r)]

 

 

 

it is said that

For alternate coordinate systems this is interpreted differently. For example, when using cylindrical coordinates, Maple expects the command to be of the following form: plot3d(r(theta, z), theta = a .. b, z = c .. d, coords = cylindrical)

What are r(theta, z) and z in your expression -2*M^2*sin(theta)^2 - 2*k*r^2?

Do you mean z = -2*M^2*sin(theta)^2 - 2*k*r^2?

What does your claim "where the function is greater than zero and where it is less that zero" mean given that ehe radius (r?) is to be always greater or equal to 0.



To complete @Christian Wolinski 's reply: f can be integrated provided alpha is an integer <= 1.
I guess that the reason why the WhittakerM function

In the attached file you will see that the integration can be done only (that's my hunch, not a mathematical proof) when
WhittakerM(a, b, 3/2*t) can be converted into elementary functions.
(
Maybe there exist some recurrence relation to integrate int(h(t)*WhittakerM(a, b, 3/2*t) , t), but I wasn't capable to find any.
More precisely I thought that one could take advantage that

diff(WhittakerW(p, q, 3/2*t), t);
                                                  /          3  \
                                       WhittakerW |p + 1, q, - t|
 3 /1   2 p\             /      3  \              \          2  /
 - |- - ---|  WhittakerW |p, q, - t| - -------------------------
 2 \2   3 t/             \      2  /               t            
          

).

When alpha is an integer > 1, the denominator GAMMA(2-alpha)=0 and f is undefined.

Whittaker.mw

@mz6687 

I'm sorry, but I don't understand a single word of what you're saying.
What is this 8x8 matrix you are now talking about?

BTW: is it you who deleted your last question or was it moved by someone else?

Whatever, is this new thread isrelated to this one https://www.mapleprimes.com/questions/237066-Determinant-The-System-Hangs, you would better keep this discussion goin in this latter thread.

@mz6687 

 

restart

with(LinearAlgebra):

with(plots):

with(Physics):

``

Physics:-Setup(mathematicalnotation = true);

[mathematicalnotation = true]

(1)

assume(x::real);

alias(v = v(x, t));

v

(2)

``

B1 := Matrix([[Physics:-`*`(Physics:-`^`(lambda__1-conjugate(lambda__1), -1), exp(Physics:-`*`(I, v__11))), 0, 0, 0, Physics:-`*`(Physics:-`^`(lambda__2-conjugate(lambda__1), -1), exp(Physics:-`*`(I, v__12))), 0, 0, 0], [0, Physics:-`*`(Physics:-`^`(lambda__1-conjugate(lambda__1), -1), exp(Physics:-`*`(I, v__11))), 0, 0, 0, Physics:-`*`(Physics:-`^`(lambda__2-conjugate(lambda__1), -1), exp(Physics:-`*`(I, v__12))), 0, 0], [0, 0, Physics:-`*`(Physics:-`^`(lambda__1-conjugate(lambda__1), -1), exp(-Physics:-`*`(I, v__11))), 0, 0, 0, Physics:-`*`(Physics:-`^`(lambda__2-conjugate(lambda__1), -1), exp(-Physics:-`*`(I, v__12))), 0], [0, 0, 0, Physics:-`*`(Physics:-`^`(lambda__1-conjugate(lambda__1), -1), exp(-Physics:-`*`(I, v__11))), 0, 0, 0, Physics:-`*`(Physics:-`^`(lambda__2-conjugate(lambda__1), -1), exp(-Physics:-`*`(I, v__12)))], [Physics:-`*`(Physics:-`^`(lambda__1-conjugate(lambda__2), -1), exp(Physics:-`*`(I, v__21))), 0, 0, 0, Physics:-`*`(Physics:-`^`(lambda__2-conjugate(lambda__2), -1), exp(Physics:-`*`(I, v__22))), 0, 0, 0], [0, Physics:-`*`(Physics:-`^`(lambda__1-conjugate(lambda__2), -1), exp(Physics:-`*`(I, v__21))), 0, 0, 0, Physics:-`*`(Physics:-`^`(lambda__2-conjugate(lambda__2), -1), exp(Physics:-`*`(I, v__22))), 0, 0], [0, 0, Physics:-`*`(Physics:-`^`(lambda__1-conjugate(lambda__2), -1), exp(-Physics:-`*`(I, v__21))), 0, 0, 0, Physics:-`*`(Physics:-`^`(lambda__2-conjugate(lambda__2), -1), exp(-Physics:-`*`(I, v__22))), 0], [0, 0, 0, Physics:-`*`(Physics:-`^`(lambda__1-conjugate(lambda__2), -1), exp(-Physics:-`*`(I, v__21))), 0, 0, 0, Physics:-`*`(Physics:-`^`(lambda__2-conjugate(lambda__2), -1), exp(-Physics:-`*`(I, v__22)))]]):

NULL

NULL

para_0 := [H__14 =0.3, H__33 = 1.5, H__38 = 0.15, H__44 = 1.5];
print():
para_1 := remove((x -> is(x in lhs~(para_0))), [entries(H, nolist)]) =~ 0;
print():
para := [para_0[], para_1[], c__1 = 0.5, nu = 1, alpha__1 = 1.5, alpha__2 = 1, lambda__1 = 0.58*I, lambda__2 = 0.68*I]

[H__14 = .3, H__33 = 1.5, H__38 = .15, H__44 = 1.5]

 

 

[H__11 = 0, H__12 = 0, H__13 = 0, H__15 = 0, H__16 = 0, H__17 = 0, H__18 = 0, H__12 = 0, H__11 = 0, H__13 = 0, H__16 = 0, H__15 = 0, H__18 = 0, H__17 = 0, H__13 = 0, H__34 = 0, H__17 = 0, H__18 = 0, H__55 = 0, H__13 = 0, H__34 = 0, H__18 = 0, H__17 = 0, H__55 = 0, H__15 = 0, H__16 = 0, H__17 = 0, H__18 = 0, H__11 = 0, H__12 = 0, H__13 = 0, H__16 = 0, H__15 = 0, H__18 = 0, H__17 = 0, H__12 = 0, H__11 = 0, H__13 = 0, H__17 = 0, H__18 = 0, H__55 = 0, H__13 = 0, H__34 = 0, H__18 = 0, H__17 = 0, H__55 = 0, H__13 = 0, H__34 = 0]

 

 

[H__14 = .3, H__33 = 1.5, H__38 = .15, H__44 = 1.5, H__11 = 0, H__12 = 0, H__13 = 0, H__15 = 0, H__16 = 0, H__17 = 0, H__18 = 0, H__12 = 0, H__11 = 0, H__13 = 0, H__16 = 0, H__15 = 0, H__18 = 0, H__17 = 0, H__13 = 0, H__34 = 0, H__17 = 0, H__18 = 0, H__55 = 0, H__13 = 0, H__34 = 0, H__18 = 0, H__17 = 0, H__55 = 0, H__15 = 0, H__16 = 0, H__17 = 0, H__18 = 0, H__11 = 0, H__12 = 0, H__13 = 0, H__16 = 0, H__15 = 0, H__18 = 0, H__17 = 0, H__12 = 0, H__11 = 0, H__13 = 0, H__17 = 0, H__18 = 0, H__55 = 0, H__13 = 0, H__34 = 0, H__18 = 0, H__17 = 0, H__55 = 0, H__13 = 0, H__34 = 0, c__1 = .5, nu = 1, alpha__1 = 1.5, alpha__2 = 1, lambda__1 = .58*I, lambda__2 = .68*I]

(3)

B1_para    := eval(B1, para);
detB1_para := Determinant(B1_para)

B1_para := Matrix(8, 8, {(1, 1) = -(.8620689655*I)*exp(I*v__11), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = -(.7936507937*I)*exp(I*v__12), (1, 6) = 0, (1, 7) = 0, (1, 8) = 0, (2, 1) = 0, (2, 2) = -(.8620689655*I)*exp(I*v__11), (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = -(.7936507937*I)*exp(I*v__12), (2, 7) = 0, (2, 8) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -(.8620689655*I)*exp(-I*v__11), (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (3, 7) = -(.7936507937*I)*exp(-I*v__12), (3, 8) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = -(.8620689655*I)*exp(-I*v__11), (4, 5) = 0, (4, 6) = 0, (4, 7) = 0, (4, 8) = -(.7936507937*I)*exp(-I*v__12), (5, 1) = -(.7936507937*I)*exp(I*v__21), (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = -(.7352941176*I)*exp(I*v__22), (5, 6) = 0, (5, 7) = 0, (5, 8) = 0, (6, 1) = 0, (6, 2) = -(.7936507937*I)*exp(I*v__21), (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = -(.7352941176*I)*exp(I*v__22), (6, 7) = 0, (6, 8) = 0, (7, 1) = 0, (7, 2) = 0, (7, 3) = -(.7936507937*I)*exp(-I*v__21), (7, 4) = 0, (7, 5) = 0, (7, 6) = 0, (7, 7) = -(.7352941176*I)*exp(-I*v__22), (7, 8) = 0, (8, 1) = 0, (8, 2) = 0, (8, 3) = 0, (8, 4) = -(.7936507937*I)*exp(-I*v__21), (8, 5) = 0, (8, 6) = 0, (8, 7) = 0, (8, 8) = -(.7352941176*I)*exp(-I*v__22)})

 

.1614404685*(exp(I*v__11))^2*(exp(-I*v__11))^2*(exp(I*v__22))^2*(exp(-I*v__22))^2-.3208471697*(exp(I*v__11))^2*exp(-I*v__11)*exp(-I*v__21)*(exp(I*v__22))^2*exp(-I*v__12)*exp(-I*v__22)+.1594131063*(exp(I*v__11))^2*(exp(-I*v__21))^2*(exp(I*v__22))^2*(exp(-I*v__12))^2-.3208471697*exp(I*v__11)*exp(I*v__21)*(exp(-I*v__11))^2*exp(I*v__22)*exp(I*v__12)*(exp(-I*v__22))^2+.6376524251*exp(I*v__11)*exp(I*v__21)*exp(-I*v__11)*exp(-I*v__21)*exp(I*v__22)*exp(I*v__12)*exp(-I*v__12)*exp(-I*v__22)-.3168179849*exp(I*v__11)*exp(I*v__21)*(exp(-I*v__21))^2*exp(I*v__22)*exp(I*v__12)*(exp(-I*v__12))^2+.1594131063*(exp(I*v__21))^2*(exp(-I*v__11))^2*(exp(I*v__12))^2*(exp(-I*v__22))^2-.3168179850*(exp(I*v__21))^2*exp(-I*v__11)*exp(-I*v__21)*(exp(I*v__12))^2*exp(-I*v__12)*exp(-I*v__22)+.1574112034*(exp(I*v__21))^2*(exp(-I*v__21))^2*(exp(I*v__12))^2*(exp(-I*v__12))^2

(4)

H_para := eval(H, para):

# Given that

B_para := 'H_para . B1_para';

# one gets:

detH_para := Determinant(H_para);
detB_para := detB1_para . detH_para:

Physics:-`.`(H_para, B1_para)

 

HFloat(6.560999999999999e-5)

(5)

# One possible simplification

whynot := simplify(combine(detB_para, exp)) assuming real;
whynot := convert(whynot, trig)

HFloat(2.0918187808685997e-5)*cos(2*v__11-2*v__12-2*v__21+2*v__22)+HFloat(6.275623380416999e-5)-HFloat(4.1837210793305994e-5)*exp(I*(v__11-v__12-v__21+v__22))-HFloat(4.1837210799866996e-5)*exp(-I*(v__11-v__12-v__21+v__22))

 

HFloat(2.0918187808685997e-5)*cos(2*v__11-2*v__12-2*v__21+2*v__22)+HFloat(6.275623380416999e-5)-HFloat(8.3674421593173e-5)*cos(v__11-v__12-v__21+v__22)+(HFloat(6.561002012950984e-15)*I)*sin(v__11-v__12-v__21+v__22)

(6)

 

NULL

 

Download Are_you_ok_with_that.mw

 

@mz6687 

Sorry, I don't understand what you say

3 4 5 6 7 8 9 Last Page 5 of 24