Bosco Emmanuel

10 Reputation

2 Badges

7 years, 73 days

MaplePrimes Activity


These are replies submitted by Bosco Emmanuel

@tomleslie 

Is sampling from a random distribution inside a maple procedure possibel ?

@mmcdara 

I tried to open this file that you sent. It is not properly opening in my maple version 12. Any suggestion ?

@mmcdara 

Dear Tom,

My Maple is still down and I will get back to you once it is up and running.

Thanks.

@tomleslie 

Dear Tom,

My Maple is still down and I will get back to you once it is up and running.

Thanks.

@mmcdara

Thanks for this additional information. I am looking forward to run the codes and compare them Tomorrow. 

I will get back to you tomorrow.

Thanks again. 

@mmcdara 

Thank you very much for this help. I will run these codes on Monday and get back to you.

I don't have maple at home.

Thanks again. 

@tomleslie 

Dear Tom,

I am facing some issues with my maple. The code which was running till yesterday refuses to run properly and says "emty number".As soon as I get over this problem, I will send the working code to you.

In the mean time I am uploading my code any way. Please see what may be the problem with it.

Thanks. 
 

restart; with(plots); LAM1 := 3; LAM2 := 1; LAM3 := .5; RT[1] := .3; RT[2] := 1.0; RT[3] := 1.5; TC[0] := 0.; N[1] := 0; N[2] := 0; N[3] := 0; with(Statistics); X1 := Exponential(1/LAM1); X2 := Exponential(1/LAM2); X3 := Exponential(1/LAM3); for n to 1000 do T[1] := Sample(X1, 1); T[1][1]; T[2] := Sample(X2, 1); T[2]; T[3] := Sample(X3, 1); T[3]; T1 := T[1][1]; T2 := T[2][1]; T3 := T[3][1]; if T1 <= T2 and T1 <= T3 then l := 1 else  end if; if T2 <= T1 and T2 <= T3 then l := 2 else  end if; if T3 <= T2 and T3 <= T1 then l := 3 else  end if; N[l] := N[l]+1; B[N[l], l] := T[l][1]+RT[l]; TC[n] := TC[n-1]+B[N[l], l] end do

NULL

NULL

NULL


 

Download SYNTHETIC-ECG-CODE-FOR-TOM.mw

 

@tomleslie 

Dear Tom,

Thanks for your very clear reply. It is night here and I just saw your post.

As soon as I go to my office tomorrow morning, I will upload my code for your further guidance.

I will also follow your instructions and see how far I go.

I very much appreciate your help, Tom. 

Cordially,

Bosco Emmanuel 

@tomleslie 

Dear Tom,

Maple 12 is the version I use. I am uploading the code along with the error message. Please diagnose and advise.

Thanks again.
 

NULL

restart; with(LinearAlgebra); with(DynamicSystems); pts := 20; T := Vector([`$`(1, pts)]); A := RandomMatrix(pts, pts, generator = 0. .. 1.0); p1 := DiscretePlot(A[1, () .. ()], T, style = stem, colour = red); plots:-display([p1]); p2 := DiscretePlot(A[2, () .. ()], T+`~1`, style = stem, baseline = 1, color = blue); p3 := DiscretePlot(A[3, () .. ()], T+`~2`, style = stem, baseline = 2, color = green); p4 := DiscretePlot(A[4, () .. ()], T+`~3`, style = stem, baseline = 3, color = black); plots:-display([p1, p2, p3, p4])

PLOT(CURVES([[.1787661868, 0.], [.9594924264, 0.]], [[.1787661868, 0.], [.1787661868, 1.]], [[.5829863827, 0.], [.5829863827, 1.]], [[.1711210664, 0.], [.1711210664, 1.]], [[.3394934134, 0.], [.3394934134, 1.]], [[.1331710076, 0.], [.1331710076, 1.]], [[.4710883745, 0.], [.4710883745, 1.]], [[.1978098267, 0.], [.1978098267, 1.]], [[.9879820032, 0.], [.9879820032, 1.]], [[.5078582847, 0.], [.5078582847, 1.]], [[.4356986841, 0.], [.4356986841, 1.]], [[.7948314169, 0.], [.7948314169, 1.]], [[.4509237064, 0.], [.4509237064, 1.]], [[.1112027553, 0.], [.1112027553, 1.]], [[.1449547982, 0.], [.1449547982, 1.]], [[.4426782698, 0.], [.4426782698, 1.]], [[.3371226444, 0.], [.3371226444, 1.]], [[.4732888489, 0.], [.4732888489, 1.]], [[.2238119395, 0.], [.2238119395, 1.]], [[0.3444608050e-1, 0.], [0.3444608050e-1, 1.]], [[.9594924264, 0.], [.9594924264, 1.]], COLOUR(RGB, 1.00000000, 0., 0.)), POINTS([.1787661868, 1.], [.5829863827, 1.], [.1711210664, 1.], [.3394934134, 1.], [.1331710076, 1.], [.4710883745, 1.], [.1978098267, 1.], [.9879820032, 1.], [.5078582847, 1.], [.4356986841, 1.], [.7948314169, 1.], [.4509237064, 1.], [.1112027553, 1.], [.1449547982, 1.], [.4426782698, 1.], [.3371226444, 1.], [.4732888489, 1.], [.2238119395, 1.], [0.3444608050e-1, 1.], [.9594924264, 1.], COLOUR(RGB, 1.00000000, 0., 0.), LINESTYLE(1), STYLE(POINT), LEGEND("__never_display_this_legend_entry")))

 

 

