# Questions tagged [wolfram-mathematica]

2307 questions

0

5

Views

### How can I get the dynamic object to change automatically in this clickpane code?

Below is the following code from Mathematica that I've been working on. I am trying to create a triangle from three points that the user clicks on; however, the edges and the area of the triangle only show up after I click a fourth time to start a new triangle. How could I fix this? (amateur coder,...
Her Tear

0

15

Views

### Wolfram Mathematica: Why not looking for a maximum in real numbers?

Maximize[{Log[B e^(20 a)] - (B (-1 + e^(20 a)))/(a Log[e]), a > 0, B > 0, e > 1}, {a, B, e}, Reals]

0

9

Views

### Explain the implementation of Euler's Totient Implementation

I have seen this code in a coding platform to efficiently calculate the euler's totient for different values. I am not being able to understand this implementation. I really want to learn this. Could anyone please help me explain this? for(int i = 1; i < Maxn; i++) { // phi[1....n] in n * log(n) phi...
Santanu

1

440

Views

### Labeling points of intersection between plots

First of all I would like to apologize for the newbie question. I am just starting up with mathematica and I have 2 simple plots. What i want to do is have Mathematica automatically find the intersections, label them and show me the coordinates. I have searched this forum and there are a lot of simi...
Ray

1

78

Views

### Can't get solutions in output of wolfram mathematica

When I type a function into wolfram mathematica (such as EulerEquations[]) it doesn't output a solution, just outputs the same thing I typed in as input. Does anyone know how to fix this?

1

528

Views

### How to specify which variable on which axis in Wolframalpha plot?

For example, I want to plot y=x^2, but I would like y to be the horizontal axis and x the vertical axis. Of course I could plot y=+-sqrt(x) and mentally change the variable names, but this will not be feasible for other examples.
Hilemonstoer

1

153

Views

### Using LINQ in Wolfram

We have an IEnumerable Objects in C# that we want to import into the Wolfram Financial Platform. In the current C# API, we use LINQ queries to select from the Objects the specific Object that we need. In Wolfram Financial Platform we can import the IEnumerable Objects through NET/Link (More info: ht...
user1981756

2

386

Views

### How to calculate the integral with the condition in wolfram

How to calculate the integral with the condition in Wolfram like Integral(1/(x^4 + y^4)dxdy) where y >=x^2+1
Devnock

1

285

Views

### How to add point labels to my plot?

