0
votes
2answers
684 views

Why function cannot be defined inside For loop? [closed]

I have a following code (which is simplified version of what I am doing): For[i = 1, i <= 5, i++, f[x_] := Sin[x]^2 Print[{i, f[i]}] ] And the question ...
0
votes
1answer
193 views

CDF won't work but NB works

I converted a .nb with the following content to a standalone CDF but I get an error that says: "An unknown box name (N) was sent as the BoxForm for the expression. Check the format rules for the ...
0
votes
2answers
105 views

How to get rid of trailing string after using Convert?

Convert[0.05263, Percent] /. Percent -> "%" I would like to remove the trailing "%" but if I put Percent->"" it concatenates a literal empty pair of quotes. ...
5
votes
2answers
164 views

How to count words in a Greek text

I want to perform a simple analysis of some Greek text: collect the different words used and count their frequency. It seems that some of the built-in commands do not work well with Greek letters. For ...
0
votes
2answers
383 views

NDSolve solution for driven damped pendulum diverges

I want to solve numerically for the system of the driven damped pendulum using Mathematica. This is the second-order nonlinear equation \begin{equation} \ddot{x} + 2 \beta \dot{x}+ \omega_0^2 \sin ...
0
votes
0answers
49 views

manipulate: time limit on calculations [duplicate]

I'd like to disable the 5 second time limit in the manipulate construct. I read about setting SynchronousUpdating -> False But for some reason this does ...
9
votes
4answers
679 views

Drawing minor gridlines

What's the best (most elegant, shortest, easiest to read) way to add minor grid lines to a plot? Here is an example: ...
3
votes
2answers
129 views

Generating a list of pure variables

I want to pass a list of pure variables to a function, in which the ordering of the variables matters. For instance, if I want a palindrome, my function might be: ...
1
vote
1answer
130 views

Splitting list of sums into a sum of lists

I want to split a list of sums into a sum of lists For example, I'd like to turn {{x + y + z}, {x}, {y}, {z}} into ...
5
votes
4answers
189 views

FrameLabel not printing completely

Running this code: ...
3
votes
1answer
188 views

Distance between two functions satisfying a constraint

My problem is that I have two functions that are described as follows: ...
2
votes
1answer
121 views

Standard Deviation and StandardDeviationFilter

I found this scant description of StandardDeviationFilter in the documentation, implying one could use it to generate a moving standard deviation: I've got a ...
8
votes
1answer
287 views

How can I access the internal function that plots a molecule from a formatted XYZ file?

Mathematica has the ability to plot a molecule using the data contained in an XYZ file. This is a simple text file, of which this is an example. The molecule is plotted using the Import command. ...
2
votes
2answers
124 views

Arrow pointing upwards in a Graphics3D

I am trying to write a code for an arrow that points upwards from the center of the circle in a Graphics3D. ...
1
vote
0answers
72 views

Sharing styles between notebooks (Mathematica v9) [duplicate]

It appears from the documentation that we share styles via stylesheets. I am trying to set up a customised default stylesheet for my notebooks. I have tried simple ideas, and more complex ones, ...
0
votes
1answer
119 views

Hue function for negative arguments

I want to use Hue function for different colours with the argument being a function, i.e., Hue[f[i,j]] Now, ...
5
votes
1answer
105 views

“And” to continue evaluation after “False”

Below, is it possible to print No and have x be 2. That is, I'm looking for an And-like function that looks at all arguments ...
4
votes
4answers
148 views

Put local variables for Block in a variable [duplicate]

Is is possible to assign {x = 2, y = 3, z = 4} to a variable var so that one can write ...
2
votes
1answer
88 views

The proper way to write the input for a certain series

Mathematica tells the series below doesn't converge. I think it converges. What would the proper way to write things be as an input? ...
7
votes
2answers
778 views

How do I save my animation/manipulation in pdf?

Is it possible to presserve my animation and manipulation plots in the pdf?
5
votes
1answer
222 views

Is there an equivalent of “shiftdim” of MATLAB?

Recently I'm spending my time implementing some computer vision algorithms, which usually handle a large amount of data. The problem I'm facing now is that I have to reform my video data to pass it ...
2
votes
1answer
154 views

Strange spikes in my surface

I'm getting strange spikes in my surface S with the code below. PlotPoints seems to help, but it doesn't solve the problem. Any ...
15
votes
2answers
264 views

Upon PDF export, edgeless rectangles do not tile perfectly, and corners may be cut. Is this a bug?

Note: this problem is no longer present in version 10. Exporting the following as a PDF file ...
2
votes
2answers
558 views

distance between two curves

I try to compute the distance between two curves. I use the EuclideanDistance to do that. Here my code: ...
0
votes
1answer
191 views

Plot a function over a specific domain

I have a function that is defined on a specific domain for example the function $$f(x,y)=(x-0.5)*(y-0.5)$$ defined on $\Sigma$ which is the circle $(x-0.5)^2+(y-0.5)^2=0.5^2$ How to plot $f$ over ...
0
votes
0answers
128 views

Any way to fully expand an expression of two operators?

I am looking for a way to expand a complicate expression like the follow (A o B + C o (DxE))*(D o (ExF) - ExA + A) Here o and x are the operator. I want to ...
2
votes
1answer
246 views

Coloring with Hue for a function on a lattice grid

