Displaying functions with negative index in STACK

Displaying functions with negative index in STACK

by Mike Taylor -
Number of replies: 5

I've a question that generates a negative index for an assigned function and then displays it as outlined below:

Question Variables:

a0:rand(9)+1;
a:a0*(-1);
f(x):=x^a;

Question text:

Find the gradient function \[y'={@f(x)@}\].

This results in:

STACK

is there a way to force it to display the negative index (see below for desired result) without resorting to manually entering the function into the Question text

STACK2

Question-level simplify = "No" doesn't fix it:

STACK3

Thanks in advance,

Mike

Average of ratings: -
In reply to Mike Taylor

Re: Displaying functions with negative index in STACK

by Mike Taylor -

Apologies... not sure what happened to the first screenshot image, it should have read:

"This results in:

STACK

is there a way to force it to display the negative index..."

In reply to Mike Taylor

Re: Displaying functions with negative index in STACK

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I am going to move this to the "Mathematics tools" forum, since that is where most STACK discussion takes place.

Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Displaying functions with negative index in STACK

by Mike Taylor -

Thanks Tim - I'll post there from now on.

In reply to Mike Taylor

Re: Displaying functions with negative index in STACK

by Stephan Bach -

Hi Mike,

this should work (at least for the part of the question you mentioned):

simp:false;
a0:rand(9)+1;
a:ev(a0*(-1),simp);
f(x):=x^a;

Or you generate the exponent in a different way:

simp:false;
a:rand_with_step(-9,-1,1);
f(x):=x^a;

Stephan.

Average of ratings: Useful (1)
In reply to Stephan Bach

Re: Displaying functions with negative index in STACK

by Mike Taylor -

It worked! Many thanks Stephan!