Error, invalid input: DynamicSystems:-DiscretePlot expects its 2nd argument, v2, to be of type {realcons, list(extended_numeric), ('Vector')(extended_numeric)}, but received `~1`+(Vector(20, {(1) = 1, (2) = 1, (3) = 1, (4) = 1, (5) = 1, (6) = 1, (7) = 1, (8) = 1, (9) = 1, (10) = 1, (11) = 1, (12) = 1, (13) = 1, (14) = 1, (15) = 1, (16) = 1, (17) = 1, (18) = 1, (19) = 1, (20) = 1}))

 

Error, invalid input: DynamicSystems:-DiscretePlot expects its 2nd argument, v2, to be of type {realcons, list(extended_numeric), ('Vector')(extended_numeric)}, but received `~2`+(Vector(20, {(1) = 1, (2) = 1, (3) = 1, (4) = 1, (5) = 1, (6) = 1, (7) = 1, (8) = 1, (9) = 1, (10) = 1, (11) = 1, (12) = 1, (13) = 1, (14) = 1, (15) = 1, (16) = 1, (17) = 1, (18) = 1, (19) = 1, (20) = 1}))

 

Error, invalid input: DynamicSystems:-DiscretePlot expects its 2nd argument, v2, to be of type {realcons, list(extended_numeric), ('Vector')(extended_numeric)}, but received `~3`+(Vector(20, {(1) = 1, (2) = 1, (3) = 1, (4) = 1, (5) = 1, (6) = 1, (7) = 1, (8) = 1, (9) = 1, (10) = 1, (11) = 1, (12) = 1, (13) = 1, (14) = 1, (15) = 1, (16) = 1, (17) = 1, (18) = 1, (19) = 1, (20) = 1}))

 

Error, (in plots:-display) expecting plot structures but received: [p2, p3, p4]

 

``


 

Download spike-train-plot.mw
 

NULL

restart; with(LinearAlgebra); with(DynamicSystems); pts := 20; T := Vector([`$`(1, pts)]); A := RandomMatrix(pts, pts, generator = 0. .. 1.0); p1 := DiscretePlot(A[1, () .. ()], T, style = stem, colour = red); plots:-display([p1]); p2 := DiscretePlot(A[2, () .. ()], T+`~1`, style = stem, baseline = 1, color = blue); p3 := DiscretePlot(A[3, () .. ()], T+`~2`, style = stem, baseline = 2, color = green); p4 := DiscretePlot(A[4, () .. ()], T+`~3`, style = stem, baseline = 3, color = black); plots:-display([p1, p2, p3, p4])

PLOT(CURVES([[.1787661868, 0.], [.9594924264, 0.]], [[.1787661868, 0.], [.1787661868, 1.]], [[.5829863827, 0.], [.5829863827, 1.]], [[.1711210664, 0.], [.1711210664, 1.]], [[.3394934134, 0.], [.3394934134, 1.]], [[.1331710076, 0.], [.1331710076, 1.]], [[.4710883745, 0.], [.4710883745, 1.]], [[.1978098267, 0.], [.1978098267, 1.]], [[.9879820032, 0.], [.9879820032, 1.]], [[.5078582847, 0.], [.5078582847, 1.]], [[.4356986841, 0.], [.4356986841, 1.]], [[.7948314169, 0.], [.7948314169, 1.]], [[.4509237064, 0.], [.4509237064, 1.]], [[.1112027553, 0.], [.1112027553, 1.]], [[.1449547982, 0.], [.1449547982, 1.]], [[.4426782698, 0.], [.4426782698, 1.]], [[.3371226444, 0.], [.3371226444, 1.]], [[.4732888489, 0.], [.4732888489, 1.]], [[.2238119395, 0.], [.2238119395, 1.]], [[0.3444608050e-1, 0.], [0.3444608050e-1, 1.]], [[.9594924264, 0.], [.9594924264, 1.]], COLOUR(RGB, 1.00000000, 0., 0.)), POINTS([.1787661868, 1.], [.5829863827, 1.], [.1711210664, 1.], [.3394934134, 1.], [.1331710076, 1.], [.4710883745, 1.], [.1978098267, 1.], [.9879820032, 1.], [.5078582847, 1.], [.4356986841, 1.], [.7948314169, 1.], [.4509237064, 1.], [.1112027553, 1.], [.1449547982, 1.], [.4426782698, 1.], [.3371226444, 1.], [.4732888489, 1.], [.2238119395, 1.], [0.3444608050e-1, 1.], [.9594924264, 1.], COLOUR(RGB, 1.00000000, 0., 0.), LINESTYLE(1), STYLE(POINT), LEGEND("__never_display_this_legend_entry")))

 

 

