1
vote
2answers
117 views

Why do I get two different results from StringLength?

I spent a reasonable amount of time to find the origin of an error in a larger code segment. ...
3
votes
2answers
704 views

How to generate a 3-d simple cubic lattice of length 4 in each dimension?

LatticeData["SimpleCubic", "Image"] The above line gives me a single cube (2 lattice points in each direction). But I want a lattice with 4 lattice points in ...
3
votes
0answers
94 views

Highlighting bracketing in Mathematica [duplicate]

I'm working with lists of lists of lists. Each box with information has a specific format like information = {{a},{{b}},{{{c},{d}},{e,{f}}},{g}} and so ...
6
votes
2answers
256 views

How can I convert this ListPlot to ArrayPlot?

I want to rewrite this code with ArrayPlot, ...
4
votes
1answer
104 views

Replacing a combination of terms

I have a quite simple question. I have an expression that looks similar to $T=\frac{1}{a_1}-\frac{1}{a_2}+1$ and I'd like Mathematica to use $A=\frac{a_1}{a_2}$ to reformat the expression (if ...
4
votes
1answer
201 views

Reproducing a graphic on Jensen's inequality for the probabilistic case

I am trying to reproduce the following graph on Jensen's inequality for the probabilistic case (source: wikipedia) but with the exponential function as Y, the normal distribution on the X-axis and ...
2
votes
1answer
196 views

Can I reduce a matrix inequality such as $\mathbf x^\prime\mathbf A\mathbf x > \mathbf x^\prime\mathbf x$?

I'm new to Mathematica. When I do linear algebra, I wonder if I can have an inequality such as $\mathbf x^\prime\mathbf A\mathbf x > \mathbf x^\prime\mathbf x$, where $\mathbf x$ is a column vector ...
2
votes
1answer
142 views

Discard functions with wrong symmetry?

I have functions of x, where x is the polar angle of spherical coordinates, i.e. ...
1
vote
2answers
153 views

How to incorporate functions within Do Loops

I'm attempting to repeatedly perform a simple algorithm with incremental changes of a parameter. I can easily express my changing parameter: ...
2
votes
1answer
192 views

Can my permutations function be defined using iteration?

I have two functions, tuples and perm. They are similar. ...
14
votes
1answer
429 views

Creating a R DataFrame like construct in Mathematica

I kept getting my data mixed up so I decided to see if I could construct a package adding a R DataFrame like construct to Mathematica. I managed to cobble something together that sort of works, but ...
2
votes
1answer
96 views

Why is MenuCommandKey not working in my stylesheet?

Here is the cell style data for my custom version of Section: ...
1
vote
2answers
195 views

Discard ODE singular solutions with Mathematica?

The solution for a homogeneous second order linear ODE is generally a constant times one function plus another constant times a different function. Sometimes one of the solution functions is ...
6
votes
1answer
352 views

Can you fill in a closed curve? [duplicate]

Imagine I have a have a set of points that form a closed curve (or simply a circle), I normally just list plot these points and join the dots. However, I now have the need to fill in this closed ...
5
votes
1answer
143 views

Why does this pattern with Plus not work for numbers?

I have a very simple question about redefining basic built-in functions, such as Plus. I'm pretty sure someone must have asked a similar question around here, but I ...
8
votes
2answers
318 views

How can automatic ticks be made “outie”?

By default, FrameTicks stick into the data area in a way that is sometimes uncomfortable. ...
26
votes
2answers
1k views

Specific initial sample points for 3D plots

PlotPoints lets you determine how many sample points you want in each direction, but sometimes I want specific ones. For Plot ...
9
votes
5answers
287 views

How can I remove matching sublists from my list?

I want to use DeleteCases (or any appropriate function) to remove elements of a list, which in turn are lists of fixed size. The rule I wish to apply is that any ...
21
votes
3answers
443 views

How does one adjust ColorFunction quality independently of surface quality?

I have a function $f:\mathbb{C}\rightarrow\mathbb{C}$ which I would like to visualize by by plotting $|f|$ with Plot3D using $\operatorname{Arg}f$ as the ...
10
votes
1answer
140 views

Are formal characters like \[FormalA] to be used differently than other symbols?

I noticed that Mathematica has a set of special 'Formal' characters such as \[FormalA], \[FormalB] , etc.. In the front end, it ...
0
votes
1answer
172 views

Converting fractional output to decimal [closed]

This code ...
24
votes
3answers
401 views

FoldWhile and FoldWhileList

Mathematica has had NestWhile and NestWhileList for some time. But, to date, it has not implemented a built-in ...
6
votes
3answers
315 views

Delete elements from a list really fast

I have this bit of code that works, but it's very slow when there are 600k elements in the list: ...
0
votes
1answer
428 views

Setting boundary values of a second order differential equation

Not sure what is wrong with the boundary conditions for this problem: ...
2
votes
2answers
417 views

Solving set of non-linear simultaneous equations gives PolynomialGCD::lgrexp error - what next?

I'm trying to solve a set of six simultaneous non-linear equations to get a numerical answer using NSolve: ...
2
votes
2answers
323 views

