0
|
9403 Views
|
8 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

# Numbers as variables

Posted 9 years ago
 Hello, I am having a lot of trouble with Mathematica since several weeks. When I ask it to plot an expression, nothing appears. But when I use the automatic function "plot", then it does it by including invisible parameters: Manipulate[ DiscretePlot[ 1/2 (-1 + k)^ L k^(-2 L) (-.1d (-1 + k)^(-1 + L) + (2 k^L (-1 + (k/(-1 + k))^L))/L) V, {k, 1, 20}], {.1d, 1,20}, {L, -2, 2}, {V, -2, 2}] Also, the program treats numbers as variables, and then plots them, like this: Plot[(16 .1d)/729, {.1d, -8, 8}] Can someone help me, I have no idea what is going on. Thanks Attachments:
8 Replies
Sort By:
Posted 9 years ago
 Please make one more post describing simply and clearly what you want the notebook to accomplish.Just before you click "Publish" to send the post click "Add a file to this post" and locate your notebook which demonstrates as simply as possible the problem you are having and select that notebook so it will be attached to your message. Then click "Publish."Hopefully this will avoid problems of the forum software making changes to what you are writing and will allow readers to download the exact notebook you have, run it, determine the problem and explain how to avoid this problem.
Posted 9 years ago
 Hello, I attach a file, with a simple expression including only one variable.I then click on the option "plot" that shows up, and as you can see, an invisible parameter appears in the command. If I remove it (second graph), the graph doesn't display.Why is this invisible parameter showing up? How can I get rid of it?Thanks Attachments:
Posted 9 years ago
 The numerator in your expression starts with two spaces. That is the source of the invisible parameter: Try to rewrite the expression:
Posted 9 years ago
 Yes!!! Thank you!!
Posted 9 years ago
 The expression you are plotting looks quite intricate and I did not try to understand it (I lose track of the order of operations). Normally I try to use notation that makes the order of operation obvious.However, I was able to plot it and Manipulate it. I just changed {.1d,...} to {d,...}. The reason is this: you can prescribe the range where the variable d changes, but if you, instead, prescribe the interval where an expression that depends on d changes, then it may be too hard for Mathematica to figure out what you want. The expression you use (.1d) looks quite simple, but what if you wrote:{Sin[Log[Tan[3*d^2-Sin[d]]]], -0.3,0.1}?How would Mathematica decide what interval to use for d? I am not saying it is impossible, but in a sense you are asking Mathematica to solve a different problem, besides plotting. I also changed the range of k, because it looks like there is a pole at k=1. It is a bit tricky to plot poles in DiscretePlot. Plot usually produces something quite reasonable when the interval includes a simple pole.Best,OL.
Posted 9 years ago
 Hello,Thank you for your answer. But in fact, this ".1d" showed up only when I coped and pasted here. In the mathematica file, I dont see it, thats why I say it is an invisible parameter. See the PFD I attached to the first post, mathematica graphs the number, as if there was some parameter, although I can't see it.So on my file when I click on plot I see something like:Manipulate[ Plot[ 1/2 (-1 + k)^ L k^(-2 L) , {k, 1, 20}], {, 1,20}, {L, -2, 2}, {V, -2, 2}]I don't know why this {, 1,20} shows up, and if I remove it the graph doesn't display.
Posted 9 years ago
 Try not using {.1d,-8,8}, not using {.1d,1,20}, etc.Try using {d,-8,8}, using {d,1,20}, etc. instead.Somehow you have guessed that you want to put a constant in front of d and this is causing you all kinds of problems.Look at the examples in the help system and try doing things very very similar to what is shown. See if you can get those to work. Then make small changes and verify each small change still works.Mathematica will sometimes silently remember things you did since you started it the last time. This is meant to speed things up and make it easier for you to not have to repeatedly tell it things. But this can also cause great confusion if you don't realize it is using a previous value. If a result looks very odd then you might try restarting Mathematica and see whether not having it use old values helps.
Posted 9 years ago
 Hello,Thank you for your answer. But in fact, this ".1d" showed up only when I coped and pasted here. In the mathematica file, I dont see it, thats why I say it is an invisible parameter. See the PFD I attached to the first post, mathematica graphs the number, as if there was some parameter, although I can't see it.So on my file when I click on plot I see something like:Manipulate[ Plot[ 1/2 (-1 + k)^ L k^(-2 L) , {k, 1, 20}], {, 1,20}, {L, -2, 2}, {V, -2, 2}]I don't know why this {, 1,20} shows up, and if I remove it the graph doesn't display.