Questions on writing non-trivial programs in Mathematica. Do not use this tag for questions on plotting/graphics or for questions on doing mathematics with Mathematica, where the focus is more on the math than the program.
0
votes
0answers
68 views
difference between mathematica8 and mathematica 9
I got good results with Mathematica 8 when using
...
0
votes
1answer
56 views
Point tangent of an ellipsoid
I would to generate the contour points of an ellipsoid. Given the center of the light source C My idea is,
for each 3d point V I consider the 3D line with equation ...
0
votes
1answer
95 views
What happens in my if-logic loop? [on hold]
(scroll to the bold for my question if this is too long or boring)
You guys have been really helpful in the past. I'm trying to use Mathematica to simulate a simple model to match some experimental ...
2
votes
2answers
110 views
How to replace data in a list (tree) in a functional Mathematica way?
I have list containing 2D points in various groupings, i.e. points, lists of points (figures), lists of lists of points (patterns) and finally a list of patterns. The list also contains other data, ...
4
votes
2answers
154 views
How and when to use Evaluate?
A month ago, I used Mathematica to solve my experiment of the Test Technology of Mechanics Engineering. The exeriment is mainly about the Fourier Transform and verify the validity of the theory of ...
1
vote
0answers
55 views
Simulating a simple intermolecular repulsion term on a 1D adsorption model
Today I am trying to simulate some molecular adsorption behavior with a really simple repulsion term. What I have so far is a a script that generates a 1D chain, selects random sites (with selection ...
0
votes
0answers
49 views
Programming a Meijer G related result
I am not that new in Mathematica, but I do not remember I have ever used it for programming (like we may do in Java).
I have an important result given here by this integral:
$$
\int_0^{+\infty} ...
10
votes
3answers
236 views
How can I type-check the arguments of a Mathematica function?
(For educational purposes) I defined the following functions:
Translation (in $\mathbb{R}^2$):
trM[vec_] := {{1, 0, vec[[1]]}, {0, 1, vec[[2]]}, {0, 0, 1}}
...
8
votes
4answers
341 views
When should I use Apply (or Function) and when @@ (or &)?
This is a rather general question, which I fail to answer myself. I guess it is mainly due to my insufficient knowledge of the precise terms.
If I understand correctly, the following are equivalent:
...
12
votes
5answers
533 views
How to correct my code for solving the Josephus problem?
Problem Decription
Recently, I have been reading the book Schaum's Outline of Mathematica (2nd Edition), where I encounted the problem:
Flavius Josephus was a Jewish historian of the first ...
5
votes
7answers
357 views
Better code to find Narcissistic number
My code finding Narcissistic numbers is not that slow, but it's not in functional style and lacks flexibility: if $n \neq 7$, I have to rewrite my code. Could you give some good advice?
...
0
votes
1answer
191 views
How to combine two usages of # into one and speed up the code?
I have a function num with two variables, matf and matg. How can I combine the last two lines of code below into one? The code is aimed to find out the maxiaml count bel when we give each $i3 = ...
3
votes
2answers
204 views
Improve the performance of solutions to Project Euler (#14)
Problem
I have following code, when n<=10^5 it's not slow, but n>2*10^5 it's became very slow.
I think maybe some temp value greater than 2^31-1, so make compile invalid.
Could you give any idea ...
5
votes
2answers
77 views
ParallelMap and Sow/Reap - not behaving as expected? [duplicate]
Is ParallelMap and Parallelize@Map expected to work with Sow and Reap construct.
This is a rather brief toy code to find all Primes just to force the use of Sow/Reap inside Map
...
5
votes
1answer
136 views
Implementation of smoothing splines function
I have some problems by writing a module for spline smoothing. Actually i am trying for about two weeks.
My listing is here:
...