The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [syntax]

Questions on correct (or improved) formulation of Mathematica code to achieve particular results. Use this tag (not "symbol") for questions about all those odd @@ /@ # & and ~ characters.

692 questions
Filter by
Sorted by
Tagged with
42 views

How to use === with condition?

I have two expressions, and they are same when k is positive and x is non-zero real number. Below code gives me ...
95 views

Hyperbola ContourPlot missing input

I'm trying to plot a hyperbola using ContourPlot, but I can't understand what I'm missing on its call. The error says it's incorrect syntax, although I can't see any errors. ...
30 views

Shorthand of Get[] [duplicate]

I thought that << expr was just a shorthand form of Get[expr]. I have now found that it clearly isn't. Namely it holds <...
43 views

Solve not working now, but did befoe [duplicate]

I did this Solve earlier and it worked. Why is it not working now? I tried other solves after this one, and did not work, also. I tried creating a new notebook, and it did not work there, also.
42 views

Understanding Solve output [duplicate]

In Solve output for such as: Solve[r^2 - 6 r - 3 s^2 + 8 s Sqrt[r] == 0 && 0 < s < 1, r, Reals] Where in the documentation do I learn how to read ...
46 views

RSolveValue syntax

Can't see anything wrong with this: sol4 = RSolveValue[{a[n + 1] - 1.2*a[n]*(1 - a[n]) == 0, a ==0.1}, a[n], n] But I just get an echo from Mathematica
40 views

Simple assignment results in “Tag times in 1 Null is protected” error [duplicate]

I've read multiple topics about "Tag times is protected" error, but none of them were struggling with the same problem I am (or maybe I just didn't see it), so I'm asking for help since I'm unable to ...
25 views

What does Solve output with # and & mean [duplicate]

I tried to solve a symbolic equation using Solve and in that I get expressions like #1^5 &, 1 what does this mean? I ...
51 views

Assumptions work for simple function but don't work for complicated function

Suppose the function f1[s1uppern_, s1lowern_]= I Sqrt[s1uppern - s1lowern]/(s1lowern - s1uppern)^(3/2) I want to simplify it assuming that ...
50 views

Which of the following inputs is correct for the desired operation?

sorry for another (very likely) dumb question, but I'm having trouble telling which of the following (if either) yields the desired operation. What I'd like is to define a function: ud = u(f/2) - \...
375 views

(Basic Question) How to use nested functions properly?

UPDATED PORTION OF QUESTION AT THE BOTTOM First, let me apologize for two things: 1) I'm very new to Mathematica, so this question is certainly very stupid, 2) I looked for the solution to this both ...
71 views

Indicate level with Replace [duplicate]

Replace[{{x^2, Sqrt[x]}, {x + 1, x - 3}}, f_[x__] -> f, 1] Level 1 of Replace works here as expected with output {List,List} ...
62 views

Relative speed of definite integration and indefinite integration with substitution

Suppose some complicated integrable function $f[x]$ (possibly depending on parameters). One can perform definite integration over $x$ inside the domain $[a,b]$ by using construction ...
793 views

'Cannot be followed by..' error when implementing while loop

I am trying to implement the following (iterative) scheme (a preconditioned conjugate gradient method): ...
91 views

How can I make ListPlot use my iteration as the x coord?

I have some code that takes a list of energies, plugs them into a set of recursion relations and numerically solves for each energy (15 energies total) and for each n(modes, 21 total) ...
93 views

Solve / Reduce runs overnight - should I keep waiting?

I'm pretty new to Mathematica and I'm trying to solve a system of two equations, but both Solve[] and Reduce[] have been running ...
23 views

Problem with PolarPlot and Table [duplicate]

If I have a set of numbers, for example grid = N[Table[n^2/2, {n, 3, 24}]] And want to plot that as circles I can either use Graphics[] and Circle[], or ...
46 views

Syntax question for declaring variables [duplicate]

