0
$\begingroup$

So I have a simple example of what I want to do:

restart; assume(can, real); f := {g = x+can*x*y, t = x+x*y}; assign(f[1]); g; can := 2; plot3d(g, x = 0 .. 100, y = 0 .. 100); 

enter image description here

while this works:

restart; f := {g = x+can*x*y, t = x+x*y}; assign(f[1]); can := 2; plot3d(g, x = 0 .. 100, y = 0 .. 100); 

enter image description here

But that assumptions are really important for my real life case (for some optimisations with complex numbers) so I cant just leve can not preassumed.

Why it plots nothuing for me and how to make it plot?

  • 0
    And I can not simply just create `g`2011-09-11

1 Answers 1

2

Your statement "assume(can,real);" produces a new variable (can~) and assigns it as the value of can. Your statement "assign(f[1]);" evaluates f[1] as g = x + can~*x*y and then assigns x + can~*x*y as the value of g. Now "can := 2;" assigns the new value 2 to can (removing the assumption), but this doesn't affect the value of g which has already been assigned and contains "can~" rather than "can". So when you try to plot g, it contains an unassigned parameter.

One thing you might do, instead of assigning a value to can (which removes an assumption you said is really important), is to evaluate g at the value can = 2. Thus omit the "can := 2" and try

plot3d(eval(g, can = 2), x = 0 .. 100, y = 0 .. 100);

  • 0
    That's not an array, that's a set. Yes, you can $f$eed a se$t$ or list to e$v$al.2011-09-12