« first day (2431 days earlier)      last day (2043 days later) » 

12:08 AM
@b3m2a1 I'm really not using Python at all.
 
 
10 hours later…
9:48 AM
@Szabolcs calling python from Mathematica is almost done but I'm afraid I might not have time to fully debug until next week. There were two more classes I had to move over (Reader.java and StdLink.java) which implement a listener thread, essentially. I wasn't sure how best to handle the called evaluations, so I'm trying a thing that passes python symbolic structures and has it intelligently build an exec string (where the data is first bound as variables in the passed local env).
It seems promising to me as it means we can basically just write Mathematica code and have it be almost automatically translated into python syntax. I also am including a more basic EvalString method which will be less data efficient but potentially more user friendly.
 
Are the atomic expressions the same as atomic objects?
 
@vasili111 Atomic things are the ones that give True when you call AtomQ on them.
 
@halirutan Yes, I know that. I am asking about terms. Is the term "atomic expression" same as term "atomic object"?
 
@vasili111 Mathematica only has expressions. It doesn't have objects in the oop sense.
 
Basically, the word "expression" is misleading but it's used nevertheless. Usually, expressions are things that have a structure you can access. This is not (should not be) true for atoms. Atoms can have an internal structure like graphs or images, but they are opaque to the user.
 
9:58 AM
@b3m2a1 here: reference.wolfram.com/language/tutorial/BasicObjects.html is used term "Atomic object". In book "Essentials of Programming in Mathematica" I also found term "Atomic expression".
 
Just consider that both mean the same thing.
 
@halirutan thank you :)
 
If you want to make a distinction for yourself, then you should regard things like String, Integer, Real, Symbol as true atomic, while graphs are only made atomic to improve performance.
And if you want to see an upset Steven Wolfram, just watch the latest Twitch stream 136 (as soon as it is available) about annotations. He discovers in the middle how you are supposed to mutate graphs. It's hilarious and it seems he wasn't aware of this :)
 
@halirutan Are you sure that graphs are atomic? In book and tutorial I read that only numbers, symbols and strings are atomic.
 
@vasili111 The weren't in the past, but they are now.
Just try:
graph = Graph[{1 <-> 2, 2 <-> 3, 3 <-> 1}];
graph[[1]]
 
10:04 AM
@halirutan Anything other that was not before also become atomic?
@halirutan yes it shows true on AtomQ :)
@halirutan Also was not aware that Steven Wolfram was streaming on twitch :) I will watch his videos :)
 
@vasili111 AtomQ@<|"a" -> 1|> etc: mathematica.stackexchange.com/q/46850/5478
 
@Kuba Nice list. It seams that tutorial and book is outdated on that subject.
 
@vasili111 yes, atoms deserve not only an official listing but a good documentation,
didn't happen so far.
 
10:25 AM
@Kuba found a good list of links to undocumented features. mathematica.stackexchange.com/questions/805/… It seems many things are undocumented.
 