I have a very basic syntax question for declaring $X_{hb}$ a variable. f[Subscript[X, hb_]] := Subscript[X, hb] In mathematica instead of writing the ...
30 views

I would like know why “&” came after “FrontEndToken[”New"] here [duplicate]

I am a newbie to this Mathematica world who lives in South Korea, which is not a desirable place to have people to discuss Mathematica. So I came here, even though this question may look very simple ...
60 views

Solving Integral -syntax or interpretation problems

WA interpreter achievement not well this entry from Mathematica, steps need to see the full resolution input WA ...
45 views

Possibly syntax errors? [duplicate]

trying to graph, however graph is blank when i enter it. Please help! ...
49 views

Treating expressions as symbols [duplicate]

I'm trying to do something like this: test = {x, y}; With[{test[] = 3}, x/y] However, the following error is printed: With::lvset: "Local variable ...
59 views

What makes items with head Function different?

I apologize beforehand for the muddleheadedness of this question. It reflects the fact that I'm trying to interpret outward "behaviors" of Mathematica expressions without having any understanding of ...
45 views

What does a single @ do? [duplicate]

I have a simple expression: N@Log2@g I understand that N is Numerical value , that a function called g is being ran with 2048 as its first argument. But ...
51 views

Assigning to a variable with a computed name [duplicate]

I wish to assign about a dozen variables to complicated expressions. to ensure that the correct variable is assigned to the correct expression, I’d like to do something resembling ...
59 views

Help for properly writing simple derivative expression

I need help to write the following expression (only 1 iteration): f(x) = ...some basic function... f[X0,...,Xp] = f(p)(x0) / p! What I have so far: ...
89 views

...
46 views

How can I mix // with a function of two arguments? [duplicate]

I often find myself using // when playing around with expressions, but it is always cumbersome to have to switch to the full notation just to apply a function of ...
169 views

My “N” turned red randomly [duplicate]

For some reason my N function showed up in red even though I haven't noticed it in that color before. The color actually makes the code much more readable but I just don't know if I should be alarmed ...
205 views

Meaning of backtick in conjunction with units [duplicate]

In this fragment from an equation solution the backtick is used twice: ...
225 views

Using Table[ ] vs using Do[Append [ ] ] [duplicate]

Is it generally better/faster to use the Table function over using Do[Append []]? For example, I have this piece of code: <...
26 views

Incorporating Built-In Function Options/Parameters into Shorthand [duplicate]

Shorthand syntax provides an alternate way to apply functions and, in many cases, improves readability. A simple example would be ...
163 views

The /. syntax in numerical methods [duplicate]

I have an analytical approximation method for solving an ODE and want to compare this to an NDSolve solution, but the syntax is confusing me. To get the solution from NDSolve, I define the ODE as eqn ...
126 views

Why does Eigenvalues[matrix I defined] not work? [duplicate]

This is the code I have in my mathematica notebook. I want to find the eigenvalues of the matrix I created called Hmatrix as defined below. However when I type Eigenvalues[Hmatrix] I get the Hmatrix ...
2k views

What is wrong with this Cobweb plot [closed]

Something is wrong with my cobweb plot code but I couldn't figure out where do the mistakes come from. So basically we have the iterative map $x_n == x_{n-1}^{2} - 3 \mu$. I would like to draw a ...
89 views

How to remove a line from the ListPlot?

Consider the following ListPlot: ...
59 views

Operations between sets of integers [closed]

sorry it was impossible to put the code in Latex, he said that there were problems of indentation, I put the image
102 views

How to make sure input is an ODE

I'm having trouble wrapping my head around why this isn't an ordinary differential equation. ...
85 views

Syntax Error for the following code

I have the following code in mathematica ...
140 views

What is a proper way to express derivatives with respect to a symbol? [duplicate]

Mathematica's default way of representing derivatives is to express them with respect to a function's input slot. But what if I want to use the chain rule? To replace df(x)/dx with df(0.5 y)/dy 0.5, ...