2.27 Thursday, May 21, 2020

2.27.1 Top new questions this week
2.27.2 Greatest hits from previous weeks
2.27.3 Can you answer these questions?

2.27.1 Top new questions this week

How to clear all definitions matching f[1, ...] but not f[2, ...]?
Rescaling data to make a "continuous" function
Why does Mathematica ignore 1 as an exponent? Or as a coefficient?
How to add ’border’ to Voronoi diagram
Contracting indices in lists
How to extract all possible sub-products which match specific pattern?
Raytracing using Regions & NSolve

How to clear all definitions matching f[1, ...] but not f[2, ...]?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=222002

I would like to clear all definitions of the form f[1,...] in such a way that f[2,...] remain unaffected.

The two methods I know to clear variables don’t seem to apply to this situation:

Pattern

asked by WillG https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=59634 10 votes

answered by Simon Woods https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=862 15 votes

Rescaling data to make a "continuous" function

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=222252

I have acquired many sets of data, which all represent a single function, but which are randomly rescaled by a constant (due to the measurement specifics). I’m looking to effectively stitch them ...

asked by ChaSta https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=48457 9 votes

answered by aooiiii https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=68990 7 votes

Why does Mathematica ignore 1 as an exponent? Or as a coefficient?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=221934

Two different examples of same problem:

 
In: Cases[{f^2, g^3, k^p, h}, x_^n_ -> n] 
 
Out: {2,3,p}     # The result misses the exponen of h, '1'

The same problem in a different context:

asked by MaxB https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=66077 8 votes

answered by Nasser https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=70 11 votes

How to add ’border’ to Voronoi diagram

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=221984

Suppose I have a set of points pts, from which I generate a Voronoi diagram VD:

pts = RandomReal[{-1, 1}, {100, 2}]; 
VD = Show[VoronoiMesh[pts], Graphics[{Red, Point[pts]}]] 
 
Now, as per the  ...

asked by TumbiSapichu https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=53229 7 votes

answered by kglr https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=125 7 votes

Contracting indices in lists

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=222037

Using an answer to this question (Working with Dirac Gamma Matrices using FeynCalc - A simple problem), I defined

Clear[] 
SetAttributes[, Listable] 
[_] := If[ == 0, KroneckerProduct @@  ...

asked by FB20 https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=72314 6 votes

answered by Chanto https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=35091 4 votes

How to extract all possible sub-products which match specific pattern?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=222285

I have an expression of the form

expr = 3*(a.b)*(c.d)*f[x] + 5*(m.n)*(p.q)*(r.s)*f[y] 
 
and want to extract all possible subexpressions matching the pattern ((_).(_))*f[_]. 
Expected result (in  ...

asked by Shadowray https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=47416 6 votes

answered by Marius Ladegård Meyer https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=22099 7 votes

Raytracing using Regions & NSolve

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=222105

I want to use geometric shapes in Mathematica to build complex shapes and use my raytracing algorithm on it. I have a working example where we can get the intersections from a combination of a Cone[] ...

asked by Tomi https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=36939 6 votes

answered by Tim Laska https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=61809 5 votes

2.27.2 Greatest hits from previous weeks

Help find a bright object on Mars!
Figuring when the minute and hour hand coincide on a clock
How to perform a multi-peak fitting?
Using Export[] sends the file where?
Can Mathematica do symbolic linear algebra?
Assign the results from a Solve to variable(s)
Creating a table/Matrix during a For loop

Help find a bright object on Mars!

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=11819

In today’s news, scientists found a bright object on one of Curiosity’s photos (it’s near the bottom of the picture below). It’s a bit tricky to find - I actually spent quite some time staring at the ...

asked by Victor K. https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=1351 197 votes

answered by Niki Estner https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=242 255 votes

Figuring when the minute and hour hand coincide on a clock

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=573

I would like to list all possible times in a 12-hour period, where the hour hand overlaps the minute hand completely. This is really a question about three distinct things - to be done in Mathematica ...

asked by Steve D https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=191 15 votes

answered by Verbeia https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=8 21 votes

How to perform a multi-peak fitting?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=26336

I am wondering how to implement the multi-peak detecting and fitting in Mathematica. Following is an example of fitting the data using three peaks (such that the data ~ peak1 + peak2 + peak3).

asked by Everett You https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=1389 54 votes

answered by Silvia https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=17 54 votes

Using Export[] sends the file where?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=8586

I am trying to use the Export command to convert a list of plots into a *.gif file, and the command runs and executes well, but I can’t find the file! Where is it supposed to go? Did it even work?

asked by Patrick Da Silva https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=1785 37 votes

answered by Vitaliy Kaurov https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=13 49 votes

Can Mathematica do symbolic linear algebra?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=3242

For instance, is there some way I can say "let A and B be arbitrary real \(m\times n\) and \(k\times m\) matrices, Simplify[Transpose[Transpose[A].Transpose[B]]]" and Mathematica would simplify it to B.A?

asked by Niki Estner https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=242 61 votes

Assign the results from a Solve to variable(s)

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=6669

I understand Mathematica can’t assign the results of a Solve to the unknowns because there may be more than 1 solution. How can I assign the 4 values of following result to variables?

asked by stevenvh https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=1450 52 votes

answered by Artes https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=184 33 votes

Creating a table/Matrix during a For loop

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=2930

I have a For loop (with i as a counter), which calculates different values (y1, y2, y3,...) as a function of the variable x. How can I create a table/matrix which contains i lines, each line ...

asked by Solarboy https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=727 10 votes

answered by Mr.Wizard https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=121 14 votes

2.27.3 Can you answer these questions?

Computations with OptimizedExpressions without completely expanding them
LeviCivitaTensor contraction indices
Using Fold[ or Map[ Better?

Computations with OptimizedExpressions without completely expanding them

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=221938

I have to manipulate huge expressions that are rational functions of many (30) variables with integer coefficients. Storing them just as a ratio of two polynomials would be impractical. But they can ...

asked by Vladimir Reshetnikov https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=7288 2 votes

LeviCivitaTensor contraction indices

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=222179

apparently my computer has problems when I try to perform a calculation with TensorContract.

In particular, with the second answer to my previous question Contracting indices in lists, I want to ...

asked by FB20 https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=72314 1 vote

Using Fold[ or Map[ Better?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=221941

I’m working through MMA Cookbook by Mangano, page 54. He shows Map is a compact form of Fold function. Is using Fold function important?

myMap3[f_, l_] := Fold[Prepend[#1, f[#2]]&, {}, l]

asked by code9910743 https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=59860 2 votes