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.

learn more… | top users | synonyms

0
votes
1answer
96 views

How to improve this function that selects parameters from arbitrary distribution using Recursion?

Below, I have defined a function using Which to select model parameters based upon various conditions. My questions are: Is there any danger in writing this function using Recursion? Is there a more ...
0
votes
1answer
43 views

Why does this cause an error? [closed]

In[73]:= f[x_] := Save["C:\\Users\\user\\Desktop\\file", x <> x] f["###"] During evaluation of In[73]:= Save::sym: Argument ...
0
votes
1answer
117 views

converting DO loop into NestList form

I would like to rewrite this Do loop using NestList. Can you help me? ** DO loop ...
0
votes
1answer
37 views

New output cell generated for each run of a GraphicsGrid - is there a way to simply update the same output cell each run?

I have a Code cell that generates a set of plots in a GraphicsGrid[]. Each time I execute the Code cell, a new Output cell is generated. Is there a way to simply update a single output cell instead ...
0
votes
1answer
68 views

Data file organized in strings

I am working in a data set : The original question, They are strings of thousands stars,and each one contains a lot of parameters, and the following item is called identifies, they are the names ...
0
votes
2answers
174 views

Exctrating data information from a file.txt

I really did previous long search in the site and I couldn't find any answer that might help me. So I am asking it. I have the following data set, ...
0
votes
1answer
90 views

How can I assign a vector unknown function to solve the ODE system?

I noted that using non-scalar variables is convenient when a system of differential equations is governed by a process that may be difficult to express symbolically. Taking a example from the tutorial ...
0
votes
1answer
57 views

Programming a series involving alternative log expressions

This is likely my error but I cannot see it. I define a vector: x1 = {{{2, 2}}, {{2, 1}, {3, 1}}, {{3, 2}}, {{2, 1}, {5, 1}}} If x1[[ i, 1,2]] is 2, I would like to find $(\log$ x1[[ i,1,1]]$^2$). ...
0
votes
1answer
191 views

Turning a 2D 3 body problem into 3D not so easy? [closed]

I have programmed a 3 body problem, that can in theory work for more than 3 bodies. I apologize in advance for the length of the code that I posted, I don't really know how much one would need to ...
0
votes
1answer
147 views

Using a LocatorPane

I have a network of a power grid where the edge are the power lines and the vertices are loads or generators. I was wondering how I can import an image into Mathematica to derive some sort of ...
0
votes
1answer
471 views

A problem with functions and Infinite expression 1/0 encountering

Following code (function) makes integrals and then replace f[x] with Cos functions and calculate the definite parametric ...
0
votes
1answer
95 views

How to produce functions [closed]

I want to produce n functions. For example, assume that by giving n=3, 3 definite integrals will be created, like the following: ...
0
votes
2answers
518 views

Mathematica Implementation of Householder’s Method

I typed the Householder code in this paper, which starts on page 7. The code is: ...
0
votes
1answer
605 views

Heat Transfer equation by numerical methods

I want to solve the following heat conduction equation using numerical methods: D[u[x, t], t] -alpha*D[u[x, t], {x, 2}] == 0 u[x, 0] == 1/(1 + x^2)^0.25, u[-10, t] == u[10, t] == 0, ...
0
votes
1answer
2k views

Evaluate function of two variables using nested Do loops

Is there a more efficient way of evaluating a function of two variables on a rectangular grid the the following nested Do loops? ...
0
votes
1answer
141 views

Collecting roots of different equations and create a list

I solve two equations and have two solutions one by each equation. I want to create list of these roots. Could anyone please help me? Appreciate it. m02R150 = FindRoot[P1 == 0, {E1, 0.07, 0.1}] ...
0
votes
2answers
172 views

How to obtain a smaller-sized output from Solve

I am solving a system of 15 simultaneous linear equations using Solve. On running the code, I get a message saying "A very large output was generated" with options ...
0
votes
1answer
387 views

Problem with Eventlocator Method for NDSolve

I want to solve the ode and plot the solution v[x] for different values of parameter a where ...
0
votes
1answer
442 views

How to solve a problem in relative motion?

I have a project due tomorrow that I have been struggling with for a month. I am utterly stumped, any help would be appreciated. The problem is: There is a ferris wheel, 30m in radius, set 80m ...
0
votes
0answers
28 views

Set more constrains on a function in Do loop with If condition [on hold]

This post is an extension of the post: Do loop with If condition The answer of @JasonB worked fine with me. that to use Reap ...
0
votes
1answer
55 views

A problem with the output

i using mathmatica to study lagrange Interpolating,however i couldn't make the output as I want I wrote both who is the output and how i needed ...
0
votes
0answers
13 views

How to calculate an accurate estimated reading time of text? [migrated]

I suppose the calculation should not be done by only two factors (average reading speed/words per minute, and word count). But at least by a third parameter, that in my opinion should measure the ...
0
votes
0answers
38 views

Construct certain univariate functions over bounded interval having given set of moments [migrated]

We have a class of probability distributions (parameterized by $\alpha =\frac{1}{2},1,\frac{3}{2},2,\ldots$) over the interval $[-2^{-12} \cdot 3^{-3},2^{-16}]$ having as their $n$-th moments ...
0
votes
0answers
63 views

Why Mathematica rather than matlab? [duplicate]

I am not sure I can ask question here, but in my lab, there are two people using Matlab, and two people including me using MMA. They told me that Matlab can do Matrix calculation much faster than ...
0
votes
0answers
38 views

Construction of palettes [duplicate]

Is there a good documentation to help to construct my own palettes. The problem is to use a palette as an assistant to remember some long command line with many place holder and not to be obliged to ...
0
votes
0answers
53 views

