1
vote
0answers
10 views

Optimization of recursive functions by using the //. operator

In some cases, recursion in Mathematica (without storing values) is not very efficient. For example, the recursive implementation of Fibonacci numbers (version which doesn't store the values) : ...
0
votes
0answers
55 views

Creating a function that uses another function as an argument

I'm new to Mathematica and found a couple questions that were the same as mine but they did not help as much. I'm trying to create a function that evaluates another function and uses that value. ...
5
votes
1answer
35 views
0
votes
0answers
31 views

Undocumented function SumOfSquaresReps

There is an interesting (and documented) number-theoretic function in MMA called PowersRepresentations[$n$, $k$, $p$]. It gives the distinct representations of the integer $n$ as a sum of $k$ ...
2
votes
3answers
34 views

Simples exercise using the function Cases (beginner question)

I'm having some trouble in the following exercise: Find which elements of the list are prime numbers or divisible by 3. list = Table[i^2 - 6 i - 1, {i, 0, 15}] ...
0
votes
1answer
85 views

Binomial Regression where n > 1

I am not well versed in Generalized Linear Models, but am trying to use this approach to model some discrete data. I have binomial data where the sample size for each observation is the same size, ...
13
votes
6answers
324 views

How can I mix the behaviors of StringReplace and ReplaceAll in a single rule?

I'm trying to take a list of the form { {"65 + 3 months", 75}, {"65 + 4 months", 75.1} }, and transform the string part to a number such as 65.25 or 65.333, ...
2
votes
2answers
94 views

Combination of interpolations doesn't work?

I have tables of function values f[i_] and g[i_] and I need to plot various combinations of the function and its derivatives ...
1
vote
0answers
9 views

VS c# NetLink - pictureBox - MathCommand

Has anyone experiance or a running example how to use within VS C# the NetLink.UI pictureBox to plot graphics, especially using the pictureBox - "MathCommand"
1
vote
2answers
64 views

My evaluation is taking a lot of time

I was evaluating the roots of a transcendental equation, when I noticed that Mathematica never finishes but stays in the running state. The following is the code that I was using: ...
0
votes
0answers
6 views

Programatically align text in the Front End

One can select a cell and using the Front End menu perform Format -> Text Alignment -> Align at 25% Other options are given as well. I have learned from Stack Exchange how to create a button and ...
5
votes
2answers
212 views

Time Zone Conversion

I use Mathematica to administer my share depots. The depots contain shares of many different time zones. I update the depot values several times a day. My problem is that Sidney, Australia, (it might ...
4
votes
0answers
45 views

Visualising a 1-(50,15,15) design

The problem I have is the visualisation of a $1-(50,15,15)$ design. That is a set of $50$ points and $50$ blocks (lines), so that each point is on $15$ lines, and each line contains $15$ points. My ...
2
votes
2answers
88 views

How to deduce the Ramanujan's summation of this series?

I have already asked a similar question about Ramanujan's summation in general but received no good answers. Now I am interested in this exact series: $$\sum _{n\ge1}^\Re (24 n + 12 n^2)$$
3
votes
3answers
82 views

Calculating expected value from paired values and weights

I'm very new to Mathematica. I just need a quick solution on how to multiply x with y when a data set is given as ...
4
votes
1answer
45 views

How to close all tagged input cells winout closing their output cells?

I have tagged certain Input cells I want to be closed during a presentation. I close them as follows: ...
5
votes
2answers
204 views

Labels strangely rendered in PDF

I'm new to Mathematica so I apologize if this is obvious to answer. Anyway, using the following code (most of it is extraneous, to make the plot look the way I want) I plotted the Morse potential, ...
0
votes
0answers
9 views

InteractiveTradingChart not working inside Dynamic

I would like to have an interactive trading chart that updates by changing the input stock. But anytime a dynamic is wrapped around the function, it doesn't manage to initialize. Is there any way to ...
0
votes
1answer
39 views

Remove color artifacts in overlay of several Graphics objects?

I am trying to create an animation with a graphic of an arm that can bend at the elbow. For this purpose I created the following two images: hand1 and hand2. I load the images with ...
30
votes
4answers
5k views

Finding all shortest paths between two vertices

The built-in FindShortestPath and GraphDistance functions find the shortest path between two particular vertices in a graph. I ...
365
votes
13answers
78k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
0
votes
0answers
16 views

Decouple 3 simultaneous 2nd order ODEs (of 3 dependent variables)

I have three simultaneous ODEs with coupled dependent variables. I was wondering whether there's a way for Mathematica to decouple these equations (into three ODEs of a single dependent variable ...
2
votes
2answers
102 views
0
votes
1answer
90 views

Reduction of an Inequality in $\mathbb{C}$

Reduce[ Abs[-((4 p)/(-1 + Sqrt[1 + 4 p + 4 q])^2)] + Abs[-((4 q)/(-1 + Sqrt[1 + 4 p + 4 q])^2)] < 1 , Abs[p]] It is taking lot of time. It is running. Can ...
0
votes
0answers
5 views

Coupled partial diffential equation, with boundaries specification [migrated]

Please, help me to find a books or samples to learn how to solve such coupled equations $$\frac{\partial T_1(x,t)}{\partial t}&= \alpha_1 \frac{\partial^2 T_1(x,t)}{ \partial x^2} +f(x) ...
-1
votes
1answer
30 views

How to create pairwise difference matrix entry?

I have a $16\times 1$ array of integer entries named $H$. How do I create a $16\times 16$ pairwise difference matrix between all entries in array?
0
votes
0answers
66 views

NIntegrate unexpectedly returns complex number [on hold]

I am attempting to visualise the effect of shifting parameter $\gamma$ on the 3-parameter log-normal distribution. $$pdf(x;\mu,\sigma,\gamma) = ...
8
votes
1answer
80 views

How to partition a 2-D array properly?

Given that I have the following array lst = Array[Subscript[P, #1, #2] &, {5, 5}, {0, 0}] $ \left( \begin{array}{ccccc} P_{0,0} & P_{0,1} & P_{0,2} ...
10
votes
2answers
96 views

How to properly generate messages from LibraryLink function?

I'm currently using WolframLibraryData::Message to generate messages from a library function, like this: ...
8
votes
0answers
192 views

How to write markdown with Mathematica?

Usually I typeset with Latex and Compute with Mathematica and then copy the outputs as Latex code and insert them in Latex, so I have to switch between Latex and Mathematica frequently. Thanks to the ...
1
vote
1answer
66 views

How to create a vertical (smooth) Histogram on the y-axis of a function graph for an uncertain x?

This is my first time posting a question in StackExchange. I have encountered a certain problem and I can't seem too find a solution. Just a word of caution, I am kind of an amateur when it comes to ...
1
vote
2answers
64 views

How to use the output we see of expression when this expression is inside Dynamic

Consider this example: Manipulate[status = Dynamic[If[a < b, Yes, No]], {a, 2}, {b, 5}] The output of this calculation is ...
4
votes
2answers
120 views

Different results with Plot option “Evaluated” in V9 and V10

Consider this example: Plot[Table[BesselJ[n, x], {n, 2}], {x, 0, 10}, PlotLegends -> {"n=1", "n=2"}, Evaluated -> True] The results in MMA v9 & V10 ...
2
votes
1answer
116 views

IntegerQ and Element Integers give different results in one case

f1[x_] := IntegerQ[x] f2[x_] := Element[x, Integers] Both functions give identical results in everything except for such case: ...
0
votes
3answers
102 views

Complement[] changes order of elements?

Consider this example: Complement[{a, y, c, d, e}, {a, c}, {d}] (*{e, y}*) However, I was expecting the result to be: ...
6
votes
2answers
341 views

How to find valleys of data using new function in V10 PeakDetect

One of the great new function in V10 is PeakDetect. It can detect peaks according to desired sharpness as shown in this example: ...
7
votes
4answers
830 views

How to find all data points within closed curve

I want to find all data points inside curve as given below: ...
2
votes
3answers
64 views

Removing an ordered pair from a list of ordered pairs according to a certain criterion

I have a list of ordered pairs produced by evaluating {IsotopeData["Thorium226", "ExcitedStateEnergies"], IsotopeData["Thorium226", "ExcitedStateSpins"]} I'm ...
7
votes
2answers
204 views

Built in function without Attributes Listable works as if it has Attributes Listable

Can Built-in function works as if it has Attributes Listable even if it doesn't have that ...
7
votes
2answers
295 views

Creating “detached” plots

Is it possible to create detached interactive plots in Mathematica like those in Matlab, Jupyter (IPython), rather than inline ones? This is interactive GIF from Rodeo IDE for Python as an example, ...
0
votes
1answer
42 views

Part of longer code has an error - how can I debug?

Please can someone help me locate the problem? ...
3
votes
1answer
67 views

How to specify that Quiet should silence foo::shdw messages for ANY symbol foo?

I have some package code that does rather complex multi-context evaluation, and I know it's going to throw warnings about shadowed symbols. The shadowing isn't actually a problem. For the end-user's ...
4
votes
0answers
57 views

Color degrades when using Copy As Bitmap

I have discovered a problem that affects my use of Mathematica. When I use the menu command Edit > Copy As > Bitmap the colors in the copy are subtly degraded. To make this more apparent I copied ...
0
votes
0answers
34 views

Points on discriminant variety?

I am trying to find a way in Mathematica to compute points on discriminant variety for modest size systems, but I couldn't find one. The system is something like: ...
0
votes
0answers
29 views

Nested optimization (in a dynamic game) [on hold]

I have a dynamic game in two stages with two players. The solution of this game requires first to find the Nash equilibrium in stage 1 with correct expectations of the decisions taken at stage 2. At ...
0
votes
1answer
33 views

No names when loading package

I want to use mu own package. This is the procedure I take: 1) In Mathematica notebook I put the following code taken from code ...
2
votes
1answer
47 views

How to make a cell highlight on mouse down?

When a cell has WholeCellGroupOpener set to True, it becomes a clickable button that toggles its cell group open and closed. How can I make the cell change color ...
0
votes
1answer
33 views

Plot data with x and y ErrorBars from file [duplicate]

If I have a set of data like this one saved in a dat file ...
0
votes
0answers
38 views

Fill the gap between two consecutive sphere with different colors [duplicate]

I wanted to shows the radial density (thickness 1) with different color such that dark color shows for lower radius and light color for higher radius. The gap between concentric sphere should be ...

15 30 50 per page