I wish to color a 2-dimensional lattice grid according to the value of a function at each lattice-node. More specifically, if I have 9 angles in a 3x3 array, ...
3
votes
3answers
193 views

Matrix multiplication that includes a tensor

How would I best express the following in Mathematica: $\begin{pmatrix}2 & 4\end{pmatrix} \begin{pmatrix}r_1 & r_2\\r_3 & r_4\end{pmatrix} \begin{pmatrix}6 \\ 8\end{pmatrix}$, where $r_i$ ...
4
votes
1answer
262 views

Using a user defined NormFunction in FindFit or NDSolve

I would like to use a different norm instead of the 2-norm in FindFit (Mathematica 9). For example, instead of using $$\sqrt{\sum (x_{\mathrm{model}} - ...
-1
votes
1answer
59 views

How can a 3DBarChart be made to be fixed size and proportions?

I have a 3DBarChart that adds bar graphs as would be required by the dataset, but as it gets wider runs off the page and can not be printed. Is there a way to fix the height & width of the ...
-1
votes
1answer
101 views

How to extract the coefficient from an expression

Here is the expression. I want to extract the coefficient just as the table showing below. I can do it by hand, but I expect a code that can automatically identify how many differenct terms ...
2
votes
0answers
259 views

Conditional statements in intial conditions?

This is potentially a daft question, but I thought I'd ask it; I have some material free to diffuse in a boundary between rn and ro; I've been able to get it working nicely for neumann type boundary ...
6
votes
3answers
523 views

Replace “,” in a list with “.”

I have a list which consists of numbers which use comma (,) instead of dot (.) as their decimal point. I would like to replace the commas, but only those commas which are followed by more than five ...
3
votes
2answers
493 views

How can I consistently get a good logistic regression fit?

I'm executing the command NonlinearModelFit[data, c/(1 + a Exp[-b x]), {a, b, c}, x] with the data being ...
0
votes
0answers
49 views

How to judge if a point is in the interior of a closed curve or not? [duplicate]

For example: pts = {{0, 1}, {-(Sqrt[3]/2), -(1/2)}, {Sqrt[3]/2, -(1/2)}}; trig=JoinedCurve[Line[pts], CurveClosed -> True]; Then ...
0
votes
1answer
92 views

Reflection transform of function [duplicate]

I am trying to find the reflection function. Here is my function and its graph. ...
5
votes
1answer
333 views

Connecting Mathematica to a SOCKS5 tunnel proxy

I have Mathematica setup normally and connections work. However, when I want to use it to connect through my SSH tunnel program (Tunnelier), it throws the error PacletSiteUpdate::err: An error ...
2
votes
1answer
313 views

Non linear equation phase space

As a supplementary to my question solution of differential equation I post a new question of how is it possible to make a Table that has elements the solutions of a non linear differential equation, ...
1
vote
2answers
179 views

Set all instances of Exp[-x_] to zero?

To simplify a huge expression efficiently, which involves a variable in a bunch of exponential functions going to infinity, I have tried to substitute ...
0
votes
1answer
158 views

Pop Up for Setting directory path

I am trying to build certain modules in Mathematica 9. I want it to dynamically ask for the directory path ( like file explorer ) when the code cell is executed. How can I do that ? ...
0
votes
1answer
629 views

Error messages in importing data file

I want to copy the data in a public file (link in code below) and put each row of the data as a sub-list, i.e., in the format ...
13
votes
3answers
411 views

How to Import random elements of huge data files

I am calculating huge data files with an external program. I would like then to import the data into Mathematica for analysis. The files are 2 columns and up to many millions of rows. So for ...
11
votes
1answer
322 views

Triggering actions when a variable is set

Some built-in variables trigger actions when their values are changed: ...
1
vote
0answers
109 views

TableForm behavior change

In an older version NoteBook, I was able to specify some options for TableForm, which enabled the printing of an expression in a simple fashion: ...
2
votes
0answers
283 views

Runaway MathKernel!

I was running a simulation and everything went south (my fault, stupid coding error). So I quit the kernel. Everything was running very slowly, as if it were doing some kind of large calculation. ...
-1
votes
1answer
114 views

How can we suppress the asymptotic notation in Series? [closed]

Series expands a function, and also gives an idea of the asymptotic bounds of the function: Series[$\frac{1-x^3}{1-x}$] returns: $1 + x + x^2 + O(x)^5$ I'd like ...
1
vote
1answer
195 views

Partial row reduction of a matrix

I have an $m\times n$ matrix (presumably of full rank) with $m>n$, and I would like to row reduce it, but leave the last column unreduced; that is, I want to get output on the form $\pmatrix{ 1 ...
0
votes
0answers
195 views

Simultaneous Equation Solving Under Nonnegative and Bounding Conditions

I have nonlinear equations to solve parametrically; ...
0
votes
1answer
254 views

Can Mathematica check if two expressions give the same output for integer input?

Let me give the background for this question. I'm using WebAssign to assign homework problems, and WebAssign has a built-in mechanism which can grade problems using Mathematica commands. For ...
5
votes
4answers
605 views

How to find the index of a square matrix in Mathematica quickly?

Let $A$ be an $n\times n$ complex matrix. The smallest nonnegative integer $k$ such that $\mathrm{rank}(A^{k+1})=\mathrm{rank}(A^{k})$, is the index fo $A$ and denoted by $\mathrm{Ind}(A)$. I would ...

15 30 50 per page