Error, invalid input: DynamicSystems:-DiscretePlot expects its 2nd argument, v2, to be of type {realcons, list(extended_numeric), ('Vector')(extended_numeric)}, but received `~1`+(Vector(20, {(1) = 1, (2) = 1, (3) = 1, (4) = 1, (5) = 1, (6) = 1, (7) = 1, (8) = 1, (9) = 1, (10) = 1, (11) = 1, (12) = 1, (13) = 1, (14) = 1, (15) = 1, (16) = 1, (17) = 1, (18) = 1, (19) = 1, (20) = 1}))

 

Error, invalid input: DynamicSystems:-DiscretePlot expects its 2nd argument, v2, to be of type {realcons, list(extended_numeric), ('Vector')(extended_numeric)}, but received `~2`+(Vector(20, {(1) = 1, (2) = 1, (3) = 1, (4) = 1, (5) = 1, (6) = 1, (7) = 1, (8) = 1, (9) = 1, (10) = 1, (11) = 1, (12) = 1, (13) = 1, (14) = 1, (15) = 1, (16) = 1, (17) = 1, (18) = 1, (19) = 1, (20) = 1}))

 

Error, invalid input: DynamicSystems:-DiscretePlot expects its 2nd argument, v2, to be of type {realcons, list(extended_numeric), ('Vector')(extended_numeric)}, but received `~3`+(Vector(20, {(1) = 1, (2) = 1, (3) = 1, (4) = 1, (5) = 1, (6) = 1, (7) = 1, (8) = 1, (9) = 1, (10) = 1, (11) = 1, (12) = 1, (13) = 1, (14) = 1, (15) = 1, (16) = 1, (17) = 1, (18) = 1, (19) = 1, (20) = 1}))

 

Error, (in plots:-display) expecting plot structures but received: [p2, p3, p4]

 

``


 

Download spike-train-plot.mw

 

 

@tomleslie 

Dear Tom,

Your code works fine for the single spike train. For the multiple spike trains, the ~ s cause problem in my maple version. I tried replacing the ~  by map in the 3 places it occurs. I still face the problem. Please advise.

Thanks again.

@tomleslie 

Dear Tom,

I think this is what l wanted. As l am leaving for home, l will run it tomorrow and let you confirm it.

Thanks a lot. 

@tomleslie 

Dear Tom,

Let me first thank you for the kind reply. My requirement is quite similar to the plots which you have generated but with the following difference:

The vertical lines should be all of the same height, say one unit. It is the positions on the x-axis of these verticals are given as floating point numbers[random numbers in your code]  in the input vector for a single spike train. For a matrix input we want many spike trains placed one above the other.

I look forward to the modified code.

Thank you again.

 

@Carl Love 

Dear Carl,

I think you have resolved the mystery about the ~s. Tom's suggestion works fine with map replacing the ~s. It was indeed the version problem. I am presently using maple 12. 

My Institute will soon purchase the latest maple version (maple 2018?). That will save me from such version-related issues.

Thank you and Tom.

Cordially,

Bosco Emmanuel

 

@tomleslie 

Dear Tom,

Thanks for all your good efforts to help me. Carl tells me that versions earlier to maple 13 may not support the ~s. I am using maple 12 and that explains it. Carl further suggested that I use map in the place of ~. Yes it works with map.

Thanks again.

Cordially,

Bosco Emmanuel 

 

 

@Carl Love 

Dear Carl,

I am much grateful for your help. nops will be very useful for my work.

You seem to be very good at maple. Though I am using maple for several years, I do not know each and every corner of maple.

Thanks again.

Cordially,

Bosco Emmanuel 

1 2 3 Page 2 of 3