Efficiently compute double sum

Is there a "Mathematica Way", like Map or Apply to compute the following double sum? $\sum_{i=1}^{N_1}\sum_{j=1}^{N_2} m_i n_j \, f(\tau_{i} \gamma_{j})$ I have already stored the lists ...
5
votes
1answer
128 views

Proper localization of variable names

In functions like NonlinearModelFit I need to specify parameters with a symbol name. If I localize these parameters they get cluttered in the output (e.g....
3
votes
2answers
167 views

Efficient way of setting up a rule

I tried to define a simple rule defining how λ acts on ψ[n]: myrule1 = λ ψ[n_] -> α[n + 1] ψ[n + 1]; The result I get is ...
2
votes
1answer
309 views

Using graphics primitives to draw a cross as inset in graphics

I would like to draw a cross as an inset in a Graphics environment. I tried the following: ...
5
votes
2answers
2k views

How do I make a 3DPlot using cylindrical coordinates?

I'm trying to plot a function of the form $z(r,\theta)$ where $r \in [0, R]$ for a finite R, $\theta \in [0,2\pi[$, and z is the third coordinate, a function of the first two. I couldn't find anything ...
0
votes
1answer
189 views

Plot result from the function of NDSolve

I have a solution that I got from NDSolve which are ua and uw. ...
8
votes
4answers
243 views

How do I place vertical GridLines in front of horizontal ones?

By default horizontal GridLines are placed in front of vertical GridLines: ...
5
votes
4answers
161 views

Performance: Collapsing repeated contiguous rows & cols from a matrix

In this answer I needed to remove contiguous zero-valued cols and rows from a matrix, leaving only two of them in place, no matter what the original number was. I made up this code: ...
2
votes
0answers
77 views
3
votes
2answers
146 views

Apply UpValues before Listability

I'm trying to modify Plus but am running into trouble with it being Listable: ...
1
vote
1answer
109 views

output format including complex numbers [closed]

I have the following output. How can I convert this unnecessarily long expression into a single result (like z=u+iv) ? $\frac{(\text{} (0.0000540641 +0. i)-(0.0000422121 -0.0000372664 i)) ...
0
votes
1answer
171 views

Create set of equations by replacing constant values

Say I have an equation: eq = ax + by + c == 0 and I want to run NSolve on a set of equations of this form, for example: ...
2
votes
1answer
81 views

Printing grouped cells

How can I print grouped cells with CellPrint ? The closest thing I have to what I want to do is this ...
5
votes
1answer
486 views

axis label and ticks alignment of ListPlot3D and Histogram3D

I have a question on axis label alignment of ListPlot3D and Histogram3D. These labels are not aligned with the axis of the view, but only horizontally. I have tried very hard to align them manually, ...
3
votes
2answers
639 views

How can I solve an equation with symbolic coefficients?

I want to try to solve the following a x^(17/6) - b x^2 - 1 == 0 where a and b are ...
0
votes
1answer
187 views

Subtracting results of NDSolve

I have 2 variables as a results from the NDSolve[] which are ua and uw. This is how I do it, ...
2
votes
2answers
239 views

Why can't FindInstance find a solution to this equation?

FindInstance[680 == 1/3 2^m (-1 + 4^v), {m, v}, Integers] FindInstance seems to be unable to find the integer solution $ {m = ...
13
votes
3answers
663 views

How to splice together several instances of InterpolatingFunction?

I have a set of InterpolatingFunction returned by NDSolve which are valid over different (but overall continuous) domains. How ...
2
votes
1answer
128 views

How can I calculate a limit with a free variable?

For example, when I evaluate Limit[(1 + x^n + (x^2/2)^n)^(1/n), n -> Infinity] Mathematica does not output any result. When I evaluate ...
9
votes
2answers
2k views

What does # mean in Mathematica?

I asked Mathematica to compute the following Solve[c (1-x)^2-x^(1/4) == 0, x] and it returned this: x = Root[#1^8 c^4 - 8 #1^7 c^4 + 28 #1^6 c^4 - 56 #1^5 ...
4
votes
1answer
333 views

Differential Equations with Matrices

I'm trying to implement the differential equation of a Cellular Neural Network in Mathematica as seen below: ...
7
votes
3answers
171 views

How to define a package without adding it to $ContextPath

How can you introduce a package, so that it is listed in $Packages, without adding it to $ContextPath? Note that this question ...
0
votes
0answers
78 views

Is there a way to ask Mathematica for the RAM installed? [duplicate]

Possible Duplicate: How to find out the (current) free memory on the system? Do we kwow of a function to get the installed amount of physical system memory RAM of my Windows PC?
6
votes
1answer
287 views

Passing back “NaN`” and “Inf`” to C via MathLink

In the "usual" double representation of floating point numbers in C there is a NaN and an ...
2
votes
1answer
288 views

Geocoding addresses to geographic coordinates

I am writing a research proposal for a project on voter turnout as related to proximity to mass transit. The first part of my project would require geocoding hundreds of thousands of addresses, but ...

15 30 50 per page