Function that outputs the dual of the formula

The exercise is simple: define a function that gives the dual of the formula. While I have experience in mathematics and logic, I do not have real experience in programming. Logic is propositional ...
0
votes
0answers
25 views

Discretization of a region for NDSolve using [duplicate]

I would like to mesh the region below in order to use it for a calculation by means of NDSolve. Could anyone help me to discretize this region for NDSolve using. Thank you very much. ...
0
votes
0answers
30 views

Run mathematica script from python program [duplicate]

Is it possible to run the mathematica code inside the Python program? A simple pseudo-code to describe what I mean: ...
0
votes
0answers
34 views

How to transfer the list of parameters values into With [duplicate]

In the following case: With[{x=1,y=2},Print[x+y]] the values of x and y are declared in ...
0
votes
0answers
46 views

Incorporating sophisticated constraints on the approximating function into NMinimize

Following the approach as given in the answer of Belisarius here I just wonder how one could incorporate some more sophisticated requirements on the approximating function. Suppose the approximating ...
0
votes
0answers
39 views

Could not access a specific element of ConstantArray, why ? partw error [duplicate]

I could not access a specific element of ConstantArray, why ? The following is piece of my code: ...
0
votes
0answers
102 views

Best practices, tools, and snippets for manipulating notebooks, cells, packages, and help access? [duplicate]

Where is the best place to find/submit lists of Wolfram Language/Mathematica best practices, idioms, and patterns, perhaps grouped by topics? I'm personally interested in those that involve using ...
0
votes
0answers
49 views

system.dllnotfoundexception unable to load DLL“ .dll”: can not find corresponding module

There are two computers. One of them works correctly, whereas the second one writes an error system.dllnotfoundexception unable to load DLL" .dll": can not find corresponding module in ...
0
votes
0answers
52 views

Get Domain resp. implicit piecewise definition of numeric Function

Given the following quintic polynomial ...
0
votes
0answers
108 views

Extract frames as image files from video files [duplicate]

I have a set of video files where the frame rate is 1 frame/sec and the file shows the evolution of a particular object with time. Now, I want to extract each frame of the video and analyze as ...
0
votes
0answers
98 views

Fun/Frustration With Coding Coding Theory

I have code following from this post: http://math.stackexchange.com/questions/1317722/fun-frustration-with-coding-coding-theory I think I am done with the code, but now I face a single problem. The ...
0
votes
0answers
104 views

Evaluate notebook using text-based interface

I am trying to evaluate a notebook using a text based interface so that it can be submitted to a computing cluster. I have seen this stackexchange page and attempted to use ...
0
votes
0answers
41 views

$MessageList inside and outside Block[]

Why does 1/0 $MessageList return ComplexInfinity whereas ...
0
votes
0answers
61 views

Trying to write a program to find an approximate harmonic function on a given graph using relation method

So given an undirected graph with two vertices that have fixed values assigned to them, a harmonic function is a function that assigns values to all other vertices such that the value assigned to each ...
0
votes
0answers
25 views

Iterating a model with 2nd order difference equations using Manipulate [duplicate]

I have a model including first and second order difference equations. It works for the case of first difference equation, which is below: ...
0
votes
1answer
227 views

NDSolve with initial condition: initial conditions did not evaluate to an array of numbers of depth 1(for 1D) or 2 (for 2D) on spatial grid

I have the following naive code to solve a PDE in two spatial dimensions (x,y) with periodic boundary conditions: ...
0
votes
0answers
79 views

Define column types in a Dataset - Failure on append and Typesystem

I have a basic function that populates a Dataset according to user specified parameters. ...
0
votes
0answers
12 views

all does not work [duplicate]

Thanks blochwave for giving me a detailed answer, but I have already used all these methods and none of them has worked well, it is clearly written in mathematica "get help" file that the Timing[] and ...
0
votes
1answer
86 views

How can I use manipulate on multiple lists within a function?

So I have my N-Body Problem set up like so, and I can plot it in ListPointPlot3D, but I cannot figure out how to stick this into a manipulate function. ...
0
votes
0answers
104 views

Best practices for breaking up functional blocks?

Say I have a main function that does some job, and I'm only interested in the final result of ans, i.e., the local functions are not important and produce no ...
0
votes
0answers
47 views

Find the maximum/ minimum of the function f(x,y,z) = x+2y+3z on the curve of intersection of the plane x-y+z = 1 and the cylinder x^2+y^2 = 1 [duplicate]

How to write the program for: Find the maximum/ minimum of the function f(x,y,z) = x+2y+3z on the curve of intersection of the plane ...
0
votes
0answers
26 views

A question about conditional replacement [duplicate]

{g[x, y, z], h[x, y], f[]} /. (f_[t___] /; f != List) :> Plus[t] Why is the output of this expression ...
0
votes
0answers
80 views

What is the meaning of //N in mathematica? [duplicate]

As the title says, What is the meaning of //N? i can't remember it.I tried looking in documentaion center, but it came up with nothing. Help appreciated.
0
votes
0answers
102 views

How do I perform the following numerical integration [duplicate]

I have the following integral to evaluate numerically: $$x(t) = \frac{1}{f(t)}\int_0^{t_b} t^m (t + n)^o \sin(pt) \mathrm{d}t \quad m,n,o,p \in \mathbb{R}$$ ...
0
votes
0answers
1k views

Converting a matlab program into Mathematica 10

I sought help from this entry at Calling MATLAB from Mathematica to see if I could CONVERT a mathlab program which simulates polymer dynamics that is provided at the download section at ...