I've got a list of point pairs (in NetLogo coordinates) called "coords" that looks like this:
[[[255 97] [256 97]]
[[-131 408] [-129 407]]
[[-125 406] [-122 405]]
[[-84 188]] [-83 188]]
[[-303 200] [-304 203]]
[[25 414] [19 415]]
[[-128 256] [-125 254]]
.......................................]
Each point pair has associated with it a classification variable, which takes one of the values "I", "U", or "S". I have a separate list of these classification variables, called "coord_class" the same length and in the same order as the point pairs listed above.
["S" "S" "U" "I" "S" "I" "U" ...]
What I would like to do is append the corresponding classification variable to the point pairs, in a way that looks like this:
[[[255 97 "S"] [256 97 "S"]]
[[-131 408 "S"] [-129 407 "S"]]
[[-125 406 "U"] [-122 405 "U"]]
[[-84 188 "I"]] [-83 188 "I"]]
[[-303 200 "S"] [-304 203 "S"]]
[[25 414 "I"] [19 415 "I"]]
[[-128 256 "U"] [-125 254"U"]]
.......................................]
Note that both points in a given pair take the same classification variable value.
I've attempted to do this using the map reporter:
set coords (map [list ?1 ?2] coords coord_class)
which gives an output that looks like this:
[[[[255 97] [256 97]] "S"]
[[[-131 408] [-129 407]] "S"]
[[[-125 406] [-122 405]] "U"]
[[[-84 188]] [-83 188]] "I"]
[[[-303 200] [-304 203]] "S"]
[[[25 414] [19 415]] "I"]
[[[-128 256] [-125 254]] "U"]
.......................................]
This isn't structured properly for other functions in the code. Any advice to help me obtain the desired output would be appreciated. Thanks!
You have a list of lists of lists. Doing what you want will require two separate map operations. The easiest way to do this is probably to split the task between two small reporters:
to-report add-classes [ coords classes ]
report (map add-class coords classes)
end
to-report add-class [ lists class ]
report map [ lput class ? ] lists
end
You can then use it like this:
to go
let coords [
[ [ 255 97] [ 256 97] ]
[ [-131 408] [-129 407] ]
[ [-125 406] [-122 405] ]
[ [ -84 188] [ -83 188] ]
[ [-303 200] [-304 203] ]
[ [ 25 414] [ 19 415] ]
[ [-128 256] [-125 254] ]
]
let coord_class ["S" "S" "U" "I" "S" "I" "U"]
show add-classes coords coord_class
end
Which will print the desired output:
[[[255 97 "S"] [256 97 "S"]] [[-131 408 "S"] [-129 407 "S"]] [[-125 406 "U"] [-122 405 "U"]] [[-84 188 "I"] [-83 188 "I"]] [[-303 200 "S"] [-304 203 "S"]] [[25 414 "I"] [19 415 "I"]] [[-128 256 "U"] [-125 254 "U"]]]
Related
How can I create a new list for each line in a txt file in netlogo? For example, I have a file containing these values:
[89 64 90 1 97 45 109]
[89 64 90 1 97 38 109]
[89 101 11 51 80 9 109]
[89 101 11 51 80 16 13 109]
[89 101 11 51 80 16 13 68 109]
And I would like to create a list for each one of these lines. i.e.
List1: [89 101 11 51 80 16 109]
List2: [89 101 11 51 80 9 109]
etc...
The number of lines in the file varies so the number of lists cannot be statically allocated.
This is the current code to loop through the file and output each line as a list in the console:
to DetermineRoute
ask sensors with [color = green][
file-open "BaseStationRoutes.txt"
while [ not file-at-end? ] [
let Route file-read-line
set Route read-from-string Route
print Route
print length Route ;length is the hop count
]
file-close
]
end
The end goal is to get the average length of each list to calculate the standard deviation.
Lacking the clarification JenB asks for, lets simply address how to store a variable number of lists of variable length. The best structure for doing that in NetLogo is a list of lists, as lists can be of varying length and contain dissimilar elements. Your procedure above would then be
to DetermineRoute
ask sensors with [color = green][
let Routes []
file-open "BaseStationRoutes.txt"
while [ not file-at-end? ] [
let Route file-read-line
set Route read-from-string Route
set Routes lput Route Routes
; print length Route ;length is the hop count
]
file-close
]
end
Routes is initialized as an empty list, and each line of the file is appended to that list with lput. Each Route is an item in Routes, e.g., the first Route is item 0 Routes, etc. The number of Route lists is length Routes, and the length of (say) the third Route is length item 2 Routes.
I found somewhere a "decimal byte" representation of the number 14852543 being 226 161 191. I assume this is because it somehow factors or multiplies or something into this number, but I'm not sure how it's done.
The first part of the question is how to convert those byte values back into the number. The second part of the question is, how to break a number into a set of bitarrays (not bytes), that accomplish the same thing as above. So for example, instead of 3 8-bit numbers, it might be 5 7-bit numbers, or 12 3-bit numbers. Wondering what the equation or algorithm is that can do that.
Taking 14852543 as the example input.
Case 1 [ 12 3-bit numbers ] :
Step 0 : Setup' the bits group. 12 x [000] . Or [ 000 000 000 000 000 000 000 000 000 000 000 000 ]
Step 1 : convert 14852543 to binary. Should get 111000101010000110111111 .
Step 2 : 111000101010000110111111 to [ 000 000 000 000 111 000 101 010 000 110 111 111 ] .
Step 3 : [ 000 000 000 000 111 000 101 010 000 110 111 111 ] to [ 0 0 0 0 7 0 5 2 0 6 7 7 ]
Case 2 [ 5 7-bit numbers ] :
Step 0 : Setup' the bits. 5 x [0000000] . Or [ 0000000 0000000 0000000 0000000 0000000 ]
Step 1 : convert 14852543 to binary. Should get 111000101010000110111111 .
Step 2 : 111000101010000110111111 to [ 0000000 0000111 0001010 1000011 0111111 ] .
Step 3 : [ 0000000 0000111 0001010 1000011 0111111 ] to [ 0 7 10 67 63 ]
Case 3 [ 3 8-bit numbers ] :
Step 0 : Setup' the bits. 3 x [00000000] . Or [ 00000000 00000000 00000000 ]
Step 1 : convert 14852543 to binary. Should get 111000101010000110111111 .
Step 2 : 111000101010000110111111 to [ 11100010 10100001 1011111 ] .
Step 3 : [ 11100010 10100001 1011111 ] to [ 226 161 191 ]
Hope it answers... ( :
I got a set of turtles with links connected to each other. I wanted to retrieve the weight of the link between two nodes, i've tried searching but couldn't find any info on how to do it. I'm not using nw cause i don't want the shortest path. Any ideas? This is a section of my code:
to calculate-oldpath
let oldList [ 25 0 1 2 3 4 9 8 7 6 5 10 11 12 13 14 19 18 17 16 15 20 21 22 23 24]
let weighted-dist 0
( foreach ( but-last oldList ) ( but-first oldList ) [
[ a b ] ->
ask turtle a [
let node-link link-with turtle b
;Then retrieve weight link to do adding
]
] )
print weighted-dist
end
enter image description here
The S is my starting point (25 in the list) and E is end (24 in the list) I wanted to calculate the weight of this "orange path"
Jen's answer about how to get the weight of a link is correct, but I would suggest an alternative way of computing the sum of these weights: using the sum primitive!
This requires turning your foreach into a map, but aside from that, it's pretty straightforward:
let weighted-dist sum (map [ [a b] ->
[ [ weight ] of link-with turtle b ] of turtle a
] (but-last oldList) (but-first oldList))
Another small comment: using a list of who numbers might not be the best way to approach things, but I don't know enough about your problem to suggest an alternative...
Assuming you called the weight weight (in your links-own statement that you haven't shown) then something like this should work:
to calculate-oldpath
let oldList [ 25 0 1 2 3 4 9 8 7 6 5 10 11 12 13 14 19 18 17 16 15 20 21 22 23 24]
let weighted-dist 0
( foreach ( but-last oldList ) ( but-first oldList ) [
[ a b ] ->
ask turtle a [
let node-link link-with turtle b
set weighted-dist weighted-dist + [weight] of node-link
]
] )
print weighted-dist
end
Getting the attribute value for a link is exactly the same as getting the attribute value for a turtle or patch, you use of
Matlab crashes (closes) when I try to plot a 3D function of the like z=(x,y), whenever the function involves the following conditions together:
incorrect multiplication and power notation: e.g. x*y^2 instead of x.*y.^2
x,y support grid very small: e.g. meshgrid(0.01:.01:0.99)
For example, the following code doesn't work:
[x,y] = meshgrid(0.01:.01:0.99);
z=x*y^2;
surf(z)
Same happens if I use mesh instead of surf. Normally, you would expect an error about the notation.
It seems to be a bug of Matlab. An automatic crash report contain this:
------------------------------------------------------------------------
Illegal instruction detected at Fri Aug 7 15:59:56 2015
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Crash Mode : continue (default)
Current Graphics Driver: ATI Technologies Inc. AMD Radeon HD 8400 / R3 Series Version 4.4.13374 Compatibility Profile Context 15.20.1013
Current Visual : 0x23 (class 4, depth 24)
Default Encoding : UTF-8
GNU C Library : 2.19 stable
Host Name : -------
MATLAB Architecture : glnxa64
MATLAB Root : /usr/local/MATLAB/R2015a
MATLAB Version : 8.5.0.197613 (R2015a)
OpenGL : hardware
Operating System : Linux 3.16.0-45-generic #60~14.04.1-Ubuntu SMP Fri Jul 24 21:16:23 UTC 2015 x86_64
Processor ID : x86 Family 127 Model 0 Stepping 1, AuthenticAMD
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : The X.Org Foundation (11600000), display :0.0
Fault Count: 4
Abnormal termination:
Illegal instruction
Register State (from fault):
RAX = 00007feb4c01b000 RBX = 00007feb4c01e000
RCX = 0000000000000010 RDX = 00007febabd64e80
RSP = 00007feb20d48400 RBP = 0000000000000018
RSI = 0000000000000000 RDI = 00007feb20d484d0
R8 = 0000000000000400 R9 = 00007feb4c01e000
R10 = 0000000000000948 R11 = 0000000000000318
R12 = 0000000000000020 R13 = 0000000000000018
R14 = 0000000000000040 R15 = 0000000000000020
RIP = 00007feb0bf47e02 EFL = 0000000000010216
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00007feb0bf47e02 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+30535170 mkl_blas_cnr_def_dgemm_kernel_bdz+00000210
[ 1] 0x00007feb0bf3f665 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+30500453 mkl_blas_cnr_def_xdgemm_bdz+00001381
[ 2] 0x00007feb0a4dbe4f /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02829903 mkl_blas_dgemm_2d_bsrc+00000527
[ 3] 0x00007feb0a4d709e /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02810014
[ 4] 0x00007febb8bd3623 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00558627 __kmp_invoke_microtask+00000147
[ 5] 0x00007febb8babf64 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00397156
[ 6] 0x00007febb8baae02 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00392706
[ 7] 0x00007febb8bd38d9 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00559321
[ 8] 0x00007febcd62f182 /lib/x86_64-linux-gnu/libpthread.so.0+00033154
[ 9] 0x00007febcd35c47d /lib/x86_64-linux-gnu/libc.so.6+01025149 clone+00000109
[ 10] 0x0000000000000000 <unknown-module>+00000000
Abnormal termination:
Illegal instruction
Register State (from fault):
RAX = 00007febabd95000 RBX = 00007febabd97000
RCX = 0000000000000010 RDX = 00007febabd64c40
RSP = 00007febb7ea4d00 RBP = 0000000000000018
RSI = 0000000000000000 RDI = 00007febb7ea4dd0
R8 = 0000000000000400 R9 = 00007febabd97000
R10 = 0000000000000948 R11 = 0000000000000318
R12 = 0000000000000020 R13 = 0000000000000018
R14 = 0000000000000040 R15 = 0000000000000020
RIP = 00007feb0bf47e02 EFL = 0000000000010216
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00007feb0bf47e02 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+30535170 mkl_blas_cnr_def_dgemm_kernel_bdz+00000210
[ 1] 0x00007feb0bf3f665 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+30500453 mkl_blas_cnr_def_xdgemm_bdz+00001381
[ 2] 0x00007feb0a4dbe4f /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02829903 mkl_blas_dgemm_2d_bsrc+00000527
[ 3] 0x00007feb0a4d709e /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02810014
[ 4] 0x00007febb8bd3623 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00558627 __kmp_invoke_microtask+00000147
[ 5] 0x00007febb8babf64 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00397156
[ 6] 0x00007febb8bad26a /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00402026 __kmp_fork_call+00004474
[ 7] 0x00007febb8b8c2e8 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00266984 __kmpc_fork_call+00000200
[ 8] 0x00007feb0a4d6cf0 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02809072
[ 9] 0x00007feb0a4d2db3 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02792883 mkl_blas_dgemm+00001475
[ 10] 0x00007feb0a9d23b2 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+08033202 mkl_lapack_dgehrd+00001826
[ 11] 0x00007feb0a9d65a2 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+08050082 mkl_lapack_dgeevx+00002706
[ 12] 0x00007feb0a350537 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+01209655 dgeevx_+00000327
[ 13] 0x00007feb32addf04 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmathlinalg.so+01310468
[ 14] 0x00007feb32adc875 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmathlinalg.so+01304693
[ 15] 0x00007feb32a6b4a2 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmathlinalg.so+00840866
[ 16] 0x00007feb32a6b83e /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmathlinalg.so+00841790
[ 17] 0x00007febc217d305 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00557829
[ 18] 0x00007febc2164744 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00456516 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000244
[ 19] 0x00007febc142bd20 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04189472
[ 20] 0x00007febc13db432 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03859506
[ 21] 0x00007febc13dd612 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03868178
[ 22] 0x00007febc13e3597 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03892631
[ 23] 0x00007febc13decff /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03874047
[ 24] 0x00007febc13df934 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03877172
[ 25] 0x00007febc14552ce /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04358862
[ 26] 0x00007febc21bbaea /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00813802 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00000762
[ 27] 0x00007febc21bbfb0 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00815024 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000032
[ 28] 0x00007febb52e8edd /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02473693
[ 29] 0x00007febb527e5c2 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02037186
[ 30] 0x00007febb527fddf /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02043359
[ 31] 0x00007febb52858e0 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02066656
[ 32] 0x00007febb5281053 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02048083
[ 33] 0x00007febb52efbb6 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02501558
[ 34] 0x00007febb537471b /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+03045147
[ 35] 0x00007febc2164744 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00456516 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000244
[ 36] 0x00007febb5372451 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+03036241
[ 37] 0x00007feb32a9737c /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmathlinalg.so+01020796
[ 38] 0x00007febc217d305 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00557829
[ 39] 0x00007febc2164744 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00456516 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000244
[ 40] 0x00007febc154dfee /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+05378030
[ 41] 0x00007febc147ca71 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04520561
[ 42] 0x00007febc147d7ee /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04524014
[ 43] 0x00007febc1489619 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04572697
[ 44] 0x00007febc1489783 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04573059
[ 45] 0x00007febc15c0b54 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+05847892
[ 46] 0x00007febc13dd9b9 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03869113
[ 47] 0x00007febc13e3597 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03892631
[ 48] 0x00007febc13decff /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03874047
[ 49] 0x00007febc13df934 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03877172
[ 50] 0x00007febc14552ce /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04358862
[ 51] 0x00007febc21bbc39 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00814137 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00001097
[ 52] 0x00007febc21bbfb0 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00815024 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000032
[ 53] 0x00007febc142bd20 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04189472
[ 54] 0x00007febc13ac4b3 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03667123
[ 55] 0x00007febc13dc6ee /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03864302
[ 56] 0x00007febc13e3597 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03892631
[ 57] 0x00007febc13decff /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03874047
[ 58] 0x00007febc13df934 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03877172
[ 59] 0x00007febc14552ce /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04358862
[ 60] 0x00007febc21bbc39 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00814137 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00001097
[ 61] 0x00007febc21bbfb0 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00815024 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000032
[ 62] 0x00007febc1414495 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04093077
[ 63] 0x00007febc13d4fb9 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03833785
[ 64] 0x00007febc13d13f5 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03818485
[ 65] 0x00007febc13d1ad3 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03820243
[ 66] 0x00007febc30c7b6c /usr/local/MATLAB/R2015a/bin/glnxa64/libmwbridge.so+00228204
[ 67] 0x00007febc30c8751 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwbridge.so+00231249 _Z8mnParserv+00000737
[ 68] 0x00007febce7cc3af /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00799663 _ZN11mcrInstance30mnParser_on_interpreter_threadEv+00000031
[ 69] 0x00007febce7ac133 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00667955
[ 70] 0x00007febce7adfd9 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00675801 _ZN5boost6detail11task_objectIvNS_3_bi6bind_tIvPFvRKNS_8functionIFvvEEEENS2_5list1INS2_5valueIS6_EEEEEEE6do_runEv+00000025
[ 71] 0x00007febce7ae9a7 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00678311 _ZN5boost6detail9task_baseIvE3runEv+00000071
[ 72] 0x00007febce7aea07 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00678407
[ 73] 0x00007febce7a9d8a /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00658826
[ 74] 0x00007febc0767a56 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwuix.so+00334422
[ 75] 0x00007febc074f3a2 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwuix.so+00234402
[ 76] 0x00007febcef9af1f /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02621215
[ 77] 0x00007febcef9b08c /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02621580
[ 78] 0x00007febcef9cbdf /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02628575
[ 79] 0x00007febcef9d61c /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02631196 _Z25svWS_ProcessPendingEventsiib+00000092
[ 80] 0x00007febce7aa408 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00660488
[ 81] 0x00007febce7aa724 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00661284
[ 82] 0x00007febce796b0d /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00580365
[ 83] 0x00007febcd62f182 /lib/x86_64-linux-gnu/libpthread.so.0+00033154
[ 84] 0x00007febcd35c47d /lib/x86_64-linux-gnu/libc.so.6+01025149 clone+00000109
[ 85] 0x0000000000000000 <unknown-module>+00000000
Abnormal termination
If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
Thank you for your help.
In suggestion from this forum, I submitted a service request. Clearly, I solved my problem by using the correct dot notation. Yet, regardless of any wrong notation, Matlab should not crash. I will update this post once I receive further information and either delete or answer this question.
I have a polynomial like this one:
p := -1.604609130*10^(-11)*z^9+.1111140258*z^8+3.210741142*10^(-11)*z^7-.3955586214*z^6-2.108471910*10^(-11)*z^5+.6692726719*z^4+5.024523477*10^(-12)*z^3-.8174429322*z^2-3.142106870*10^(-13)*z+.9089252367
You see, just a regular polynomial with numeric coefficients. Then I call coeffs on it and get this:
> coeffs(p, z, 't'); t
-11
0.9089252367, -0.3955586214, -2.108471910 10 , 0.6692726719,
-12 -11
5.024523477 10 , -0.8174429322, -1.604609130 10 ,
-11 -13
0.1111140258, 3.210741142 10 , -3.142106870 10
6 5 4 3 2 9 8 7
1, z , z , z , z , z , z , z , z , z
Why on Earth it returns coefficients in such order?! I would expect it to be either from higher powers to lower powers (like in MATLAB) or from lower powers to higher powers (like in Mathematica), but Maple does something absolutely weird. My program depends on the order of coefficients extracted by coeffs, so I just can't use it.
Is there a way in Maple to extract coefficients in some sane order?
You should use the CoefficientList or CoefficientVector commands for this.
Note the comments about efficiency relative to using coeffs for this, in that help page.
Those commands also have an option for returning the coefficients in reverse order.
restart:
p := -1.604609130*10^(-11)*z^9 + .1111140258*z^8 + 3.210741142*10^(-11)*z^7
-.3955586214*z^6 - 2.108471910*10^(-11)*z^5 + .6692726719*z^4
+ 5.024523477*10^(-12)*z^3 - .8174429322*z^2 - 3.142106870*10^(-13)*z
+ .9089252367:
V := PolynomialTools:-CoefficientVector( p, z );
[ 0.9089252367]
[ ]
[ -13]
[-3.142106870 10 ]
[ ]
[ -0.8174429322]
[ ]
[ -12]
[ 5.024523477 10 ]
[ ]
[ 0.6692726719]
[ ]
V := [ -11]
[-2.108471910 10 ]
[ ]
[ -0.3955586214]
[ ]
[ -11]
[ 3.210741142 10 ]
[ ]
[ 0.1111140258]
[ ]
[ -11]
[-1.604609130 10 ]
L := PolynomialTools:-CoefficientList( p, z );
[ -13 -12
L := [0.9089252367, -3.142106870 10 , -0.8174429322, 5.024523477 10 ,
-11 -11
0.6692726719, -2.108471910 10 , -0.3955586214, 3.210741142 10 ,
-11]
0.1111140258, -1.604609130 10 ]