Below I am trying to plot a stick knot in 3 dimensions. I would like to label each of the points in order p1, p2, p3... p6 or even just 1, 2, 3, ... 6 would suffice. How do I do that? ` P1 = {0.300775, 1.301248, -0.702434} P2 = {-0.976281, -0.910795 , 0.701983} P3 = {0.976171, -0.910795, -0.702076}...
EgoKilla

2

60

Views

### NSolve vs Roots

I need to evaluate the following expression in Mathematica: (1/((3 + E^(4 k))^8)) 2 (1 + E^(4 k))^2 k (729 + E^(24 k) + 210 k + 2 E^(20 k) (9 + 7 k) + 4 E^(12 k) (135 + 49 k) + 6 E^(4 k) (243 + 61 k) + E^(16 k) (135 + 82 k) + E^(8 k) (1215 + 284 k)) == k Where E is an exponential. In Maple, it's t...
Nusc

2

129

Views

### Are there functions that remember values they have found on Octave?

Are there functions that remember values they have found on Octave? When you make a function definition, the value of the function is recomputed every time you ask for it. In some kinds of calculations, you may end up asking for the same function value many times. You can save time in these cases by...
user

1

33

Views

### Combining OptionsPattern with Pattern Constraints

I would like to define functions with named optional arguments and to restrict those arguments to expressions with specific heads. This is easy to do with unnamed optional arguments. For example: succ1[n_Integer: 0] := n + 1 succ1[] succ1 succ1[a] gives 1 5 succ1[a] as the desired output. However...
Ivica M.

1

401

Views

### Mathematica table error messages

For the following (some package-related statements omitted): CartesianMap[ func_, {x0_,x1_,dx_}, {y0_,y1_,dy_} ] = Module[ { x, y, tx, ty, llpx, llpy}, tx = Table[{Re[func[x + I y]], Im[func[x + I y]]}, {x, x0, x1, dx}, {y, y0, y1, dy}]; ty = Table[{Re[func[x + I y]], Im[func[x + I y]]}, {y,...
DougT

1

42

Views

### How to set edges styles of Graph based on it's weights in Wolfram?

I set my custom graph with vertex names like ell, poll, novi etc. (not numbers, but symbolic names). And I set vertexes and edges weights (weights can be positive or negative). I want to set different style parameters of vertexes and edges based on those weights. How can I do that? Thank you. Graph[...
Dmitriy Korobkov

1

101

Views

### Unable to use Mathematica Link in NetLogo 6.0

I was trying to connect Netlogo 6.0 and Mathematica 11 on my Mac OSX system (v10.11.6). I have followed the installation instructions of the Netlogo Mathematica-Link: import NetLogo.m into Mathematica and load the package,
user1993416

1

1.2k

Views

### Does the Wolframalpha app provide step by step solutions?

Several years ago wolfram alpha stopped providing the step by step solution in the browser. However, until last month it was still possible to get a step by step solution using the mobile version of wolfram alpha (maybe they simply forget to restrict it). However, now it seems they fixed it and as I...
OD IUM

1

91

Views

### Wolfram-Cloud/Mathematica, effective working with recursive functions

I am working with Чебышёв-polynomials at the moment, recursive defined polynomials. For the very likely case you never saw them before: f[0,x_] := 1; f[1,x_] := x; f[n_,x_] := 2 * x * f[n-1, x] - f[n-2, x]; Plot[{f[9, x],f[3, x]},{x, -1, 1}] And I found myself asking, since I usually work w...
Patrick Abraham

1

195

Views

### Iteration method

I am working on finding the initial points of convergence using newton's iteration method in mathematica. newton function works now I would like to show which initial points from a grid produce Newton iterations that converge to -1, same for points that converge to (1 + (3)^1/2)/2i, given that: f(x)...
itms

1

119

Views

### How to solve this multivariate recurrence with Mathematica?

I would like to solve this recurrence relation: \$a_{m,n}=a_{m-1,n}+a_{m,n-1}\$ with \$a_{0,0}=0, a_{m,0}=1, a_{0,n}=1\$ Its outputs form the Tartaglia triangle, the solution should be just the combinations... \$a{m,n}=Binomial(m+n,n)\$ But when I try to solve it with Mathematica RSolve[{a[m, n] == a...
skan

1

39

Views

### When adding functions, Mathematica ignores one when the step size is comparably large

Firstly, this problem is much easier to understand visually, I would post images but I'm new on here. I'm solving two coupled differential equations (for temperature and density) using NDSolve. The temperature equation has a heating function added to it in the form of a Gaussian and I want to thin t...
Duncan Mark Horne

1

177

Views

### I don't want box in ContourPlot3D in mathematica. Boxed->False does not work properly

ContourPlot3D in mathematica produces plot inside a box. When I set 'Boxed -> False', it does not work properly, boxes do not disappear completely. plz help, I am in hurry, don't scold. Code I am using to generate a sphere: Show[ContourPlot3D[ x^2 + y^2 + z^2 == 25, {x, -5, 5}, {y, -5, 5}, {z, -5, 5...
user43280

1

113

Views

### How to make the python code with two for loop run faster(Is there a python way of doing Mathematica's Parallelize)?

I am completely new to python or any such programming language. I have some experience with Mathematica. I have a mathematical problem which though Mathematica solves with her own 'Parallelize' methods but leaves the system quite exhausted after using all the cores! I can barely use the machine duri...
Archimedes

1

130

Views

### Minimizing a multivariable function of loop iterations

I'm trying to minimize a function f of ~80 variables stored in an array. The function is defined by two nested loops: the outer one indexes array by i, while the inner loop is performed array[i] times and adds the result of a computation to a running total. The computation depends on some conditions...
David Grabovsky

1

633

Views

### How to add legends for multiple plots in mathematica?

I have code that looks like this gx = n * k0 * (1 - ((n/a)^ beta) Show[ Plot[gx /. {k0 -> 0.5, beta -> 5, n -> 9, a -> 1}, {n, 0, 12}, PlotRange -> {{0, 12}, {0, 5}}, PlotLabels -> {'r0 = 0.5'}], Plot[gx /. {k0 -> 0.5, beta -> 0.5, n -> 9, a -> 1}, {n, 0, 12}, PlotRange -> {{0, 12}, {0, 5}}, PlotLab...
Ash

1

192

Views

### Mathematica; turn solutions of Nsolve into a list

I am using mathematica's Nsolve to solve a polynomial. When solved, Nsolve traditionally gives solutions like this: {{x -> 1}, {x -> 2}, {x -> 3},{x -> 4}} However, I need to transform this output into a list of numbers, so it looks like: {1, 2, 3, 4} How can I do this? There must be a simple way.
Programmer

1

92

Views

### Mathematica: Layout with Image and Text

Any help is appreciated ! I have a lot of images and text that goes with each image. Now I would like to automatically generate the following handout for each pair of image and text: The image is on top. The text should be placed below it, its style should be 'justified' and if possible hyphena...
james

1

142

Views

### How to plot the slope field of the differential equation y'=y-x² in Mathematica with VectorPlot?

I'm new into Wolfram Mathematica and I'm despairing of plottin a slope field in Mathematica. The differential equation is y'=y-x² and I want to plot its slope field in the area of |x|
random-user

1

210

Views

### How to Solve absolute value in Mathematica without Wolfram Alpha?

I have this equation that I can't insert in Mathematica Abs[x-1]+Abs[x+2]=3. I tried solve [Abs[x-1]+Abs[x+2]==3] but it gives no answer. I tried NSolve and DSolve and Evaluate but nothing worked. I can get the answer by hand -2
Red Eyez

1

233

Views

### Understanding Mathematica contour lines extraction

My Professor sent me a Mathematica Notebook, where he plots a 2d contour and then extracts the contour as lines (i.e. a list of lists of coordinate-tuples). The specific code segment looks like this: xdiv = 0.05 zt = 1. lis = Table[SomeFunction[x, y, zt], {y, -xmax, xmax, xdiv}, {x, -xmax, xmax, xdi...
Banana

1

71

Views

### Euler Project #520, making current code more efficient for finding simber integers?

Recently, for my Computer Algebra Systems class to work on. I have been given a problem randomly assigned from Project Euler to solve (Problem 520). The question goes as follows: 'We define a simber to be a positive integer in which any odd digit, if present, occurs an odd number of times, and any e...
Joshua Diaz

2

45

Views

### Mathematica: 'Findroot' not returning expected result

I am currently doing a little project which involves using a pre-defined function I graphed the function, and I am trying to find an x-value answer using a provided y-coordinate. I'm sure there may be other ways, but I must use this particular function. Below is what I currently have: F[L_] := (ArcT...
Apple Cola

1

14

Views

### Importing an irregular shaped array into Python

I have some data generated in Mathematica that I need imported into Python. The way the data is generated relies on symbolic calculations so simply generating it in Python is out of the question. The data is an array of dimensions (126,2) but, where the first position in each element is an integer,...
Brendan Reid

0

5

Views

### Integral changes variable subscripts

I have been away from Mathematica for quite a while and am trying to fix some old notebooks from v4 that are no longer working under v11. I'm also a tad rusty. I am attempting to use functional minimization to fit a polynomial of variable degree to an arbitrary function (F) given a starting guess (...
MikeMayer67

1

53

Views

### Maple does not recognize an integral as a special function

Maple does not recognize an integral as a special function: Writing in Maple: with(inttrans); #not necessary with(MathematicalFunctions); #not necessary int(t^(z-1)*e^(-t), t = 0 .. infinity); assume(Re(z)>0); This is the Gamma function. But apparently, Maple doesn't recognize it?! The Maple Functio...
flow

1

60

Views

### Mathematica transformation rules with trig functions

I'm an occasional Mathematica user and I am trying to transform an expression from spherical to Cartesian coordinates. My function is defined as: g[theta_, phi_] := Cos[phi](Sin[theta])^2 Sin[phi] I'm hoping to transform that function using the following rules: Sin[theta]Sin[phi] -> x Cos[theta]-> y...
delacoder

1

88

Views

### How to plot functions and combine into one graph in Mathematica using a Table[Plot[ approach?

Here is an attempt to plot 2-c Exp[-t] for c=-3 to 3 by 1 in Mathematica. Table[Plot[2 - c Exp[-t], {t, 0, 1}], {c, -3, 3}] I want these 7 plots to be combined into one image. The following gives an error message. Show[{%, %%, %%%, %%%%, %%%%%, %%%%%%, %%%%%%%}] How to do? Another approach?
Mary A. Marion

1

27

Views

### Add an arrow inside a list (mathematica)

I have a list of variables {a,b,c,d} (the lists I have are much bigger, this is a small example). I want to make the following list: {a->1, b->1, c->1, d->1}. I tried {a,b,c,d}->1, but this does not work and I dont know how to search for the right keywords.
etotheipi

2

39

Views

### Labeling the name of a file with a given numerical parameter

With python I can save a file labeling its name with a given parameter t in the following way import matplotlib.pyplot as plt fig=plt.figure(1) plt.plot([1,2,3,4]) t=0.1 fig.savefig('filename%f.png' % t) and the name of the saved figure will be something like 'filename0.1000.png'. How can I do the...
3sm1r

1

45

Views

### Plotting function of 2D space + time using Plot3D in Mathematica

Is there a simple way of plotting a function f(x,y,t) = Exp[t-x-y] by setting the time t? I've tried several variations of Plot3D[Evaluate[f[t,x,y],t->0],{x,0,1},{y,0,1},PlotRange -> All] But I can't get it to work. I want to be able to change t and see how the plot changes, but I'm also using the e...
wobertson

2

85

Views

### Analogue function of Wolfram Mathematica in Python in NumPy or SciPy

I am rewriting some code writed in Wolfram Mathematica to Python. And, in some moment I needed an analogue of function ArrayResample[array,dspec]. May be you know a function from any package (NumPy or SciPy)?