If[] and % problem
- To: mathgroup at smc.vnet.net
- Subject: [mg5444] If[] and % problem
- From: Sherman Reed <Sherman.Reed at worldnet.att.net>
- Date: Sat, 7 Dec 1996 00:26:20 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Hans,
Here is how I see it:
i^2+v^2
THIS IS EITHER A NUMBER
OR AN EXPRESSION(A FUNCTION
OF I AND V)
IF IT IS A NUMBER THE SECOND
STATEMENT WILL WORK AND THE
THIRD STATEMENT WILL PLOT A
CONSTANT.
IF IT IS AN EXPRESSION, THE
SECOND STATEMENT WILL FAIL
I AM NOT SURE WHAT THE PLOT3D
STATEMENT WILL DO, PROBABLY
NOTHING.
A non-elegant fix is the following:
g[i_,v_]:=i^2 + v^2
may have to isolate g[i,v]
for the next two statements
using the Block function
If[g[constanti,constantv]>15,15,g[i_,v_]
Plot3D[g[i,v],{i,-5,5},{v,-5,5}]