10:50 AM
@vasili111 sure, that is expected. But since atoms are a growing part of top level features one could expect to be able to learn how to create them etc.
 
 
2 hours later…
1:18 PM
@Szabolcs more progress (the plain old PyEvaluate is being buggy but I'll get it working):
That last line is the real reason to be happy here
 
1:39 PM
Looks great!
And yes: it's not easy to get it working, but what's really hard is to get it to work well (e.g. handle packed arrays)
When you have time, can you include some minimal "getting started" instructions?
 
@vasili111 @halirutan Graph has always been atomic. It's Image that used to be compound but is now atomic.
@vasili111 Also, "atomic" in practice only means that not all the standard behaviours of compound expression are present. Some may still work. The internal implementation may still use at least some compound expressions.
Also, all but the most fundamental atomic types have compound representations.
E.g. MathLink/WSTP only supports transferring a few atomic types such as symbols, strings and numbers. All the rest are handled by first converting to a compound representation. This applies to Graph, Image, Dataset, SparseArray, etc.
 
3:34 PM
Has anyone implemented a general method to animate 3D graphics and still be able to rotate it while the animation is running? (I want to do this with a MeshRegion and change its MeshCoordinates only)
 
@Szabolcs My belief was that in the old GraphUtilities everything was still a real expression. But I see now that it didn't have a real Graph, it only acted on the list of graph rules.
 
Yes, it didn't have Graph
 
 
2 hours later…
5:54 PM
@Szabolcs once I get a bit more debug work in I'll do that. I'm figuring I'll work it from two ends: a setup.py for the python side and a PacletInfo.m for Mathematica (I already have the latter). Either side can be the main process in this setup.
 
 
2 hours later…
7:30 PM
@Szabolcs finally got proper Mathematica <-> python code working. It takes a few seconds to move a 100x100x100 array which means I should check my code to make sure I'm doing things optimally, but at the very least it works.
PyEvaluate is HoldFirst so we need to do some code injection. The TimeConstraint prevents the kernel from seizing up if the link dies (I tried to get all python exceptions to return as a PythonTraceback object but it seems to only work ~50% of the time and I can't figure out why).
Basic setup instructions are coming once I know exactly what's required to get it working
 
I'm sure this is a solved problem,
string = {"E:\\job\\a\\000251.png", "E:\\job\\a\\000252.png",
  "E:\\job\\a\\000253.png", "E:\\job\\a\\000254.png",
  "E:\\job\\a\\000255.png", "E:\\job\\a\\000256.png"}
I want to plus 2 into the file base name when the base name is even.
I mean I want to get such result:
string = {"E:\\job\\a\\000251.png", "E:\\job\\a\\000254.png",
  "E:\\job\\a\\000253.png", "E:\\job\\a\\000256.png",
  "E:\\job\\a\\000255.png", "E:\\job\\a\\000258.png"}
How to implement it?
I mean the -5th string {"2","4","6"} is even digital. Now I want to plus 2 into it.
Help here, please..
0
Q: How to replace the string with certain character

yodeI have a long string list: string = {"E:\\job\\a\\000251.png", "E:\\job\\a\\000252.png", "E:\\job\\a\\000253.png", "E:\\job\\a\\000254.png", "E:\\job\\a\\000255.png", "E:\\job\\a\\000256.png"} Now I want to plus 2 into the file base name when the file base name is even digital. I mean I wa...

 
8:24 PM
@kglr Hi
You use NumberString ~~ "." to locate the last digit.
Could I use the information it is in the -5th?
If I can, how to locate it with this position?
 
hi @yode
 
hi
 
if the filenames are of fixed length then you can use StringTake.
 
Yes, it is fixed length.
@kglr What I have miss?
StringCases[string,
 a__ /; EvenQ[ToExpression[StringTake[a, {-5}]]] :>
  StringJoin[StringTake[a, {1, -6}],
   ToString[ToExpression[StringTake[a, {-5}]] + 2], ".png"]]
 
then you can do without "." using something like a:NumberString/;EvenQ[FromDigits[StringDrop[a,-1]]::...
yode it will take me a while to figure out why your code does not work
 
8:50 PM
Thanks anyway..:)
 
@yode You cannot use StringCases here. It expects a "string pattern" and when I see this right, it will test through all possible substrings.
Look here:
Cases[str,
 a_String /; EvenQ[ToExpression[StringTake[a, {-5}]]] :>
  StringJoin[StringTake[a, {1, -6}],
   ToString[ToExpression[StringTake[a, {-5}]] + 2], ".png"]]
 
9:30 PM
@halirutan Thanks..
 
 
2 hours later…
11:35 PM
@b3m2a1 My implementation takes 0.03 seconds for transfering a 100x100x100 float64 array.
 
@Kh40tiK yeah I'm thinking I'm unwrapping the object in an inefficient way. Either that or it's in the preprocessing stage.
It does end up coming out as an ndarray but it could unwrap first and then seekMark back
Oh lol it's all in the preprocessing
My Mathematica-to-python symbolic translation is clearly recursing even though I thought I told it not to.
 
@CarlWoll I don't understand this comment
Shouldn't "000258.png" -> "000260.png"? — Carl Woll 2 mins ago
 
@Kh40tiK It turns out it took 5.6 seconds to wrap that expression in my preprocessing code. So ~.1 s. Still slower, but 100% manageable.
 

« first day (2431 days earlier)      last day (2043 days later) »