Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: plot command

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58151] Re: plot command
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Mon, 20 Jun 2005 05:21:25 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, England
  • References: <d90spv$8va$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Bosch, Darrell wrote:
> Dear Group:  I am trying to solve an equation, take the derivative and 
> plot the derivative as shown below.  I get a message below the Plot 
> request stating
> 
> "Syntax::sntxi: "Incomplete expression; more input is needed."  Any help 
> would be greatly appreciated.  Darrell Bosch
> 
> 
> 
> 
> 
>  
> 
> sol = Log[v]=A9100*Log(s)
> 
> sol2 = Solve[sol,v]
> 
> sol3 = D[sol2,s]
> 
> Plot[Evaluate[sol3],{s,0,100}]
> 
> 
> 
> 
Hi Darrell,

Using correct syntax would help greatly! I have not gotten the error 
message you mentioned in your post but definitely many others. Starting 
from the first line, we get

In[1]:=
sol = Log[v] = A9100 Log(s)

Set::write : Tag Log in Log[v] is Protected.

Out[1]=
A9100*Log*s

Here you are using the symbol "=" (simple equal), which is equivalent to 
the command *Set*, which tries to assign a new value/definition to the 
built-in command *Log*. So, either you *Unprotect* the *Log* function 
(very bad idea in this case :-) or most likely you use the *Equal* 
(double =, that is "==") to check for equality between LHS and RHS.

Of course you still use the simple "=" to assign the equation to the 
symbol "sol".

Moreover, as you can see above, Log(s) is translated as Log*s, that is 
Log TIMES s, surely not what you wanted. Here too, using the correct 
syntax would help. What you want is Log[s] (square brackets).

You may have a look at

http://documents.wolfram.com/mathematica/GettingStarted/StartingOut/YourFirstMathematicaCalculations.html

Therefore, what is the correct syntax for the first line (assuming that 
"A9100" is the symbol A9100 and not a misspelling for A*9100 or whatever 
else)?

In[2]:=
sol = Log[v] == A9100*Log[s]

Out[2]=
Logs[v] == A9100*Log[s]

Now the second line gives

In[3]:=
sol2 = Solve[sol, v]

Out[3]=
{{v -> s^A9100}}

a replacement rule rather than the error message "Solve::eqf : 
A9100\Log\s is not a well-formed equation."

Now, if you derive directly this replacement rule, you get

In[4]:=
sol3 = D[sol2, s]

Out[4]=
{{0 -> A9100*s^(-1 + A9100)}}

which is not what you want: LHS and RHS are both derived and since "v" 
does not depend explicitly on "s" its derivative is zero. One of the 
possible solutions among many variations is

In[6]:=
sol3 = D[v /. sol2[[1]], s]

Out[6]=
A9100*s^(-1 + A9100)

Finally, the last command yields an error message

In[7]:=
Plot[Evaluate[sol3], {s, 0, 100}]

\!\(Plot::"plnr" : "\!\(A9100  \\\\
     s\^\(\(-1\) + A9100\)\) is not a machine-size real number at s = \
4.166666666666667`*^-6."\)

telling us that A9100 is not a number, which is true. We can circumvent 
this "problem" by assigning a value to A9100 before plotting the function:

In[7]:=
Plot[Evaluate[sol3 /. A9100 -> 1], {s, 0, 100}];

And the magic operates: we get a superb graph (of a straight line in 
this case :-)

Best regards,
/J.M.


  • Prev by Date: Re: Intersection @ Complement
  • Next by Date: Re: lists of variables
  • Previous by thread: Re: plot command
  • Next by thread: Did something change?