This tag is intended for the review and improvement of style for already functioning code. It not meant to change the objective of the code.

learn more… | top users | synonyms

17
votes
1answer
318 views

Copying one symbol into another

I would like to know how can I completely copy one Symbol to another. When I say copy, a refer to UpValues, DownValues, ...
13
votes
9answers
558 views

Thread over list in different levels

I have these two lists, both with the same length in the first dimension: ...
13
votes
4answers
413 views

Button evaluation inside DynamicModule

Someone know why this Button works when clicked: ...
11
votes
3answers
516 views

Simpler way to fill date gaps with zero values

One basic problem when working with data like sales and dates is the case where you dont't have sales in all days, so you have to fill it to take information as average or to make a plot. See this toy ...
2
votes
3answers
666 views

Using DSolve to solve for x[t,parameter]

I'm trying to solve an ODE with two independent variables (a cannon firing from a cliff incorporating wind resistance dependent on velocity). I've tried the following for the x-component: ...
14
votes
1answer
1k views

Poisson solver using Mathematica

I am looking for some help with a Poisson solver I am writing in Mathematica. The code is quite long with Arrays plugged in, so the full details can be found at http://pastebin.com/uSrSDcW6 I am ...
23
votes
9answers
4k views

Programming paradigm change

I'm new to Mathematica, I've been learning by myself, and, being a Java developer for some time, it makes it hard to adapt. I've tried to solve a Reddit challenge, and I came up with this solution: ...
22
votes
7answers
985 views

Splitting words into specific fragments

I am looking into splitting words into a succession of chemical elements symbols, where possible. For example: Titanic = Ti Ta Ni C (titanium, tantalum, nickel, carbon) A word may or may not be ...
6
votes
2answers
740 views

Elegant way to handle columns operations

Inspired by this question from @sjdh and by my recurrent use of columns operations in database sets, I was looking for one way to make columns operations more symetric, so I can handle with matrix and ...
21
votes
1answer
570 views

Strategies for solving problems involving searches

As an example of a search-oriented problem, consider finding all constrained $n$-colorings of a graph. An "$n$-coloring" associates one of $n \ge 1$ colors to each vertex in such a way that no edge ...
20
votes
1answer
1k views

May the Fourth be with you

Happy Star Wars day. I was playing around with the image manipulation functions in Mathematica in an attempt to recreate the Star Wars crawl. There's an HTML/CSS implementation which is in my ...
11
votes
2answers
292 views

Clever use of DownValues, or failure to understand the “Mathematica Way.”

I needed to look at the changes in the values of about 4000 items from one year to the next. I have a table with identifiers and values for each year. Not all of the items are in each list. The ...
11
votes
2answers
496 views

What's the most “functional” way to do Cholesky decomposition?

I can do Cholesky in a procedural style, such as: ...
4
votes
2answers
902 views

How to fix BodePlot that comes with Mathematica?

I am using Mathematica to go through the examples and exercises on the book Modern Control Systems, 6th edition by Dorf. On page 605, there is a table (Table 8.5) with the Bode plot for several ...
4
votes
3answers
201 views

Is there something wrong with this piece of code involving Manipulate?

I am playing around with the Manipulate sentence. I think the following code is right, and actually Mathematica 9.0 doesn't return any error message, but I am ...
4
votes
1answer
167 views

Feedback on my Subscript code

I have written a code, and I need a little feed back.. I want to make the Subscript distributive across (1) addition and (2) multiplication to mimic short-hand for ...
3
votes
1answer
284 views

How to improve this dynamic progress bar code

I created this progress bar to use in my codes: ...
1
vote
0answers
104 views

Nonlinear FEM and FindRoot

I'm trying to develop a kind of nonlinear FEM application using mathematica to solve a bvp like the following: $$ \gamma(u') ~u^{iv} + 2 \gamma'(u') u''' u''+ u''^3 = f(x) $$ where $u = ...
1
vote
3answers
172 views

professionalize/optimize my code that calls a function

I have the following construction, which defines a function that I subsequently call in a loop multiple times. I use this very often, but I have never looked into if there is a more professional way ...
6
votes
2answers
147 views

Looking for feedback on this function

I'm not sure this is an appropriate question; if not, I'm sure someone will close it :) I've got the following function, listed below; its job is to accept a graph (function) presented either as a ...
5
votes
1answer
184 views

Selecting a list from a list of lists

In working through Programming Paradigms Via Mathematica (A First Course) I have come across this two part question: A permutation of length "n" is a list of the first n positive integers in ...
2
votes
1answer
97 views

Writing a function to mimic Characters

I am working my way through Programming Paradigms via Mathematica (A First Course) and have answered the following question in lesson 25: Write a function of one argument "s", a String, which ...