0
votes
1answer
70 views

How to write series of Do[ ]'s with a single Table[ ]?

Edited to provide more information (sorry I don't know how to format matrices here) I would like to replace: m = 4; ...
0
votes
1answer
79 views

Holding Input Windows

I am creating a Mathematica document which contains a list of proofs in various fields of Mathematics so that I can easily review whenever I would like. First, I create a large set I call 'proofs' ...
1
vote
2answers
167 views

Making nice code: choosing one of several procedures

Happy new year mathematica gurus of stack exchange! As I see it one of the major obstacles in getting decent at programming mathematica is that, not only do you need to learn how certain commands ...
1
vote
2answers
125 views

Changing Default Color for Titles, Sections, Subsections, etc., and Items (bullet color) [duplicate]

I'm new to Mathematica 9, and I assume there must be an easy fix for my problem, but I have not been able to find any yet. Essentially, I want the default color for the text of all of my titles, ...
4
votes
1answer
67 views

Constructing an Array from typed expression

I want to produce an array from expressions given by test[one][1] = 3; . . test[one][5] = 7; etc. Normally would use ...
0
votes
1answer
123 views

Pattern match with Table for matrix dimension check

In Mathematica, often an expression involving matrices will encounter dimension mismatch errors, like we are multiplying a 3x2 matrix to a 3x4 matrix. Below we define a new symbol Dim, which can be ...
0
votes
1answer
361 views

What is wrong with this Cobweb plot [closed]

Something is wrong with my cobweb plot code but I couldn't figure out where do the mistakes come from. So basically we have the iterative map $x_n == x_{n-1}^{2} - 3 \mu$. I would like to draw a ...
3
votes
1answer
166 views

Using single replacement rule to convert algebraic expression

I have been trying this problems for hours and cannot find any helpful clues. How can I convert $Sinh[3\theta]+Sinh[\theta]$ to a rational function of x given $2Sinh[\theta] = x-x^{-1}$ by using only ...
1
vote
1answer
189 views

Solve this equation symbolically

I am trying to solve the equation for the quantity r = y/x symbolically: 3/y^4 == 3/x^4 + a/(x + 2 y)^4 with the requirement that we need to perform the ...
4
votes
0answers
71 views

Is there a way to check whether two notebooks share the same variables?

When I code in Mathematica, I often re-use code from old notebooks which fulfilled a specific purpose; for example, one testing for soft matches in strings, or one that identifies outliers on a graph ...
4
votes
3answers
397 views

Keep function range as a variable

Plot[2*x^2 - x + 2, {x, -1, 1}] plots a function of x from -1 to 1. As far as I can see, I cannot "save" this range in a variable: ...
4
votes
2answers
177 views

How can I compare the previous value and the current value implemented during NestWhileList?

I am trying to write a part of my code. I am using NestWhileList. However, I couldn't find out the right syntax for testing. It should compare previous result and current result and continue if it is ...
6
votes
1answer
538 views

Coding mistake? [closed]

I have just started using Mathematica with v9.0. I am trying to follow a computation from a book on Fourier series with the function $f(x)=x$ on the interval $-\pi < x < \pi$. Here is the code ...
7
votes
3answers
282 views

how to read in a file in the same directory?

Now I am writing a small package. I have written several files and put them in the same directory. And some files need to read in or include another file in the same directory. But when I simply write ...
1
vote
2answers
227 views

How to insert an expression in a Mathematica program?

I need to insert a very large expression in a Mathematica program. So I first Put[large expression,"file"] and then use Block[{}, Get["file"];...] to ...
19
votes
2answers
944 views

Code Readability and Object-Oriented Code

The basic problem I have been running into is making readable code, where in other languages I am more familiar with I might have been using class or struct like objects. For example, you can imagine ...
2
votes
4answers
338 views

Using the result of Solve in subsequent calculations

I'd like to know how to use the results of Solve in later calculations. Here's what I'm doing now: This is my expression ...
8
votes
2answers
216 views

Cases[data,Colon[key,_]] vs. Cases[data,key:_] toward XPath, XQuery

Exploring methods to index and search tree-structured key:value pairs via named-entity index (key paths) as opposed to Position-based indexing. Using Rule as ...
4
votes
1answer
279 views

Path queries for tree-structured data

Can anyone suggest documentation or tutorials for developing path queries and indices for (XML-like) tree-structured data? Suppose data is organized hierarchically in key->value pairs, eg: ...
4
votes
3answers
231 views

Brackets in output make unable to use output to identify matrix element

I'm trying to write a code where each matrix element swaps with a randomly selected neighbor (cardinal directions only) to redistribute the matrix. So far I've been able to replace an element with its ...
41
votes
6answers
1k views

Functions vs. patterns

Every time I define a new function, I wonder which construct I should use: true functions obtained by using Function, or rule-based syntax. For example, these are ...
14
votes
2answers
344 views

Distributing PlusMinus consistently

I would like to give the built-in function PlusMinus, which is undefined by default, the intuitive meaning: considering all possible combinations of $+$ and $-$. ...
7
votes
2answers
248 views

What's the purpose of the Unique function?

As the title says: What's the purpose of Unique? I understand that it generates some unique symbol, but when and for what is it to be used? Are there applications ...
50
votes
2answers
1k views

Flatten command: matrix as second argument

One thing I could never wrap my head around is how Flatten works when provided with a matrix as the second argument, and the Mathematica help isn't particularly ...