kate101

68 Reputation

2 Badges

15 years, 218 days

MaplePrimes Activity


These are answers submitted by kate101

Thats great thanks, predefining it as a vector works fine.

I do need to use the loop, there's other things I need to calculate inside the loop,

thanks again,

Kate

Sorry for some reason this isn't coming up right

 

My loop is     for i from 1 to 5 do

                     eqn[1] = i;

                     end do

 

And I want to print out eqn so it looks like      eqn=[1,2,3,4,5]

Thanks for the replies, sorry I know that wasn't clear, I went to revise it but am having problems logging into maple and it wonr let me edit my posts.

Basically I'm asking:
is there a way to get (a much longer version of) this expression   (x1+x2+x3) / (x1+x2)

                                                                                 into the form      1 + x3/(x1+x2)

x1,x2,x3 are just any 3 variables, I used them as they are fairly standard variable names to use. In the work I am trying to do my variables are kc, dp etc, it doesn't really matter, I have copied and pasted from my work whch is why the variable names below look quite random.

 

The numerator of my equation look like:

Omega*kn*(dn^2*dc^2*dp^3-dc^4*kc^2*dp-kc^4*kp^3+kc^3*dp^2*dc*dn-dc^3*kc^2*dp^2-kc^3*kp^3*dc-kc^3*kp^3*dp+kc^3*kp^3*dn-kc^4*dp*dc^2+kc^3*dc^2*dp*dn-kc^3*dp^3*dc-kc^4*dp^2*dc+dn^2*dc^3*dp*kc+dn^2*dc^2*dp^2*kc-dc^4*kc*dp^2-dc^3*kc*dp^3-dc^4*dn*dp^2+dc^4*dn^2*dp-dc^3*dn*dp^3+2*dc^3*dn^2*dp^2-kc^3*dc^2*dp^2-dn^3*dc^3*dp-dn^3*dc^2*dp^2)

The denominator is      (-kc+dn)*(kc+dn)*(dn-dp-kc)

So the expression i want to get should look like:

1 + (some term) / (-kc+dn) + (some term) / (-kc+dn)*(kc+dn) +  (some term)/(-kc+dn)*(kc+dn)*(dn-dp-kc)

 

And I'm wondering is there any way to do this easily?

I was asking about factorisation because the long expression above clearly simplifies and should give me some terms to cancel with the denominator but when I do factor(expression) it doesnt work.

 

Thanks you for your help, sorry for the confusion,

Kate

 

By relevant I mean a term that cannot be fatorised in an expression ie y in  (x^2 + 2x + 1 + y). Maybe relevant isnt the right word to use, I meant relevant to the operation 'factor', which shouldnt be tring to include y in the factorisation

 

Actually no, it didn't work, its just plotting a straigt line. Here's my code: ode := diff(phi(z), z, z, z)+(diff(phi(z), z, z))*phi(z) = 0; odeadvisor(ode) ics := phi(0) = 0, (D[1](phi))(0) = 0, (D[1, 1](phi))(0) = 1; ans := dsolve({ics, ode}, numeric, phi(z), range = 0 .. 100); rhszphi := array[0 .. 100]; rhszdphi := array[0 .. 100]; rhszddphi := array[0 .. 100]; for i to 100 do rhszphi[i] := [rhs(op(1, ans(i))), rhs(op(2, ans(i)))]; rhszdphi[i] := [rhs(op(1, ans(i))), rhs(op(3, ans(i)))]; rhszddphi[i] := [rhs(op(1, ans(i))), rhs(op(4, ans(i)))] ; end do with(plots); plot(rhszphi, style = point); plot(rhszdphi, style = point); plot(rhszddphi, style = point); Thanks, Kate
That worked! Thank you! Just as a matter of interest, why did this work, from the maple help it seems that plot() plots a function while pointplot() can plot a matrix? Thanks again, Kate
Ok have partially answered my own question. I've used rhs to get just the numbers. rhsarr := array[1 .. 100] for i to 100 do rhsarr[i] := [rhs(op(1, ans(i))), rhs(op(3, ans(i)))] end do But it returns a table, not an array. I have tried to plot this as below but get an error. > with(plots); pointplot(rhsarr); Error, (in plots/tolist) points are not in the correct format Any help would be greatly appreciated!! Kate
Page 1 of 1