Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question
    
I also tried asuming(can = 2) and assign(can = 2) –  Kabumbus Sep 11 '11 at 17:58
    
And I can not simply just create g –  Kabumbus Sep 11 '11 at 17:59

1 Answer 1

up vote 2 down vote accepted

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);

share|improve this answer
    
Is it possible to feed an array to eval? (for example) something like Gtemp := eval(g, {can = t, cod = 10, p[1] = 10}) –  Kabumbus Sep 11 '11 at 18:33
    
That's not an array, that's a set. Yes, you can feed a set or list to eval. –  Robert Israel Sep 12 '11 at 0:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.